From 5f9d76cd6d7adaa21807c06787a59f75d99fe46a Mon Sep 17 00:00:00 2001 From: JinWang An Date: Tue, 3 Aug 2021 16:27:48 +0900 Subject: [PATCH] Imported Upstream version 3.5.1 --- LICENSE.adoc | 2 +- LICENSE.html | 8 +- Makefile.in | 10 +- configure | 25 ++-- configure.ac | 24 ++-- dev.mk.in | 36 +++--- doc/AUTHORS.adoc | 2 +- doc/AUTHORS.html | 8 +- doc/MANUAL.html | 6 +- doc/NEWS.adoc | 16 +++ doc/NEWS.html | 39 +++++- doc/ccache.1 | 6 +- src/ccache.c | 4 +- src/ccache.h | 2 +- src/conf.c | 307 ++------------------------------------------ src/conf.h | 2 +- src/confitems.c | 284 ++++++++++++++++++++++++++++++++++++++++ src/confitems.gperf | 17 ++- src/confitems.h | 49 +++++++ src/confitems_lookup.c | 128 +++++++++--------- src/envtoconfitems.gperf | 3 + src/envtoconfitems.h | 14 ++ src/envtoconfitems_lookup.c | 94 +++++++------- src/getopt_long.c | 197 ++++++++++++++++++++++++++++ src/hash.c | 4 +- src/stats.c | 4 +- src/unify.c | 1 + src/util.c | 5 +- src/version.c | 2 +- unittest/framework.c | 8 +- unittest/framework.h | 10 +- unittest/test_conf.c | 8 +- 32 files changed, 828 insertions(+), 497 deletions(-) create mode 100644 src/confitems.c create mode 100644 src/confitems.h create mode 100644 src/envtoconfitems.h create mode 100644 src/getopt_long.c diff --git a/LICENSE.adoc b/LICENSE.adoc index c2c1604..007617e 100644 --- a/LICENSE.adoc +++ b/LICENSE.adoc @@ -38,7 +38,7 @@ The copyright for ccache as a whole is as follows: ------------------------------------------------------------------------------- Copyright (C) 2002-2007 Andrew Tridgell - Copyright (C) 2009-2018 Joel Rosdahl + Copyright (C) 2009-2019 Joel Rosdahl ------------------------------------------------------------------------------- diff --git a/LICENSE.html b/LICENSE.html index f31f97f..8a9bf9b 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -735,7 +735,7 @@ asciidoc.install(2); @@ -1206,9 +1206,9 @@ following license:


diff --git a/Makefile.in b/Makefile.in index 175e440..9e90755 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,6 +35,7 @@ non_3pp_sources = \ src/cleanup.c \ src/compopt.c \ src/conf.c \ + src/confitems.c \ src/counters.c \ src/execute.c \ src/exitfn.c \ @@ -51,6 +52,8 @@ generated_sources = \ src/version.c 3pp_sources = \ @getopt_long_c@ \ + src/confitems_lookup.c \ + src/envtoconfitems_lookup.c \ src/hashtable.c \ src/hashtable_itr.c \ src/murmurhashneutral2.c \ @@ -101,7 +104,7 @@ all: ccache$(EXEEXT) ccache$(EXEEXT): $(ccache_objs) $(extra_libs) $(if $(quiet),@echo " LD $@") - $(Q)$(CC) $(all_cflags) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS) + $(Q)$(CC) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS) ccache.1: doc/ccache.1 $(if $(quiet),@echo " CP $@") @@ -120,8 +123,7 @@ install: ccache$(EXEEXT) @disable_man@ccache.1 clean: rm -rf $(files_to_clean) -conf.c: confitems_lookup.c envtoconfitems_lookup.c - +src/snprintf.o: CFLAGS += @no_implicit_fallthrough_warning@ $(zlib_objs): CPPFLAGS += -include config.h $(zlib_objs): CFLAGS += @no_implicit_fallthrough_warning@ @@ -149,7 +151,7 @@ unittest: unittest/run$(EXEEXT) unittest/run$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs) $(if $(quiet),@echo " LD $@") - $(Q)$(CC) $(all_cflags) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS) + $(Q)$(CC) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS) unittest/main.o: unittest/suites.h diff --git a/configure b/configure index 74581d5..a0dcbb4 100755 --- a/configure +++ b/configure @@ -637,12 +637,13 @@ CPPFLAGS LDFLAGS CFLAGS CC -disable_man test_suites +no_implicit_fallthrough_warning +more_warnings include_dev_mk getopt_long_c -no_implicit_fallthrough_warning extra_libs +disable_man host_os host_vendor host_cpu @@ -2365,6 +2366,7 @@ esac + # The later defininition of _XOPEN_SOURCE disables certain features # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). @@ -4059,19 +4061,24 @@ 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 + # Check whether --enable-more_warnings was given. if test "${enable_more_warnings+set}" = set; then : enableval=$enable_more_warnings; fi if test x${enable_more_warnings} = xyes; then - CFLAGS="$CFLAGS -Wextra -Wpedantic" - if test "$ac_compiler_clang" = yes; then - CFLAGS="$CFLAGS -Weverything" - CFLAGS="$CFLAGS -Wno-padded -Wno-disabled-macro-expansion -Wno-format-nonliteral" - CFLAGS="$CFLAGS -Wno-double-promotion -Wno-float-conversion" - CFLAGS="$CFLAGS -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-conversion" - fi + CFLAGS="$CFLAGS $more_warnings" fi diff --git a/configure.ac b/configure.ac index eaa66e5..d354ee1 100644 --- a/configure.ac +++ b/configure.ac @@ -16,12 +16,13 @@ case $host in ;; esac +AC_SUBST(disable_man) AC_SUBST(extra_libs) -AC_SUBST(no_implicit_fallthrough_warning) AC_SUBST(getopt_long_c) AC_SUBST(include_dev_mk) +AC_SUBST(more_warnings) +AC_SUBST(no_implicit_fallthrough_warning) AC_SUBST(test_suites) -AC_SUBST(disable_man) m4_include(m4/feature_macros.m4) m4_include(m4/clang.m4) @@ -52,17 +53,22 @@ 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 -Wextra -Wpedantic" - if test "$ac_compiler_clang" = yes; then - CFLAGS="$CFLAGS -Weverything" - CFLAGS="$CFLAGS -Wno-padded -Wno-disabled-macro-expansion -Wno-format-nonliteral" - CFLAGS="$CFLAGS -Wno-double-promotion -Wno-float-conversion" - CFLAGS="$CFLAGS -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-conversion" - fi + CFLAGS="$CFLAGS $more_warnings" fi AC_HEADER_DIRENT diff --git a/dev.mk.in b/dev.mk.in index 914786e..a1ee969 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -1,6 +1,6 @@ # GNU make syntax reigns in this file. -all_cflags += -Werror +all_cflags += -Werror @more_warnings@ all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d A2X = a2x @@ -38,7 +38,9 @@ headers = \ src/ccache.h \ src/compopt.h \ src/conf.h \ + src/confitems.h \ src/counters.h \ + src/envtoconfitems.h \ src/getopt_long.h \ src/hash.h \ src/hashtable.h \ @@ -87,6 +89,7 @@ source_dist_files = \ src/confitems_lookup.c \ src/envtoconfitems.gperf \ src/envtoconfitems_lookup.c \ + src/getopt_long.c \ src/main.c \ src/zlib/*.c \ src/zlib/*.h \ @@ -110,8 +113,8 @@ src/version.o: src/version.c %_lookup.c: %.gperf $(if $(quiet),@echo " GPERF $@") - $(Q)$(GPERF) $< | awk '/#ifdef __GNUC__/ { ++i; if (i == 2) { print "static"; }} {print}' >$@ - $(Q)echo "static const size_t $$(echo $(notdir $*) | tr a-z A-Z)_TOTAL_KEYWORDS = $$(sed -nr 's/.*TOTAL_KEYWORDS = ([0-9]+).*/\1/p' $@);" >>$@ + $(Q)$(GPERF) $< >$@ + $(Q)echo "size_t $$(echo '$(notdir $*)_count(void)') { return $$(sed -nr 's/.*TOTAL_KEYWORDS = (.+),.*/\1/p' $@); }" >>$@ .PHONY: dist dist: $(dist_archives) @@ -136,8 +139,8 @@ $(dist_archives): $(dist_files) tar -c $$tarcompression -f $(CURDIR)/$@ $(dist_dir)) && \ rm -rf $$tmpdir -.PHONY: distcheck -distcheck: $(firstword $(dist_archives)) +# $(1): extra configure options +define do_distcheck tmpdir=$$(mktemp -d /tmp/tmp-ccache-distcheck.XXXXXX) && \ (cd $$tmpdir && \ tar xf $(CURDIR)/$< && \ @@ -145,24 +148,18 @@ distcheck: $(firstword $(dist_archives)) chmod -R a-w $(dist_dir) && \ chmod u+w $(dist_dir)/build && \ cd $(dist_dir)/build && \ - ../configure --prefix=$$tmpdir/root && \ - $(MAKE) install && \ + ../configure --enable-more-warnings --prefix=$$tmpdir/root $(1) && \ + $(MAKE) install CFLAGS=-Werror V=1 && \ $(MAKE) installcheck) && \ chmod -R u+w $$tmpdir/$(dist_dir) && \ rm -rf $$tmpdir +endef - tmpdir=$$(mktemp -d /tmp/tmp-ccache-distcheck.XXXXXX) && \ - (cd $$tmpdir && \ - tar xf $(CURDIR)/$< && \ - mkdir -p $(dist_dir)/build && \ - chmod -R a-w $(dist_dir) && \ - chmod u+w $(dist_dir)/build && \ - cd $(dist_dir)/build && \ - ../configure --prefix=$$tmpdir/root --with-bundled-zlib && \ - $(MAKE) install && \ - $(MAKE) installcheck) && \ - chmod -R u+w $$tmpdir/$(dist_dir) && \ - rm -rf $$tmpdir +.PHONY: distcheck +distcheck: $(firstword $(dist_archives)) + $(call do_distcheck, --without-bundled-zlib) + $(call do_distcheck, --with-bundled-zlib) + $(call do_distcheck, CC=clang) .PHONY: docs docs: $(generated_docs) @@ -197,6 +194,7 @@ check-syntax: cppcheck: $(CPPCHECK) --suppressions-list=$(CPPCHECK_SUPPRESSIONS) \ --inline-suppr -q --enable=all --force -I . \ + --template='cppcheck: warning: {id}:{file}:{line}: {message}' \ $(non_3pp_sources) src/main.c $(test_sources) .PHONY: shellcheck diff --git a/doc/AUTHORS.adoc b/doc/AUTHORS.adoc index b423be3..62de02f 100644 --- a/doc/AUTHORS.adoc +++ b/doc/AUTHORS.adoc @@ -88,7 +88,7 @@ ccache is a collective work with contributions from many people, including: * Ville Skyttä * William S Fulton * Wilson Snyder -* Xavier RENE-CORAIL +* Xavier René-Corail * Yiding Jia Thanks! diff --git a/doc/AUTHORS.html b/doc/AUTHORS.html index 3d5ff7e..169a501 100644 --- a/doc/AUTHORS.html +++ b/doc/AUTHORS.html @@ -735,7 +735,7 @@ asciidoc.install(2);