diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2023-01-12 04:17:24 +0200 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-02-03 21:10:19 +0800 |
commit | b16b9c0d22227012518595c2222facc73bd833a8 (patch) | |
tree | c42c6d069b7f149d8b502fb6df68c4b07f7c3b6e /configure.ac | |
parent | Tests: Fix warnings from clang --Wassign-enum. (diff) | |
download | xz-b16b9c0d22227012518595c2222facc73bd833a8.tar.xz |
Build: Make configure add more warning flags for GCC and Clang.
-Wstrict-aliasing was removed from the list since it is enabled
by -Wall already.
A normal build is clean with these on GNU/Linux x86-64 with
GCC 12.2.0 and Clang 14.0.6.
Diffstat (limited to '')
-rw-r--r-- | configure.ac | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 07cff50b..670d3bf7 100644 --- a/configure.ac +++ b/configure.ac @@ -1029,26 +1029,35 @@ if test "$GCC" = yes ; then # backed up with "return LZMA_PROG_ERROR". # * -Wcast-qual would break various things where we need a non-const # pointer although we don't modify anything through it. - # * -Wcast-align breaks optimized CRC32 and CRC64 implementation - # on some architectures (not on x86), where this warning is bogus, - # because we take care of correct alignment. # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations # don't seem so useful here; at least the last one gives some # warnings which are not bugs. + # * -Wconversion still shows too many warnings. + # + # The flags before the empty line are for GCC and many of them + # are supported by Clang too. The flags after the empty line are + # for Clang. for NEW_FLAG in \ -Wall \ -Wextra \ -Wvla \ + -Wc99-c11-compat \ -Wformat=2 \ -Winit-self \ -Wmissing-include-dirs \ - -Wstrict-aliasing \ + -Wshift-overflow=2 \ + -Wstrict-overflow=3 \ + -Walloc-zero \ + -Wduplicated-cond \ -Wfloat-equal \ -Wundef \ -Wshadow \ -Wpointer-arith \ -Wbad-function-cast \ -Wwrite-strings \ + -Wdate-time \ + -Wsign-conversion \ + -Wfloat-conversion \ -Wlogical-op \ -Waggregate-return \ -Wstrict-prototypes \ @@ -1056,7 +1065,24 @@ if test "$GCC" = yes ; then -Wmissing-prototypes \ -Wmissing-declarations \ -Wmissing-noreturn \ - -Wredundant-decls + -Wredundant-decls \ + \ + -Wc99-compat \ + -Wc11-extensions \ + -Wc2x-compat \ + -Wc2x-extensions \ + -Wpre-c2x-compat \ + -Warray-bounds-pointer-arithmetic \ + -Wassign-enum \ + -Wconditional-uninitialized \ + -Wdocumentation \ + -Wduplicate-enum \ + -Wempty-translation-unit \ + -Wflexible-array-extensions \ + -Wmissing-variable-declarations \ + -Wnewline-eof \ + -Wshift-sign-overflow \ + -Wstring-conversion do AC_MSG_CHECKING([if $CC accepts $NEW_FLAG]) OLD_CFLAGS="$CFLAGS" |