Skip to content

Commit

Permalink
SWDEV-366831 - Compile time flag to switch between #warning and #erro…
Browse files Browse the repository at this point in the history
…r message

Using backward compatibility paths will provide an #error message. Compile time option added to enable/disable the #error message.
Disabling the same will provide a #warning message

Change-Id: I6abc236e810ccc38d3636074e0e8f5a9657c2e9a
  • Loading branch information
raramakr committed Mar 10, 2023
1 parent 4edc972 commit ea061be
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
9 changes: 8 additions & 1 deletion header_template.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@
#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 roctracer"
#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 roctracer"
#else
#pragma message("This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with roctracer")
#endif
#endif /* ROCM_HEADER_WRAPPER_WERROR */

@include_statements@

Expand Down
14 changes: 14 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,19 @@ if(NOT ENABLE_ASAN_PACKAGING)
endif()

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(${PROJECT_SOURCE_DIR}/roctracer-backward-compat.cmake)
endif()

0 comments on commit ea061be

Please sign in to comment.