by ggreer · 12y ago · 0 comments
-Wall -Wextra -Wformat=2 -Wno-format-nonliteral -Wshadow \
-Wpointer-arith -Wcast-qual -Wmissing-prototypes -Wno-missing-braces \
-std=gnu89 -D_GNU_SOURCE -O2
Note that -Wall and -Wextra do not enable all warnings. To keep backwards compatibility, -Wall is basically, "All warnings as of 1990." -Wextra covers a lot of the newer warnings, but still misses a few.I also use scan-build[2] for static analysis and clang-format[3] to ensure a consistent style. It was frustrating when I first enabled all these options, but the warnings helped me discover bugs that had been lurking for years.
1. https://github.com/ggreer/the_silver_searcher
-Wstrict-aliasing=1/-Wsuggest-attribute= can give good suggestions during development.
Probably not useful for Ag: But I do a lot of numeric stuff so -Wfloat-equal is handy for me. For code using float this should be mandatory: -Wdouble-promotion.
I thought there was a better tool, but can't find the name, hmm.