]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Only enable more warnings in dev mode when requested
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 15 Sep 2019 19:32:50 +0000 (21:32 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 15 Sep 2019 19:32:50 +0000 (21:32 +0200)
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.

.travis.yml
Makefile.in
configure.ac
dev.mk.in

index 7669969128351dd2a3d5e490fe71c31553246b7d..0e669240164e2cfc73cdc6e30f4fa2c175ae8092 100644 (file)
@@ -61,6 +61,6 @@ matrix:
 
 script:
     - ./autogen.sh
-    - ./configure $HOST
+    - ./configure --enable-more-warnings $HOST
     - make
     - make ${TEST:-test}
index fba5e10e5dfcc4de8815d496194d573f23de07f3..b5a3ea5dd60dc4e2dd12dc0407c4d146a218cfec 100644 (file)
@@ -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@
index 45c47991ec918536b91f22a0453112c1593a26bb..a7d5d6532ab3f97efcf34045e67d939a5e5f0729 100644 (file)
@@ -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
index da76797c9f6945dde61846ce46095e2de6c3d1e5..481549be66a2fd732db89460736a413a0a31ed5e 100644 (file)
--- 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!<literal>(.*?)</literal>!<emphasis role="strong">\1</emphasis>!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 $<