Bug 1356843 - Enable -Wcomma clang warnings. r=glandium
authorChris Peterson <cpeterson@mozilla.com>
Sat, 08 Apr 2017 12:36:48 -0700
changeset 354250 bdef06c12da66afcb3247863486b7c320c22b3e5
parent 354249 6deb37b2d3a1390d2bb84e4db2fcd373b8999144
child 354251 618da494f8ec9b4a7f39eeca5754c10bab4d1cb3
push id31688
push usercbook@mozilla.com
push dateFri, 21 Apr 2017 08:57:42 +0000
treeherdermozilla-central@950b641e2b9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1356843
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1356843 - Enable -Wcomma clang warnings. r=glandium Warn about possible misuse of the comma operator such as between two statements or to call a function for side effects within an expression. Only enable these -Wcomma warnings for C++ code because there are almost two hundred -Wcomma warnings in third-party C libraries. I reviewed the C warnings and confirmed none of them were latent bugs. We won't fix these libraries' warnings so they are just noise. MozReview-Commit-ID: 1JXJumg6DsJ
build/moz.configure/warnings.configure
--- a/build/moz.configure/warnings.configure
+++ b/build/moz.configure/warnings.configure
@@ -56,16 +56,19 @@ check_and_add_gcc_warning('-Wclass-varar
 check_and_add_gcc_warning('-Wloop-analysis')
 
 # catches C++ version forward-compat issues
 check_and_add_gcc_warning('-Wc++11-compat-pedantic', cxx_compiler)
 check_and_add_gcc_warning('-Wc++14-compat', cxx_compiler)
 check_and_add_gcc_warning('-Wc++14-compat-pedantic', cxx_compiler)
 check_and_add_gcc_warning('-Wc++1z-compat', cxx_compiler)
 
+# catches possible misuse of the comma operator
+check_and_add_gcc_warning('-Wcomma', cxx_compiler)
+
 # catches unintentional switch case fallthroughs
 check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler)
 
 # catches expressions used as a null pointer constant
 # XXX: at the time of writing, the version of clang used on the OS X test
 # machines has a bug that causes it to reject some valid files if both
 # -Wnon-literal-null-conversion and -Wsometimes-uninitialized are
 # specified. We work around this by instead using