From eec545fd9fcbc207b281671f8b8cd7ec5234dae9 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Mon, 23 Aug 2021 18:10:39 -0500 Subject: [PATCH] Build fix for older clang compilers. Per clang 13 option -Wno-error=unused-but-set-variable is not recoginized nor is the diagnostic emitted. Set this option conditional to the clang compiler version. Change-Id: I3c0958dffa985d53b641f9eff4e702988dffd033 --- runtime/hsa-runtime/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/runtime/hsa-runtime/CMakeLists.txt b/runtime/hsa-runtime/CMakeLists.txt index d0cc8e6528..1b830e0baa 100644 --- a/runtime/hsa-runtime/CMakeLists.txt +++ b/runtime/hsa-runtime/CMakeLists.txt @@ -126,16 +126,19 @@ target_include_directories( ${CORE_RUNTIME_TARGET} set_property(TARGET ${CORE_RUNTIME_TARGET} PROPERTY INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64" ) ## ------------------------- Linux Compiler and Linker options ------------------------- -set ( HSA_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=missing-braces -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function -Wno-error=unused-but-set-variable ) +set ( HSA_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=missing-braces -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function ) ## Extra image settings - audit! set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-deprecated-declarations ) if ( CMAKE_COMPILER_IS_GNUCXX ) - set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-error=maybe-uninitialized) + set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-error=maybe-uninitialized -Wno-error=unused-but-set-variable) endif () if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang") set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-error=self-assign) + if( CLANG_VERSION_MAJOR -ge 13) + set ( HSA_CXX_FLAGS ${HSA_CXX_FLAGS} -Wno-error=unused-but-set-variable) + endif() endif() set ( DRVDEF "${CMAKE_CURRENT_SOURCE_DIR}/hsacore.so.def" )