Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit 7ba0f36

Browse files
authored
Merge pull request #53 from raramakr/swdev-hasherror
SWDEV-366831 - Compile time flag to switch between #warning and #erro…
2 parents 9eb2ac6 + ba2789e commit 7ba0f36

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/CMakeLists.txt

+15
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ add_subdirectory(compiler)
6565
add_subdirectory(device_runtime)
6666

6767
if(FILE_REORG_BACKWARD_COMPATIBILITY)
68+
# To enable disable #error in wrapper header files
69+
if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR)
70+
if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR})
71+
set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}"
72+
CACHE STRING "Header wrapper warnings as errors.")
73+
else()
74+
set(ROCM_HEADER_WRAPPER_WERROR "ON" CACHE STRING "Header wrapper warnings as errors.")
75+
endif()
76+
endif()
77+
if(ROCM_HEADER_WRAPPER_WERROR)
78+
set(deprecated_error 1)
79+
else()
80+
set(deprecated_error 0)
81+
endif()
82+
6883
include(atmi-backward-compat.cmake)
6984
endif()
7085
# make examples available in local build

src/atmi-backward-compat.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,18 @@ function(create_header_template)
6565
#ifndef @include_guard@
6666
#define @include_guard@
6767
68-
#if defined(__GNUC__)
68+
#ifndef ROCM_HEADER_WRAPPER_WERROR
69+
#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@
70+
#endif
71+
#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */
6972
#error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with atmi\"
73+
#else /* ROCM_HEADER_WRAPPER_WERROR 0 */
74+
#if defined(__GNUC__)
75+
#warning \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with atmi\"
7076
#else
7177
#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with atmi\")
7278
#endif
79+
#endif /* ROCM_HEADER_WRAPPER_WERROR */
7380
7481
@include_statements@
7582

0 commit comments

Comments
 (0)