[m-rev.] for review: Disable uninitialized variable warnings in high-level C grades.

Peter Wang novalazy at gmail.com
Fri May 31 17:01:37 AEST 2019


scripts/mgnuc.in:
    Disable uninitialized variable warnings in high-level C grades.
    This is necessary but went (mostly) unnoticed because we happen to
    disable uninitialized variable warnings for gcc on x86/x86_64 in
    support of low-level C grades, and we suppress any and all warnings
    if using clang.

diff --git a/scripts/mgnuc.in b/scripts/mgnuc.in
index 2175708e8..c250235a9 100644
--- a/scripts/mgnuc.in
+++ b/scripts/mgnuc.in
@@ -520,14 +520,23 @@ SANITIZER_OPTS="$CFLAGS_FOR_SANITIZERS"
 #
 
 ARCH_OPTS=""
+
+# XXX gcc generates warnings about possibly uninitialized variables in
+# high-level C code. clang would, too, if we did not suppress all warnings.
+case "$highlevel_code" in
+    true)
+        CHECK_OPTS="$CHECK_OPTS -Wno-uninitialized"
+        ;;
+esac
+
 case "$FULLARCH" in
     i*86-*|x86_64*)
         # The use of stack_pointer in the ASM_JUMP macro defined in
         # runtime/mercury_goto.h causes lots of warnings about using possibly
         # uninitialized variables; there's no easy way to suppress them except
         # by disabling the warning.
-        case "$COMPILER" in
-            gcc)
+        case "$COMPILER,$highlevel_code" in
+            gcc,false)
                 CHECK_OPTS="$CHECK_OPTS -Wno-uninitialized"
                 ;;
         esac
-- 
2.21.0



More information about the reviews mailing list