Browse Source

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.
makise-homura 3 years ago
parent
commit
28b1c5f9b3
1 changed files with 9 additions and 0 deletions
  1. 9 0
      CompileFlags.cmake

+ 9 - 0
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()