From 1884042f5ddd520bdcc83c4398ac396883990745 Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Tue, 16 May 2023 09:58:04 +0100 Subject: [PATCH] [NFC] cmake: do not suppress -Wunused-but-set-variable globally (#1723) Only disable `-Wunused-but-set-variable` for tests that do not compile cleanly with this warning enabled. This re-enables the warning for most other tests, so that it can catch any new occurrences. Signed-off-by: Sven van Haastregt --- CMakeLists.txt | 1 - test_conformance/basic/CMakeLists.txt | 2 ++ test_conformance/conversions/CMakeLists.txt | 2 ++ test_conformance/device_timer/CMakeLists.txt | 2 ++ test_conformance/images/clCopyImage/CMakeLists.txt | 2 ++ test_conformance/images/clReadWriteImage/CMakeLists.txt | 2 ++ test_conformance/images/kernel_read_write/CMakeLists.txt | 2 +- test_conformance/mem_host_flags/CMakeLists.txt | 2 ++ test_conformance/non_uniform_work_group/CMakeLists.txt | 2 ++ 9 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc072670..4fce58d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang" add_cxx_flag_if_supported(-Wall) # Suppress warnings that currently trigger on the code base. # This list should shrink over time when warnings are fixed. - add_cxx_flag_if_supported(-Wno-unused-but-set-variable) add_cxx_flag_if_supported(-Wno-sometimes-uninitialized) add_cxx_flag_if_supported(-Wno-sign-compare) endif() diff --git a/test_conformance/basic/CMakeLists.txt b/test_conformance/basic/CMakeLists.txt index 6d61f0cf..dde3311d 100644 --- a/test_conformance/basic/CMakeLists.txt +++ b/test_conformance/basic/CMakeLists.txt @@ -70,4 +70,6 @@ if(APPLE) list(APPEND ${MODULE_NAME}_SOURCES test_queue_priority.cpp) endif(APPLE) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../CMakeCommon.txt) diff --git a/test_conformance/conversions/CMakeLists.txt b/test_conformance/conversions/CMakeLists.txt index 523b6ead..cc019b26 100644 --- a/test_conformance/conversions/CMakeLists.txt +++ b/test_conformance/conversions/CMakeLists.txt @@ -16,4 +16,6 @@ set_source_files_properties( COMPILE_FLAGS -march=i686) endif(NOT CMAKE_CL_64 AND NOT MSVC AND NOT ANDROID) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../CMakeCommon.txt) diff --git a/test_conformance/device_timer/CMakeLists.txt b/test_conformance/device_timer/CMakeLists.txt index 4af7c7f7..a24d8d24 100644 --- a/test_conformance/device_timer/CMakeLists.txt +++ b/test_conformance/device_timer/CMakeLists.txt @@ -5,4 +5,6 @@ set(${MODULE_NAME}_SOURCES test_device_timer.cpp ) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../CMakeCommon.txt) diff --git a/test_conformance/images/clCopyImage/CMakeLists.txt b/test_conformance/images/clCopyImage/CMakeLists.txt index d8aace41..bf06dc68 100644 --- a/test_conformance/images/clCopyImage/CMakeLists.txt +++ b/test_conformance/images/clCopyImage/CMakeLists.txt @@ -15,5 +15,7 @@ set(${MODULE_NAME}_SOURCES ../common.cpp ) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../../CMakeCommon.txt) diff --git a/test_conformance/images/clReadWriteImage/CMakeLists.txt b/test_conformance/images/clReadWriteImage/CMakeLists.txt index 9308bbfe..bc1600ff 100644 --- a/test_conformance/images/clReadWriteImage/CMakeLists.txt +++ b/test_conformance/images/clReadWriteImage/CMakeLists.txt @@ -11,5 +11,7 @@ set(${MODULE_NAME}_SOURCES ../common.cpp ) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../../CMakeCommon.txt) diff --git a/test_conformance/images/kernel_read_write/CMakeLists.txt b/test_conformance/images/kernel_read_write/CMakeLists.txt index ccd678c1..b5527c74 100644 --- a/test_conformance/images/kernel_read_write/CMakeLists.txt +++ b/test_conformance/images/kernel_read_write/CMakeLists.txt @@ -21,7 +21,7 @@ set(${MODULE_NAME}_SOURCES # Make unused variables not fatal in this module; see # https://github.com/KhronosGroup/OpenCL-CTS/issues/1484 -set_gnulike_module_compile_flags("-Wno-error=unused-variable") +set_gnulike_module_compile_flags("-Wno-error=unused-variable -Wno-unused-but-set-variable") include(../../CMakeCommon.txt) diff --git a/test_conformance/mem_host_flags/CMakeLists.txt b/test_conformance/mem_host_flags/CMakeLists.txt index 73a36f0d..4f2b960d 100644 --- a/test_conformance/mem_host_flags/CMakeLists.txt +++ b/test_conformance/mem_host_flags/CMakeLists.txt @@ -6,4 +6,6 @@ set(${MODULE_NAME}_SOURCES mem_host_image.cpp ) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../CMakeCommon.txt) diff --git a/test_conformance/non_uniform_work_group/CMakeLists.txt b/test_conformance/non_uniform_work_group/CMakeLists.txt index 30c3a846..f78dd195 100644 --- a/test_conformance/non_uniform_work_group/CMakeLists.txt +++ b/test_conformance/non_uniform_work_group/CMakeLists.txt @@ -10,6 +10,8 @@ set(${MODULE_NAME}_SOURCES tools.cpp ) +set_gnulike_module_compile_flags("-Wno-unused-but-set-variable") + include(../CMakeCommon.txt) # end of file #