Adding new gcc warnings
Russ Allbery
rra at stanford.edu
Mon Apr 22 21:59:43 UTC 2013
Russ Allbery <rra at stanford.edu> writes:
> Julien ÉLIE <julien at trigofacile.com> writes:
>> -Winit-self
> I always left this off because if I were to ever do that, it would be
> intentional; it's a hard mistake to make by accident. But I don't recall
> ever using it, so I have no objections.
And, as it turns out, I started using it for my other projects somewhere
along the line. :)
Based on this discussion, I read through the other options, and am now
trying:
# A set of flags for warnings. Add -O because gcc won't find some warnings
# without optimization turned on. Desirable warnings that can't be turned
# on due to other problems:
#
# -Wconversion http://bugs.debian.org/488884 (htons warnings)
#
# Last checked against gcc 4.7.2 (2013-04-22). -D_FORTIFY_SOURCE=2 enables
# warn_unused_result attribute markings on glibc functions on Linux, which
# catches a few more issues.
WARNINGS = -g -O -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wendif-labels \
-Wformat=2 -Winit-self -Wswitch-enum -Wuninitialized -Wfloat-equal \
-Wdeclaration-after-statement -Wshadow -Wpointer-arith \
-Wbad-function-cast -Wcast-align -Wwrite-strings \
-Wjump-misses-init -Wlogical-op -Wstrict-prototypes \
-Wold-style-definition -Wmissing-prototypes -Wnormalized=nfc \
-Wpacked -Wredundant-decls -Wnested-externs -Winline -Wvla -Werror
with other packages. (The order of flags is intended to match the order
in which they're presented in the GCC manual, which appears to be
semi-random.)
--
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
Please send questions to the list rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
More information about the inn-workers
mailing list