From b7ab8323bd25b2fcf939f4d8d8d90e861f16a2d7 Mon Sep 17 00:00:00 2001 From: AravindanC Date: Wed, 8 Mar 2023 10:10:56 -0800 Subject: [PATCH] SWDEV-366831 - Wrapper header warning as error enabled with option flag Change-Id: Ic923027cc20edff067044a6fe56a879c0ecddf7e [ROCm/rocprofiler commit: ed96e9fbb6a32da272a82593772df0643aa5c4a2] --- projects/rocprofiler/CMakeLists.txt | 17 ++++++++++++++++- .../rocprofiler-backward-compat.cmake | 7 +++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/projects/rocprofiler/CMakeLists.txt b/projects/rocprofiler/CMakeLists.txt index 9729b97b07..b3aa0d5bd0 100644 --- a/projects/rocprofiler/CMakeLists.txt +++ b/projects/rocprofiler/CMakeLists.txt @@ -261,8 +261,23 @@ install( option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" ON) if(FILE_REORG_BACKWARD_COMPATIBILITY) + # To enabe/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(rocprofiler-backward-compat.cmake) -endif() +endif() #FILE_REORG_BACKWARD_COMPATIBILITY if(${LIBRARY_TYPE} STREQUAL SHARED) # Packaging directives diff --git a/projects/rocprofiler/rocprofiler-backward-compat.cmake b/projects/rocprofiler/rocprofiler-backward-compat.cmake index a9b4b78278..658aab0d6b 100644 --- a/projects/rocprofiler/rocprofiler-backward-compat.cmake +++ b/projects/rocprofiler/rocprofiler-backward-compat.cmake @@ -52,11 +52,18 @@ function(create_header_template) #ifndef @include_guard@ #define @include_guard@ +#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 rocprofiler\" +#else /* ROCM_HEADER_WRAPPER_WERROR 0 */ #if defined(__GNUC__) #error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with rocprofiler\" #else #pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with rocprofiler\") #endif +#endif /* ROCM_HEADER_WRAPPER_WERROR */ @include_statements@ #endif")