Bug 1407343 Silence multiple classes of annoying warnings draft
authorTom Ritter <tom@mozilla.com>
Tue, 24 Oct 2017 14:31:01 -0500
changeset 688237 8aae23e81f24d31c82634ead96265a9882582ad5
parent 688228 ed73b55a33120d27efc862eb87d332e167c026f4
child 688238 aea8207060f7593278453a682ec4fff19cbad35d
child 688241 3340316e5ac9b7803ad2ca896b676c4632a2e901
push id86698
push userbmo:tom@mozilla.com
push dateSun, 29 Oct 2017 03:44:30 +0000
bugs1407343
milestone58.0a1
Bug 1407343 Silence multiple classes of annoying warnings MozReview-Commit-ID: I0PvrH4Zy33
build/moz.configure/warnings.configure
--- a/build/moz.configure/warnings.configure
+++ b/build/moz.configure/warnings.configure
@@ -108,25 +108,51 @@ check_and_add_gcc_warning('-Wno-error=fr
 # catches format/argument mismatches with printf
 check_and_add_gcc_warning('-Wformat')
 
 # We use mix of both POSIX and Win32 printf format across the tree, so format
 # warnings are useless on mingw.
 check_and_add_gcc_warning('-Wno-format',
                           when=depends(target)(lambda t: t.kernel == 'WINNT'))
 
-# When compiling for Windows with gcc, we encounter lots of "#pragma warning"'s
-# which is an MSVC-only pragma that GCC does not recognize.
-check_and_add_gcc_warning('-Wno-unknown-pragmas',
-                          when=depends(target)(lambda t: t.kernel == 'WINNT'))
+# Other MinGW specific things
+with only_when(depends(target)(lambda t: t.kernel == 'WINNT')):
+  # When compiling for Windows with gcc, we encounter lots of "#pragma warning"'s
+  # which is an MSVC-only pragma that GCC does not recognize.
+  check_and_add_gcc_warning('-Wno-unknown-pragmas')
+
+  # When compiling for Windows with gcc, gcc throws false positives and true
+  # positives where the callsite is ifdef-ed out
+  check_and_add_gcc_warning('-Wno-unused-function')
+
+  # When compiling for Windows with gcc, gcc cannot produce this warning
+  # correctly, it mistakes DWORD_PTR and ULONG_PTR as types you cannot
+  # give NULL to. (You can in fact do that.)
+  check_and_add_gcc_warning('-Wno-conversion-null')
 
-# When compiling for Windows with gcc, gcc throws false positives and true
-# positives where the callsite is ifdef-ed out
-check_and_add_gcc_warning('-Wno-unused-function',
-                          when=depends(target)(lambda t: t.kernel == 'WINNT'))
+  # For now, silence low priority gcc warnings globally
+  check_and_add_gcc_warning('-Wno-unused-value')
+  check_and_add_gcc_warning('-Wno-unused-variable')
+  check_and_add_gcc_warning('-Wno-unused-but-set-variable')
+
+  # Warn whenever a comment-start sequence ‘/*’ appears in a ‘/*’ comment, or
+  # whenever a backslash-newline appears in a ‘//’ comment.
+  check_and_add_gcc_warning('-Wno-comment')
+  # Warn whenever a switch statement has an index of enumerated type and lacks
+  # a case for one or more of the named codes of that enumeration.
+  check_and_add_gcc_warning('-Wno-switch')
+  # When compiling C, give string constants the type const char[length] so that
+  # copying the address of one into a non-const char * pointer produces a warning.
+  check_and_add_gcc_warning('-Wno-write-strings')
+  # Warn if the return type of a function has a type qualifier such as const
+  check_and_add_gcc_warning('-Wno-ignored-qualifiers')
+  # Warn if parentheses are omitted in certain contexts
+  check_and_add_gcc_warning('-Wno-parentheses')
+  # Warn about a comparison between values of different enumerated types
+  check_and_add_gcc_warning('-Wno-enum-compare')
 
 # We hit this all over the place with the gtest INSTANTIATE_TEST_CASE_P macro
 check_and_add_gcc_warning('-Wno-gnu-zero-variadic-macro-arguments')
 
 # Add compile-time warnings for unprotected functions and format functions
 # that represent possible security problems
 check_and_add_gcc_warning('-Wformat-security')
 check_and_add_gcc_warning('-Wformat-overflow=2')