"David A. Wheeler" <[email protected]> writes:

> The gcc & clang groups coordinate with each other; they try to provide
> the same flags & API for the same functionality, and occasionally copy
> from each other.

This is not my experience.  In particular, the warning flags for Clang are
significantly different than the warning flags for GCC, giving rise to
logic like this to configure warnings used for maintainer builds:

 AS_IF([test x"$CLANG" = xyes],
    [WARNINGS_CFLAGS="-Werror"
     m4_foreach_w([flag],
        [-Weverything -Wno-cast-qual -Wno-disabled-macro-expansion -Wno-padded
         -Wno-sign-conversion -Wno-reserved-id-macro
         -Wno-tautological-pointer-compare -Wno-undef -Wno-unreachable-code
         -Wno-unreachable-code-return -Wno-unused-macros
         -Wno-used-but-marked-unused],
        [RRA_PROG_CC_FLAG(flag,
            [WARNINGS_CFLAGS="${WARNINGS_CFLAGS} flag"])])],
    [WARNINGS_CFLAGS="-g -O2 -D_FORTIFY_SOURCE=2 -Werror"
     m4_foreach_w([flag],
        [-fstrict-overflow -fstrict-aliasing -Wall -Wextra -Wformat=2
         -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation=2
         -Wnull-dereference -Winit-self -Wswitch-enum -Wstrict-overflow=5
         -Wmissing-format-attribute -Walloc-zero -Wduplicated-branches
         -Wduplicated-cond -Wtrampolines -Wfloat-equal
         -Wdeclaration-after-statement -Wshadow -Wpointer-arith
         -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion
         -Wno-sign-conversion -Wdate-time -Wjump-misses-init -Wlogical-op
         -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
         -Wmissing-declarations -Wnormalized=nfc -Wpacked -Wredundant-decls
         -Wrestrict -Wnested-externs -Winline -Wvla],
        [RRA_PROG_CC_FLAG(flag,
            [WARNINGS_CFLAGS="${WARNINGS_CFLAGS} flag"])])])

-- 
Russ Allbery ([email protected])             <https://www.eyrie.org/~eagle/>

Reply via email to