SWDEV-366831 - Compile time flag to switch between #warning and #error message
Using backward compatibility paths will provide #warning message be default.
Compile time option added to enable/disable the #error message.
Updated the backward compatibility message
Change-Id: I3bab00df26145991b32176d2d76977c2e953bf5f
[ROCm/clr commit: f788150132]
This commit is contained in:
@@ -473,6 +473,22 @@ endif()
|
||||
#File reorg Backward compatibility function
|
||||
if(NOT WIN32)
|
||||
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 "OFF" 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(hip-backward-compat.cmake)
|
||||
endif()
|
||||
endif() #FILE_REORG_BACKWARD_COMPATIBILITY
|
||||
endif()
|
||||
|
||||
@@ -22,11 +22,18 @@
|
||||
#ifndef @include_guard@
|
||||
#define @include_guard@
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#warning "This file is deprecated. Use header files from HIP_PATH/include, where HIP_PATH corresponds to HIP install path"
|
||||
#else
|
||||
#pragma message("This file is deprecated. Use header files from HIP_PATH/include, where HIP_PATH corresponds to HIP install path")
|
||||
#ifndef ROCM_HEADER_WRAPPER_WERROR
|
||||
#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@
|
||||
#endif
|
||||
#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */
|
||||
#error "@file_name@ has moved to @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ and package include paths have changed. Provide include path as @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ when using cmake packages."
|
||||
#else /* ROCM_HEADER_WRAPPER_WERROR 0 */
|
||||
#if defined(__GNUC__)
|
||||
#warning "@file_name@ has moved to @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ and package include paths have changed. Provide include path as @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ when using cmake packages."
|
||||
#else
|
||||
#pragma message ("@file_name@ has moved to @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@headerfile_dir@ and package include paths have changed. Provide include path as @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ when using cmake packages.")
|
||||
#endif
|
||||
#endif /* ROCM_HEADER_WRAPPER_WERROR */
|
||||
|
||||
@include_statements@
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ set(HIP_WRAPPER_FINDHIP_DIR ${HIP_WRAPPER_DIR}/FindHIP)
|
||||
set(HIP_SRC_INC_DIR ${HIP_SRC_PATH}/include/hip)
|
||||
set(HIP_SRC_BIN_DIR ${HIP_SRC_PATH}/bin)
|
||||
set(HIP_INFO_FILE ".hipInfo")
|
||||
set(HIP_AMD_DETAIL_DIR "amd_detail")
|
||||
set(HIP_NVIDIA_DETAIL_DIR "nvidia_detail")
|
||||
|
||||
#Function to set actual file contents in wrapper files
|
||||
#Some components grep for the contents in the file
|
||||
@@ -46,8 +48,8 @@ endfunction()
|
||||
#use header template file and generate wrapper header files
|
||||
function(generate_wrapper_header)
|
||||
#create respecitve folder in /opt/rocm/hip
|
||||
file(MAKE_DIRECTORY ${HIP_WRAPPER_INC_DIR}/amd_detail)
|
||||
file(MAKE_DIRECTORY ${HIP_WRAPPER_INC_DIR}/nvidia_detail)
|
||||
file(MAKE_DIRECTORY ${HIP_WRAPPER_INC_DIR}/${HIP_AMD_DETAIL_DIR})
|
||||
file(MAKE_DIRECTORY ${HIP_WRAPPER_INC_DIR}/${HIP_NVIDIA_DETAIL_DIR})
|
||||
|
||||
#find all header files from include/hip
|
||||
file(GLOB include_files ${HIP_BUILD_DIR}/include/hip/*.h)
|
||||
@@ -59,7 +61,8 @@ function(generate_wrapper_header)
|
||||
set(include_guard "HIP_WRAPPER_INCLUDE_HIP_${INC_GAURD_NAME}_H")
|
||||
#set #include statement
|
||||
get_filename_component(file_name ${header_file} NAME)
|
||||
set(include_statements "#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/hip/${file_name}\"\n")
|
||||
set(headerfile_dir "hip")
|
||||
set(include_statements "#include \"../../../${CMAKE_INSTALL_INCLUDEDIR}/${headerfile_dir}/${file_name}\"\n")
|
||||
if(${file_name} STREQUAL "hip_version.h")
|
||||
set_file_contents(${header_file})
|
||||
else()
|
||||
@@ -68,7 +71,7 @@ function(generate_wrapper_header)
|
||||
endforeach()
|
||||
|
||||
#find all header files from include/hip/amd_detail
|
||||
file(GLOB include_files ${HIP_SRC_INC_DIR}/amd_detail/*)
|
||||
file(GLOB include_files ${HIP_SRC_INC_DIR}/${HIP_AMD_DETAIL_DIR}/*)
|
||||
#Convert the list of files into #includes
|
||||
foreach(header_file ${include_files})
|
||||
# set include guard
|
||||
@@ -77,13 +80,14 @@ function(generate_wrapper_header)
|
||||
set(include_guard "HIP_WRAPPER_INCLUDE_HIP_AMD_DETAIL_${INC_GAURD_NAME}_H")
|
||||
#set #include statement
|
||||
get_filename_component(file_name ${header_file} NAME)
|
||||
set(include_statements "#include \"../../../../${CMAKE_INSTALL_INCLUDEDIR}/hip/amd_detail/${file_name}\"\n")
|
||||
set(headerfile_dir "hip/${HIP_AMD_DETAIL_DIR}")
|
||||
set(include_statements "#include \"../../../../${CMAKE_INSTALL_INCLUDEDIR}/${headerfile_dir}/${file_name}\"\n")
|
||||
|
||||
configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/amd_detail/${file_name})
|
||||
configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/${HIP_AMD_DETAIL_DIR}/${file_name})
|
||||
endforeach()
|
||||
|
||||
#find all header files from include/hip/nvidia_detail
|
||||
file(GLOB include_files ${HIP_SRC_INC_DIR}/nvidia_detail/*)
|
||||
file(GLOB include_files ${HIP_SRC_INC_DIR}/${HIP_NVIDIA_DETAIL_DIR}/*)
|
||||
#Convert the list of files into #includes
|
||||
foreach(header_file ${include_files})
|
||||
# set include guard
|
||||
@@ -92,9 +96,10 @@ function(generate_wrapper_header)
|
||||
set(include_guard "HIP_WRAPPER_INCLUDE_HIP_NVIDIA_DETAIL_${INC_GAURD_NAME}_H")
|
||||
#set #include statement
|
||||
get_filename_component(file_name ${header_file} NAME)
|
||||
set(include_statements "#include \"../../../../${CMAKE_INSTALL_INCLUDEDIR}/hip/nvidia_detail/${file_name}\"\n")
|
||||
set(headerfile_dir "hip/${HIP_NVIDIA_DETAIL_DIR}")
|
||||
set(include_statements "#include \"../../../../${CMAKE_INSTALL_INCLUDEDIR}/${headerfile_dir}/${file_name}\"\n")
|
||||
|
||||
configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/nvidia_detail/${file_name})
|
||||
configure_file(${HIP_SRC_PATH}/header_template.hpp.in ${HIP_WRAPPER_INC_DIR}/${HIP_NVIDIA_DETAIL_DIR}/${file_name})
|
||||
endforeach()
|
||||
|
||||
endfunction()
|
||||
|
||||
@@ -111,6 +111,21 @@ add_subdirectory(packaging)
|
||||
|
||||
#File reorg Backward compatibility function
|
||||
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 "OFF" 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(opencl-backward-compat.cmake)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -53,11 +53,18 @@ function(create_header_template)
|
||||
#ifndef @include_guard@
|
||||
#define @include_guard@
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with CL\")
|
||||
#elif defined(__GNUC__)
|
||||
#warning \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with CL\"
|
||||
#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 CL\"
|
||||
#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 CL\"
|
||||
#else
|
||||
#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with CL\")
|
||||
#endif
|
||||
#endif /* ROCM_HEADER_WRAPPER_WERROR */
|
||||
|
||||
@include_statements@
|
||||
|
||||
|
||||
مرجع در شماره جدید
Block a user