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

Commit

Permalink
Merge pull request #53 from raramakr/swdev-hasherror
Browse files Browse the repository at this point in the history
SWDEV-366831 - Compile time flag to switch between #warning and #erro…
  • Loading branch information
ashwinma authored Mar 15, 2023
2 parents 9eb2ac6 + ba2789e commit 7ba0f36
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ add_subdirectory(compiler)
add_subdirectory(device_runtime)

if(FILE_REORG_BACKWARD_COMPATIBILITY)
# To enable disable #error in wrapper header files
if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR)
if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR})
set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}"
CACHE STRING "Header wrapper warnings as errors.")
else()
set(ROCM_HEADER_WRAPPER_WERROR "ON" CACHE STRING "Header wrapper warnings as errors.")
endif()
endif()
if(ROCM_HEADER_WRAPPER_WERROR)
set(deprecated_error 1)
else()
set(deprecated_error 0)
endif()

include(atmi-backward-compat.cmake)
endif()
# make examples available in local build
Expand Down
9 changes: 8 additions & 1 deletion src/atmi-backward-compat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,18 @@ function(create_header_template)
#ifndef @include_guard@
#define @include_guard@
#if defined(__GNUC__)
#ifndef ROCM_HEADER_WRAPPER_WERROR
#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@
#endif
#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */
#error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with atmi\"
#else /* ROCM_HEADER_WRAPPER_WERROR 0 */
#if defined(__GNUC__)
#warning \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with atmi\"
#else
#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with atmi\")
#endif
#endif /* ROCM_HEADER_WRAPPER_WERROR */
@include_statements@
Expand Down

0 comments on commit 7ba0f36

Please sign in to comment.