diff options
author | Dan Williams <dcbw@redhat.com> | 2019-04-02 09:16:12 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2019-04-02 10:48:40 -0500 |
commit | 88fac7f14a8898a7856a6868bbd94d4cf576723a (patch) | |
tree | 700753959d987c211d00cbf675af51d1eaadcceb /m4/compiler_warnings.m4 | |
parent | 093174c84da265059eda2591cf79593abb567f3a (diff) |
build: fix -Wunused-but-set-variable support and handle clang better
By default the build used -Wno-unused-but-set-variable but that's
clearly not what we want. Fix those problems.
When using clang, the compiler doesn't error on unknown compile
options, so let's add -Werror to the checking too.
CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes
Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Diffstat (limited to 'm4/compiler_warnings.m4')
-rw-r--r-- | m4/compiler_warnings.m4 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/m4/compiler_warnings.m4 b/m4/compiler_warnings.m4 index f498a282..2a682684 100644 --- a/m4/compiler_warnings.m4 +++ b/m4/compiler_warnings.m4 @@ -11,9 +11,9 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then -Wdeclaration-after-statement -Wstrict-prototypes \ -Wno-unused-parameter -Wno-sign-compare \ -Wno-deprecated-declarations \ - -Wno-unused-but-set-variable -Wformat-security; do + -Wunused-but-set-variable -Wformat-security; do SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $option" + CFLAGS="$CFLAGS $option -Werror" AC_MSG_CHECKING([whether gcc understands $option]) AC_TRY_COMPILE([], [], has_option=yes, |