Browse Source

[build conf] Define NO_COMPILER_WARNINGS for gcc

[build conf] Define NO_COMPILER_WARNINGS for gcc
85defc4552c8c13995398eae3a33e698cdf66518
l1tsolaiki 9 months ago
parent
commit
b455476760
1 changed files with 17 additions and 6 deletions
  1. 17 6
      build/conf/compilers/gnu_compiler.conf

+ 17 - 6
build/conf/compilers/gnu_compiler.conf

@@ -83,14 +83,25 @@ DEBUG_INFO_FLAGS=$_DEBUG_INFO_FLAGS
 when ($NO_WSHADOW == "yes") {
     C_WARNING_OPTS += -Wno-shadow
 }
-# Though -w is intended to switch off all the warnings,
-# it does not switch at least -Wregister and -Wreserved-user-defined-literal under clang.
-#
-# Use -Wno-everything to force warning suppression.
+
 when ($NO_COMPILER_WARNINGS == "yes") {
-    C_WARNING_OPTS = -Wno-everything
-    CXX_WARNING_OPTS = -Wno-everything
+    # Though -w is intended to switch off all the warnings,
+    # it does not switch at least -Wregister and -Wreserved-user-defined-literal under clang.
+    #
+    # Use -Wno-everything to force warning suppression.
+    when ($CLANG == "yes") {
+        C_WARNING_OPTS = -Wno-everything
+        CXX_WARNING_OPTS = -Wno-everything
+    }
+
+    # On gcc -Wno-everything is not supported, so we use -w
+    # see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+    elsewhen ($GCC == "yes") {
+        C_WARNING_OPTS = -w
+        CXX_WARNING_OPTS = -w
+    }
 }
+
 when ($NO_OPTIMIZE == "yes") {
     OPTIMIZE = -O0
 }