Add new compiler warnings
While doing legacy/trac#19044 (moved) I tried to sort all the GCC warnings to see if we missed any that we could add. I came up with a list that we could add without triggering any new warnings (for me), and a list of ones tthat maybe looked good, but which do trigger today. I'm thinking that we can add these with little to no trouble:
-Wunused-but-set-parameter -Wunused -Wuninitialized -Wstrict-aliasing=5
-Wswitch-bool -Wtrampolines -Wunused-but-set-variable -Wvariadic-macros
-Wsync-nand -Wdate-time -Wsizeof-array-argument
-Wunused-parameter -Wunused-local-typedefs
-Wshift-count-negative -Wshift-count-overflow
-Wc99-c11-compat -Wcast-align -Wpacked
-Wmissing-format-attribute -Wsuggest-attribute=noreturn -Wsuggest-attribute=format
And we can add these GCC-6 only options with little to no trouble:
-Wshift-negative-value -Wshift-overflow=2 -Wignored-attributes
These warnings look useful but they trigger on our current code. Is it worth fixing these warnings?
-Wconversion
-Wsign-conversion
-Wunsafe-loop-optimizations
-Waggregate-return // one place only, I believe.
-Wdouble-promotion // Pretty easy to fix.
-Wunsuffixed-float-constants // We have these all over.
-Wcast-qual
-Wstrict-overflow=n
-Wstrict-overflow
-Wpadded
-Wjump-misses-init // lots of these; are any bugs?
-Wswitch-default
-Wsuggest-attribute=pure
-Wsuggest-attribute=const
-Wfloat-conversion // just a dozen or so.
-Woverlength-strings // only in tests
And these gcc6-only warnings trigger on our current code:
-Wnull-dereference
-Wunused-const-variable
-Wduplicated-cond