From 28b1c5f9b3cde00c88b7729b96613ff0e51132d9 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 6 Jul 2022 19:54:30 +0300 Subject: LCC: get rid of excess -Wunused-but-set-variable on release builds LCC, as of 1.26, has a buggy EDG frontend that emits -Wunused-but-set-variable warning even if there's something like "(void)var" when frontend optimizations are enabled (>=-O1). To get rid of this warning, we disable it in CMake's root CMakeLists.txt for LCC >= 1.26. Later, when this bug will be fixed in LCC, this version check will have its top version limit. --- CompileFlags.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'CompileFlags.cmake') diff --git a/CompileFlags.cmake b/CompileFlags.cmake index e6fb20b500..5641de4119 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -136,3 +136,12 @@ OFF to disable /MP completely." ) endif() endif() endif() + +# Get rid of excess -Wunused-but-set-variable on release builds with LCC >= 1.26 +foreach(l C CXX) + if(CMAKE_${l}_COMPILER_ID STREQUAL "LCC" AND NOT CMAKE_${l}_COMPILER_VERSION VERSION_LESS 1.26) + foreach(c MINSIZEREL RELEASE RELWITHDEBINFO) + string(APPEND "CMAKE_${l}_FLAGS_${c}" " -Wno-unused-but-set-variable") + endforeach() + endif() +endforeach() -- cgit v1.2.1