From: Joel Rosdahl Date: Sun, 15 Sep 2019 19:32:50 +0000 (+0200) Subject: Only enable more warnings in dev mode when requested X-Git-Tag: v3.7.5~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fc7a18ba061ecbbd464b810d84fe174f80066ef;p=thirdparty%2Fccache.git Only enable more warnings in dev mode when requested 21ded3ae enabled “more warnings” in dev mode unconditionally, but that doesn’t play well in dev builds with a Clang version older than the one used in Travis-CI since the “-Wno-foo” options may be unknown. Instead of doing feature tests for those options, just enable “more warnings” when --enable-more-warnings is specified and specify it for Travis-CI builds. --- diff --git a/.travis.yml b/.travis.yml index 766996912..0e6692401 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,6 +61,6 @@ matrix: script: - ./autogen.sh - - ./configure $HOST + - ./configure --enable-more-warnings $HOST - make - make ${TEST:-test} diff --git a/Makefile.in b/Makefile.in index fba5e10e5..b5a3ea5dd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -126,6 +126,8 @@ install: ccache$(EXEEXT) @disable_man@ccache.1 clean: rm -rf $(files_to_clean) +$(non_3pp_objs) $(test_objs): CFLAGS += @more_warnings@ + src/snprintf.o: CFLAGS += @no_implicit_fallthrough_warning@ $(zlib_objs): CPPFLAGS += -include config.h $(zlib_objs): CFLAGS += @no_implicit_fallthrough_warning@ diff --git a/configure.ac b/configure.ac index 45c47991e..a7d5d6532 100644 --- a/configure.ac +++ b/configure.ac @@ -56,22 +56,20 @@ else CFLAGS="$CFLAGS -O" fi -more_warnings="-Wextra -Wpedantic" -if test "$ac_compiler_clang" = yes; then - more_warnings="$more_warnings -Weverything" - more_warnings="$more_warnings -Wno-conversion" - more_warnings="$more_warnings -Wno-disabled-macro-expansion" - more_warnings="$more_warnings -Wno-format-nonliteral" - more_warnings="$more_warnings -Wno-padded" - more_warnings="$more_warnings -Wno-shorten-64-to-32" - more_warnings="$more_warnings -Wno-sign-conversion" -fi - AC_ARG_ENABLE(more_warnings, [AS_HELP_STRING([--enable-more-warnings], [enable more compiler warnings])]) if test x${enable_more_warnings} = xyes; then - CFLAGS="$CFLAGS $more_warnings" + more_warnings="-Wextra -Wpedantic" + if test "$ac_compiler_clang" = yes; then + more_warnings="$more_warnings -Weverything" + more_warnings="$more_warnings -Wno-conversion" + more_warnings="$more_warnings -Wno-disabled-macro-expansion" + more_warnings="$more_warnings -Wno-format-nonliteral" + more_warnings="$more_warnings -Wno-padded" + more_warnings="$more_warnings -Wno-shorten-64-to-32" + more_warnings="$more_warnings -Wno-sign-conversion" + fi fi AC_HEADER_DIRENT diff --git a/dev.mk.in b/dev.mk.in index da76797c9..481549be6 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -185,8 +185,6 @@ docs: $(generated_docs) $(Q)$(ASCIIDOC) -a revnumber=$(version) -d manpage -b docbook -o - $< | \ perl -pe 's!(.*?)!\1!g' >$@ -$(non_3pp_objs) $(test_objs): CFLAGS += @more_warnings@ - doc/ccache.1: doc/MANUAL.xml $(if $(quiet),@echo " A2X $@") $(Q)$(A2X) --doctype manpage --format manpage $<