From 331d2e0334fcc294fbd6ecccdc7fbd0479909eec Mon Sep 17 00:00:00 2001 From: "peterbudai@hotmail.com" Date: Wed, 28 Mar 2018 22:20:12 +0200 Subject: win32: Fix CCACHE_COMPILERCHECK=mtime test case Previously if compiler command was an .sh script, win32 version automatically added an .EXE extension to the command line and then test case failed. With this change .sh files won't get appended by an EXE extension and test case successfully runs --- src/execute.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/execute.c b/src/execute.c index df8fe5b6..ae305520 100644 --- a/src/execute.c +++ b/src/execute.c @@ -115,6 +115,7 @@ win32getshell(char *path) void add_exe_ext_if_no_to_fullpath(char *full_path_win_ext, size_t max_size, const char *ext, const char *path) { if (!ext || (!str_eq(".exe", ext) + && !str_eq(".sh", ext) && !str_eq(".bat", ext) && !str_eq(".EXE", ext) && !str_eq(".BAT", ext))) { -- cgit v1.2.1 From 9a71ae4d8a20b44c0588d1b5d83109653930f28e Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 23 Apr 2018 21:44:56 +0200 Subject: Remove irrelevant variable assignment in wipe_dir --- src/cleanup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cleanup.c b/src/cleanup.c index 8c46eac5..c6273ecd 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -236,11 +236,10 @@ static void wipe_fn(const char *fname, struct stat *st) // Wipe one cache subdirectory. void -wipe_dir(struct conf *conf, const char *dir) +wipe_dir(const char *dir) { cc_log("Clearing out cache directory %s", dir); - files_in_cache_threshold = conf->max_files * conf->limit_multiple / 16; files_in_cache = 0; traverse(dir, wipe_fn); @@ -258,7 +257,7 @@ void wipe_all(struct conf *conf) { for (int i = 0; i <= 0xF; i++) { char *dname = format("%s/%1x", conf->cache_dir, i); - wipe_dir(conf, dname); + wipe_dir(dname); free(dname); } -- cgit v1.2.1 From cf517591008206020d39e13ec45667ddf6bdae92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Fri, 30 Mar 2018 21:23:04 +0200 Subject: Fix log printing of before/after cleanup Seems like MinGW doesn't have the %z (size_t) printf format So add some %f casting variant, so that it works everywhere. --- src/cleanup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cleanup.c b/src/cleanup.c index c6273ecd..1fc78e27 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -173,13 +173,13 @@ clean_up_dir(struct conf *conf, const char *dir, float limit_multiple) traverse(dir, traverse_fn); // Clean the cache. - cc_log("Before cleanup: %lu KiB, %zu files", + cc_log("Before cleanup: %lu KiB, %.0f files", (unsigned long)cache_size / 1024, - files_in_cache); + (float)files_in_cache); bool cleaned = sort_and_clean(); - cc_log("After cleanup: %lu KiB, %zu files", + cc_log("After cleanup: %lu KiB, %.0f files", (unsigned long)cache_size / 1024, - files_in_cache); + (float)files_in_cache); if (cleaned) { cc_log("Cleaned up cache directory %s", dir); -- cgit v1.2.1 From 564aafed9dec81c9bc3b4430fc0097b5def67abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 1 Apr 2018 09:39:15 +0200 Subject: Improve the Travis build matrix Run in containers where possible, save the installations for the targets that actually need to do them (currently: mingw and cuda) --- .travis.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index a4793bb8..7cb987ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,11 @@ language: c -sudo: required - addons: apt: packages: - gperf - elfutils - zlib1g-dev - - mingw32 - - mingw32-binutils - - clang # scan-build os: - linux @@ -22,9 +17,13 @@ compiler: matrix: include: -# - os: linux -# compiler: i586-mingw32msvc-gcc -# env: HOST="--host=i586-mingw32msvc" TEST="test/main.exe" + - os: linux + compiler: i686-w64-mingw32-gcc + env: HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe" + addons: + apt: + packages: + - gcc-mingw-w64-i686 - os: linux compiler: clang env: CFLAGS="-fsanitize=undefined" ASAN_OPTIONS="detect_leaks=0" @@ -34,17 +33,21 @@ matrix: - os: linux compiler: clang env: PATH="/usr/bin:$PATH" TEST=analyze + addons: + apt: + packages: + - clang # scan-build - os: linux compiler: gcc env: CUDA=8.0.61-1 + sudo: required + before_install: + - source ./.travis/install_cuda.sh exclude: - os: osx compiler: gcc -before_install: - - source ./.travis/install_cuda.sh - script: - ./autogen.sh - ./configure $HOST -- cgit v1.2.1 From a21a136cce57095b18d6d827615d3761e0b57fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 1 Apr 2018 13:13:33 +0200 Subject: Look for -fdebug-prefix-map feature explicitly Seems like old clang-3.4 didn't have this feature, while the newer MinGW might. So remove the hardcoding, and do the check. --- test/suites/debug_prefix_map.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/suites/debug_prefix_map.bash b/test/suites/debug_prefix_map.bash index 256d4cbc..25cc36ff 100644 --- a/test/suites/debug_prefix_map.bash +++ b/test/suites/debug_prefix_map.bash @@ -1,5 +1,6 @@ SUITE_debug_prefix_map_PROBE() { - if $COMPILER_USES_MINGW; then + touch test.c + if ! $REAL_COMPILER -c -fdebug-prefix-map=old=new test.c 2>/dev/null; then echo "-fdebug-prefix-map not supported by compiler" fi } -- cgit v1.2.1 From a00e1cf4fb247f6832982be99cd37823ff83991f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 1 Apr 2018 13:53:02 +0200 Subject: Add a travis-build container, for running locally This is not the actual Travis docker container, but it should be similar enough for doing local verification: make travis make travis CC=clang make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0" make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe" --- .travis/Dockerfile | 26 ++++++++++++++++++++++++++ dev.mk.in | 7 +++++++ 2 files changed, 33 insertions(+) create mode 100644 .travis/Dockerfile diff --git a/.travis/Dockerfile b/.travis/Dockerfile new file mode 100644 index 00000000..f9cbd034 --- /dev/null +++ b/.travis/Dockerfile @@ -0,0 +1,26 @@ +# NOTE: This is not the real Docker image used for the Travis builds. +# See: https://docs.travis-ci.com/user/common-build-problems/ + +FROM ubuntu:trusty + +# https://github.com/Yelp/dumb-init +ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64.deb . +RUN dpkg -i dumb-init_*.deb +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + +# generic tools +RUN apt-get -qq update && apt-get install -y --no-install-recommends \ + libc6-dev \ + gcc \ + clang \ + gcc-mingw-w64 \ + make \ + autoconf \ + && rm -rf /var/lib/apt/lists/* + +# ccache specific +RUN apt-get -qq update && apt-get install -y --no-install-recommends \ + gperf \ + elfutils \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* diff --git a/dev.mk.in b/dev.mk.in index 91b0a578..957f846d 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -10,6 +10,7 @@ CPPCHECK_SUPPRESSIONS = misc/cppcheck-suppressions.txt SCAN_BUILD = scan-build DOCKER = docker GPERF = gperf +TEST = test version := \ $(shell (git --git-dir=$(srcdir)/.git describe --dirty || git --git-dir=$(srcdir)/.git describe || echo vunknown) \ @@ -203,4 +204,10 @@ analyze: docker: misc/Dockerfile $(DOCKER) build -f $< $(srcdir) +.PHONY: travis +travis: .travis/Dockerfile + $(DOCKER) inspect travis-build >/dev/null || $(DOCKER) build -t travis-build .travis + $(DOCKER) run --rm --volume $(PWD):/src --tmpfs /dst:rw,exec travis-build \ + sh -c "cd /src && ./autogen.sh && cd /dst && CC=$(CC) CFLAGS='$(CFLAGS)' ASAN_OPTIONS='$(ASAN_OPTIONS)' /src/configure $(HOST) && make $(TEST)" + -include .deps/*.d -- cgit v1.2.1 From 8bd2e892a6f443cbf6f002809db09ce586cbb751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 1 Apr 2018 14:39:44 +0200 Subject: Make sure to call configure with right path --- dev.mk.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev.mk.in b/dev.mk.in index 957f846d..1f724f62 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -197,7 +197,7 @@ uncrustify: .PHONY: analyze analyze: - $(SCAN_BUILD) --use-cc=$(CC) ./configure + $(SCAN_BUILD) --use-cc=$(CC) $(srcdir)/configure $(SCAN_BUILD) --use-cc=$(CC) --status-bugs $(MAKE) -B .PHONY: docker -- cgit v1.2.1 From 04339312647d9767f86cbeb14f2d0f2ecc8d221b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 1 Apr 2018 14:40:05 +0200 Subject: Add small helper to run all Travis tests The idea behind this script is to run the same checks as .travis.yml but locally instead. It is not identical, but should be close enough. Note: this does not include any tests for the osx or cuda platforms, only the linux targets - although that does include the mingw build. --- .travis.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 .travis.sh diff --git a/.travis.sh b/.travis.sh new file mode 100755 index 00000000..ee57433a --- /dev/null +++ b/.travis.sh @@ -0,0 +1,8 @@ +#!/bin/sh -ex + +make travis CC=clang +make travis CC=gcc +make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe" +make travis CC=clang CFLAGS="-fsanitize=undefined" ASAN_OPTIONS="detect_leaks=0" +make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0" +make travis CC=clang TEST=analyze -- cgit v1.2.1 From f9ae0b6f1cd1093619fc232c3a396e2efd11f7b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sat, 7 Apr 2018 14:50:33 +0200 Subject: Make sure to export ASAN_OPTIONS properly --- dev.mk.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev.mk.in b/dev.mk.in index 1f724f62..fd599b82 100644 --- a/dev.mk.in +++ b/dev.mk.in @@ -207,7 +207,7 @@ docker: misc/Dockerfile .PHONY: travis travis: .travis/Dockerfile $(DOCKER) inspect travis-build >/dev/null || $(DOCKER) build -t travis-build .travis - $(DOCKER) run --rm --volume $(PWD):/src --tmpfs /dst:rw,exec travis-build \ - sh -c "cd /src && ./autogen.sh && cd /dst && CC=$(CC) CFLAGS='$(CFLAGS)' ASAN_OPTIONS='$(ASAN_OPTIONS)' /src/configure $(HOST) && make $(TEST)" + $(DOCKER) run --rm --volume $(PWD):/src --tmpfs /dst:rw,exec --env ASAN_OPTIONS='$(ASAN_OPTIONS)' travis-build \ + sh -c "cd /src && ./autogen.sh && cd /dst && CC=$(CC) CFLAGS='$(CFLAGS)' /src/configure $(HOST) && make && make $(TEST)" -include .deps/*.d -- cgit v1.2.1 From cd3d88d08055157135c41b9b491c862aa0007849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sat, 7 Apr 2018 14:29:52 +0200 Subject: Upgrade clang to 5.0, for the Travis docker --- .travis.sh | 4 ++-- .travis/Dockerfile | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.sh b/.travis.sh index ee57433a..63bec03e 100755 --- a/.travis.sh +++ b/.travis.sh @@ -1,8 +1,8 @@ #!/bin/sh -ex - +make clean make travis CC=clang make travis CC=gcc make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe" make travis CC=clang CFLAGS="-fsanitize=undefined" ASAN_OPTIONS="detect_leaks=0" make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0" -make travis CC=clang TEST=analyze +make travis CC=/usr/bin/clang TEST=analyze diff --git a/.travis/Dockerfile b/.travis/Dockerfile index f9cbd034..37ec5888 100644 --- a/.travis/Dockerfile +++ b/.travis/Dockerfile @@ -18,6 +18,14 @@ RUN apt-get -qq update && apt-get install -y --no-install-recommends \ autoconf \ && rm -rf /var/lib/apt/lists/* +# Travis has upgraded clang, from clang-3.4 to clang-5.0 +# https://github.com/travis-ci/travis-cookbooks/pull/890 +RUN printf "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main\ndeb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main\n# Also add the following for the appropriate libstdc++\ndeb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main\n" > /etc/apt/sources.list.d/llvm-toolchain.list && apt-key adv --fetch-keys http://apt.llvm.org/llvm-snapshot.gpg.key && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F +RUN apt-get -qq update && apt-get install -y --no-install-recommends \ + clang-5.0 \ + && rm -rf /var/lib/apt/lists/* \ + && ln -s /usr/bin/clang-5.0 /usr/local/bin/clang + # ccache specific RUN apt-get -qq update && apt-get install -y --no-install-recommends \ gperf \ -- cgit v1.2.1 From 390035abfa4e174ac0b1528435e2d001d39654a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 8 Apr 2018 15:28:58 +0200 Subject: Convert float config to double, add rounding We were getting different results when converting "float" to integers, on 32-bit versus 64-bit platforms. So use "roundf". Also exposed a typo in another testsuite, where we only cleaned files as a result of roundoff... Make cleaning explicit again. --- src/cleanup.c | 7 +++++-- test/suites/cleanup.bash | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cleanup.c b/src/cleanup.c index 1fc78e27..dbb65784 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -17,6 +17,9 @@ #include "ccache.h" +#include +#include + static struct files { char *fname; time_t mtime; @@ -162,8 +165,8 @@ clean_up_dir(struct conf *conf, const char *dir, float limit_multiple) // When "max files" or "max cache size" is reached, one of the 16 cache // subdirectories is cleaned up. When doing so, files are deleted (in LRU // order) until the levels are below limit_multiple. - cache_size_threshold = conf->max_size * limit_multiple / 16; - files_in_cache_threshold = conf->max_files * limit_multiple / 16; + cache_size_threshold = roundf(conf->max_size * limit_multiple / 16); + files_in_cache_threshold = roundf(conf->max_files * limit_multiple / 16); num_files = 0; cache_size = 0; diff --git a/test/suites/cleanup.bash b/test/suites/cleanup.bash index 8eaac4f6..45dccb08 100644 --- a/test/suites/cleanup.bash +++ b/test/suites/cleanup.bash @@ -152,7 +152,7 @@ SUITE_cleanup() { TEST ".o file is removed before .stderr" prepare_cleanup_test_dir $CCACHE_DIR/a - $CCACHE -F 474 -M 0 >/dev/null + $CCACHE -F 464 -M 0 >/dev/null backdate 0 $CCACHE_DIR/a/result9-4017.stderr $CCACHE -c >/dev/null expect_file_missing $CCACHE_DIR/a/result9-4017.stderr @@ -167,7 +167,7 @@ SUITE_cleanup() { TEST ".stderr file is not removed before .o" prepare_cleanup_test_dir $CCACHE_DIR/a - $CCACHE -F 474 -M 0 >/dev/null + $CCACHE -F 464 -M 0 >/dev/null backdate 0 $CCACHE_DIR/a/result9-4017.o $CCACHE -c >/dev/null expect_file_exists $CCACHE_DIR/a/result9-4017.stderr -- cgit v1.2.1 From 047d387da9d4dfe8a4e5af6b47859e7e8c15be6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 8 Apr 2018 13:51:06 +0200 Subject: Add a 32-bit build target, using multilib (-m32) Use gcc-multilib rather than doing a full cross-compile. But set the --host, just in case something is listening. --- .travis.sh | 3 ++- .travis.yml | 10 +++++++++- .travis/Dockerfile | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis.sh b/.travis.sh index 63bec03e..ad646783 100755 --- a/.travis.sh +++ b/.travis.sh @@ -1,7 +1,8 @@ #!/bin/sh -ex make clean -make travis CC=clang make travis CC=gcc +make travis CC=clang +make travis CC=gcc CFLAGS="-m32 -g -O2" HOST="--host=i386-linux-gnu" make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe" make travis CC=clang CFLAGS="-fsanitize=undefined" ASAN_OPTIONS="detect_leaks=0" make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0" diff --git a/.travis.yml b/.travis.yml index 7cb987ce..31438d6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,17 +6,25 @@ addons: - gperf - elfutils - zlib1g-dev + - lib32z1-dev os: - linux - osx compiler: - - clang - gcc + - clang matrix: include: + - os: linux + compiler: gcc + env: CFLAGS="-m32 -g -O2" HOST="--host=i386-linux-gnu" + addons: + apt: + packages: + - gcc-multilib - os: linux compiler: i686-w64-mingw32-gcc env: HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe" diff --git a/.travis/Dockerfile b/.travis/Dockerfile index 37ec5888..5f837b0e 100644 --- a/.travis/Dockerfile +++ b/.travis/Dockerfile @@ -13,6 +13,8 @@ RUN apt-get -qq update && apt-get install -y --no-install-recommends \ libc6-dev \ gcc \ clang \ + libc6-dev-i386 \ + gcc-multilib \ gcc-mingw-w64 \ make \ autoconf \ @@ -31,4 +33,5 @@ RUN apt-get -qq update && apt-get install -y --no-install-recommends \ gperf \ elfutils \ zlib1g-dev \ + lib32z1-dev \ && rm -rf /var/lib/apt/lists/* -- cgit v1.2.1 From 359a4078a8adad86bf028cd4d48210379eea0f7b Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 23 Apr 2018 21:56:32 +0200 Subject: Use double when calculating cache thresholds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We could at least in theory have large enough caches that float’s precision won’t be enough. Also removed include of which I think is superfluous. --- src/ccache.h | 2 +- src/cleanup.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/ccache.h b/src/ccache.h index a4fd28ab..973d42dd 100644 --- a/src/ccache.h +++ b/src/ccache.h @@ -233,7 +233,7 @@ void exitfn_call(void); // ---------------------------------------------------------------------------- // cleanup.c -void clean_up_dir(struct conf *conf, const char *dir, float limit_multiple); +void clean_up_dir(struct conf *conf, const char *dir, double limit_multiple); void clean_up_all(struct conf *conf); void wipe_all(struct conf *conf); diff --git a/src/cleanup.c b/src/cleanup.c index dbb65784..969b8d2b 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -17,7 +17,6 @@ #include "ccache.h" -#include #include static struct files { @@ -158,15 +157,15 @@ sort_and_clean(void) // Clean up one cache subdirectory. void -clean_up_dir(struct conf *conf, const char *dir, float limit_multiple) +clean_up_dir(struct conf *conf, const char *dir, double limit_multiple) { cc_log("Cleaning up cache directory %s", dir); // When "max files" or "max cache size" is reached, one of the 16 cache // subdirectories is cleaned up. When doing so, files are deleted (in LRU // order) until the levels are below limit_multiple. - cache_size_threshold = roundf(conf->max_size * limit_multiple / 16); - files_in_cache_threshold = roundf(conf->max_files * limit_multiple / 16); + cache_size_threshold = round(conf->max_size * limit_multiple / 16); + files_in_cache_threshold = round(conf->max_files * limit_multiple / 16); num_files = 0; cache_size = 0; @@ -176,13 +175,13 @@ clean_up_dir(struct conf *conf, const char *dir, float limit_multiple) traverse(dir, traverse_fn); // Clean the cache. - cc_log("Before cleanup: %lu KiB, %.0f files", - (unsigned long)cache_size / 1024, - (float)files_in_cache); + cc_log("Before cleanup: %.0f KiB, %.0f files", + (double)cache_size / 1024, + (double)files_in_cache); bool cleaned = sort_and_clean(); - cc_log("After cleanup: %lu KiB, %.0f files", - (unsigned long)cache_size / 1024, - (float)files_in_cache); + cc_log("After cleanup: %.0f KiB, %.0f files", + (double)cache_size / 1024, + (double)files_in_cache); if (cleaned) { cc_log("Cleaned up cache directory %s", dir); -- cgit v1.2.1 From 7ea35e06fd54736fd9307ff2d419c54e0f4a525f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Mon, 9 Apr 2018 20:35:25 +0200 Subject: Print the time when stats last updated --- src/stats.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/stats.c b/src/stats.c index 5ac56fdc..6c81d2dc 100644 --- a/src/stats.c +++ b/src/stats.c @@ -445,6 +445,8 @@ stats_summary(struct conf *conf) { struct counters *counters = counters_init(STATS_END); time_t oldest = 0; + time_t updated = 0; + struct stat st; assert(conf); @@ -464,6 +466,11 @@ stats_summary(struct conf *conf) if (current != 0 && (oldest == 0 || current < oldest)) { oldest = current; } + if (stat(fname, &st) == 0) { + if (st.st_mtime > updated) { + updated = st.st_mtime; + } + } free(fname); } @@ -478,6 +485,12 @@ stats_summary(struct conf *conf) strftime(timestamp, sizeof(timestamp), "%c", tm); printf("stats zero time %s\n", timestamp); } + if (updated) { + struct tm *tm = localtime(&updated); + char timestamp[100]; + strftime(timestamp, sizeof(timestamp), "%c", tm); + printf("stats updated %s\n", timestamp); + } // ...and display them. for (int i = 0; stats_info[i].message; i++) { -- cgit v1.2.1 From b8a2492964563a014f1fe3e29e1e236061c8a79f Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 17 Apr 2018 21:53:32 +0200 Subject: Simplify logic --- src/stats.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/stats.c b/src/stats.c index 6c81d2dc..deca55ff 100644 --- a/src/stats.c +++ b/src/stats.c @@ -466,10 +466,8 @@ stats_summary(struct conf *conf) if (current != 0 && (oldest == 0 || current < oldest)) { oldest = current; } - if (stat(fname, &st) == 0) { - if (st.st_mtime > updated) { - updated = st.st_mtime; - } + if (stat(fname, &st) == 0 && st.st_mtime > updated) { + updated = st.st_mtime; } free(fname); } -- cgit v1.2.1 From 5779e97652ec8b87a0629b7127ad5cc398a35ba3 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 17 Apr 2018 21:57:01 +0200 Subject: Update NEWS --- doc/NEWS.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/NEWS.adoc b/doc/NEWS.adoc index a504d27a..78db8966 100644 --- a/doc/NEWS.adoc +++ b/doc/NEWS.adoc @@ -16,6 +16,9 @@ New features and enhancements precompiled headers. Note that the build system needs to keep the checksum file in sync with the precompiled header for this to work. +- Added ``stats updated'' timestamp in `ccache -s` output. This can be useful + if you wonder whether ccache actually was used for your last build. + ccache 3.4.2 ------------ -- cgit v1.2.1 From b94a70af6771bb2f263e34fb9c7a977429d961f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 22 Apr 2018 11:49:32 +0200 Subject: Add the sanitize blacklist contents to the hash --- src/ccache.c | 19 ++++++++++++ test/run | 1 + test/suites/sanitize_blacklist.bash | 58 +++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 test/suites/sanitize_blacklist.bash diff --git a/src/ccache.c b/src/ccache.c index bef33698..c5497dea 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -225,6 +225,9 @@ static char *profile_dir = NULL; static bool profile_use = false; static bool profile_generate = false; +// Sanitize blacklist +static char *sanitize_blacklist = NULL; + // Whether we are using a precompiled header (either via -include, #include or // clang's -include-pch or -include-pth). static bool using_precompiled_header = false; @@ -1655,6 +1658,16 @@ calculate_common_hash(struct args *args, struct mdfour *hash) } } + // Possibly hash the sanitize blacklist file path. + if (sanitize_blacklist) { + cc_log("Hashing sanitize blacklist %s", sanitize_blacklist); + hash_delimiter(hash, "sanitizeblacklist"); + if (!hash_file(hash, sanitize_blacklist)) { + stats_update(STATS_BADEXTRAFILE); + failed(); + } + } + if (!str_eq(conf->extra_files_to_hash, "")) { char *p = x_strdup(conf->extra_files_to_hash); char *q = p; @@ -2502,6 +2515,11 @@ cc_process_args(struct args *args, struct args **preprocessor_args, args_add(stripped_args, argv[i]); continue; } + if (str_startswith(argv[i], "-fsanitize-blacklist=")) { + sanitize_blacklist = x_strdup(argv[i] + 21); + args_add(stripped_args, argv[i]); + continue; + } if (str_startswith(argv[i], "--sysroot=")) { char *relpath = make_relative_path(x_strdup(argv[i] + 10)); char *option = format("--sysroot=%s", relpath); @@ -3207,6 +3225,7 @@ cc_reset(void) free(debug_prefix_maps); debug_prefix_maps = NULL; debug_prefix_maps_len = 0; free(profile_dir); profile_dir = NULL; + free(sanitize_blacklist); sanitize_blacklist = NULL; free(included_pch_file); included_pch_file = NULL; args_free(orig_args); orig_args = NULL; free(input_file); input_file = NULL; diff --git a/test/run b/test/run index 82a80541..0bbb21c4 100755 --- a/test/run +++ b/test/run @@ -364,6 +364,7 @@ nocpp2 cpp1 multi_arch serialize_diagnostics +sanitize_blacklist debug_prefix_map masquerading hardlink diff --git a/test/suites/sanitize_blacklist.bash b/test/suites/sanitize_blacklist.bash new file mode 100644 index 00000000..a2411e9b --- /dev/null +++ b/test/suites/sanitize_blacklist.bash @@ -0,0 +1,58 @@ +SUITE_sanitize_blacklist_PROBE() { + touch test.c blacklist.txt + if ! $REAL_COMPILER -c -fsanitize-blacklist=blacklist.txt \ + test.c 2>/dev/null; then + echo "-fsanitize-blacklist not supported by compiler" + fi +} + +SUITE_sanitize_blacklist_SETUP() { + generate_code 1 test1.c + echo "fun:foo" >blacklist.txt + + unset CCACHE_NODIRECT +} + +SUITE_sanitize_blacklist() { + # ------------------------------------------------------------------------- + TEST "Compile OK" + + $REAL_COMPILER -c -fsanitize-blacklist=blacklist.txt test1.c + + $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c + expect_stat 'cache hit (direct)' 0 + expect_stat 'cache miss' 1 + expect_stat 'files in cache' 2 + + $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c + expect_stat 'cache hit (direct)' 1 + expect_stat 'cache miss' 1 + expect_stat 'files in cache' 2 + + echo "fun:bar" >blacklist.txt + + $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c + expect_stat 'cache hit (direct)' 1 + expect_stat 'cache miss' 2 + expect_stat 'files in cache' 4 + + $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c + expect_stat 'cache hit (direct)' 2 + expect_stat 'cache miss' 2 + expect_stat 'files in cache' 4 + + # ------------------------------------------------------------------------- + TEST "Compile failed" + + if $REAL_COMPILER -c -fsanitize-blacklist=nosuchfile.txt test1.c 2>expected.stderr; then + test_failed "Expected an error compiling test1.c" + fi + + rm blacklist.txt + + if $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c 2>expected.stderr; then + test_failed "Expected an error compiling test1.c" + fi + + expect_stat 'error hashing extra file' 1 +} -- cgit v1.2.1 From 8d6e8783457f59acadf1eebcbca52351f4163b7d Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 7 May 2018 19:54:17 +0200 Subject: Update NEWS --- doc/NEWS.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/NEWS.adoc b/doc/NEWS.adoc index 78db8966..8b997586 100644 --- a/doc/NEWS.adoc +++ b/doc/NEWS.adoc @@ -19,6 +19,9 @@ New features and enhancements - Added ``stats updated'' timestamp in `ccache -s` output. This can be useful if you wonder whether ccache actually was used for your last build. +- The content of the `-fsanitize-blacklist` file is now included in the hash, + so updates to the file will now correctly result in separate cache entries. + ccache 3.4.2 ------------ -- cgit v1.2.1 From 2f160d60c87e75183cbedcfb5cffb5650dea366b Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Tue, 24 Apr 2018 22:05:01 +0200 Subject: Fix some casting warnings --- src/cleanup.c | 4 ++-- src/conf.c | 2 +- src/hashtable.c | 2 +- src/snprintf.c | 4 ++-- src/util.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cleanup.c b/src/cleanup.c index 969b8d2b..20dc77f7 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -164,8 +164,8 @@ clean_up_dir(struct conf *conf, const char *dir, double limit_multiple) // When "max files" or "max cache size" is reached, one of the 16 cache // subdirectories is cleaned up. When doing so, files are deleted (in LRU // order) until the levels are below limit_multiple. - cache_size_threshold = round(conf->max_size * limit_multiple / 16); - files_in_cache_threshold = round(conf->max_files * limit_multiple / 16); + cache_size_threshold = (uint64_t)round(conf->max_size * limit_multiple / 16); + files_in_cache_threshold = (size_t)round(conf->max_files * limit_multiple / 16); num_files = 0; cache_size = 0; diff --git a/src/conf.c b/src/conf.c index fbc06af7..0ba5e2c1 100644 --- a/src/conf.c +++ b/src/conf.c @@ -377,7 +377,7 @@ conf_free(struct conf *conf) free(conf->prefix_command); free(conf->prefix_command_cpp); free(conf->temporary_dir); - free(conf->item_origins); + free((void *)conf->item_origins); /* Workaround for MSVC warning */ free(conf); } diff --git a/src/hashtable.c b/src/hashtable.c index 02ab4542..29cf78ab 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -51,7 +51,7 @@ static const unsigned int primes[] = { 805306457, 1610612741 }; const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]); -const float max_load_factor = 0.65; +const float max_load_factor = 0.65f; /*****************************************************************************/ struct hashtable * diff --git a/src/snprintf.c b/src/snprintf.c index b935ee93..bc72a5f3 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -1202,7 +1202,7 @@ again: * Factor of ten with the number of digits needed for the fractional * part. For example, if the precision is 3, the mask will be 1000. */ - mask = mypow10(precision); + mask = (UINTMAX_T)mypow10(precision); /* * We "cheat" by converting the fractional part to integer by * multiplying by a factor of ten. @@ -1454,7 +1454,7 @@ cast(LDOUBLE value) if (value >= UINTMAX_MAX) return UINTMAX_MAX; - result = value; + result = (UINTMAX_T)value; /* * At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to * an integer type converts e.g. 1.9 to 2 instead of 1 (which violates diff --git a/src/util.c b/src/util.c index dcb8f658..e8632317 100644 --- a/src/util.c +++ b/src/util.c @@ -983,7 +983,7 @@ parse_size_with_suffix(const char *str, uint64_t *size) // Default suffix: G. x *= 1000 * 1000 * 1000; } - *size = x; + *size = (uint64_t)x; return true; } -- cgit v1.2.1 From 37a54631e4b3cf1596c52201554d7d52c3bd7acf Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Tue, 24 Apr 2018 22:05:42 +0200 Subject: hashutil: fix memory-leak/double free --- src/hashutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hashutil.c b/src/hashutil.c index ddbd0daa..0086bf7f 100644 --- a/src/hashutil.c +++ b/src/hashutil.c @@ -220,7 +220,7 @@ hash_command_output(struct mdfour *hash, const char *command, CloseHandle(pipe_out[1]); args_free(args); free(win32args); - if (cmd) { + if (!cmd) { free((char *)command); // Original argument was replaced above. } if (ret == 0) { -- cgit v1.2.1 From a630d2e1d06aabee4841eb1c4169584447e26623 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 7 May 2018 20:10:44 +0200 Subject: Fix code style --- src/ccache.c | 4 ++-- src/cleanup.c | 3 ++- src/conf.c | 2 +- src/execute.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ccache.c b/src/ccache.c index c5497dea..cf61f1d0 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -1814,8 +1814,8 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode) if ((str_eq(args->argv[i], "-ccbin") || str_eq(args->argv[i], "--compiler-bindir")) - && i + 1 < args->argc - && x_stat(args->argv[i+1], &st) == 0) { + && i + 1 < args->argc + && x_stat(args->argv[i+1], &st) == 0) { found_ccbin = true; hash_delimiter(hash, "ccbin"); hash_nvcc_host_compiler(hash, &st, args->argv[i+1]); diff --git a/src/cleanup.c b/src/cleanup.c index 20dc77f7..607e5dbb 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -165,7 +165,8 @@ clean_up_dir(struct conf *conf, const char *dir, double limit_multiple) // subdirectories is cleaned up. When doing so, files are deleted (in LRU // order) until the levels are below limit_multiple. cache_size_threshold = (uint64_t)round(conf->max_size * limit_multiple / 16); - files_in_cache_threshold = (size_t)round(conf->max_files * limit_multiple / 16); + files_in_cache_threshold = + (size_t)round(conf->max_files * limit_multiple / 16); num_files = 0; cache_size = 0; diff --git a/src/conf.c b/src/conf.c index 0ba5e2c1..ceb78585 100644 --- a/src/conf.c +++ b/src/conf.c @@ -377,7 +377,7 @@ conf_free(struct conf *conf) free(conf->prefix_command); free(conf->prefix_command_cpp); free(conf->temporary_dir); - free((void *)conf->item_origins); /* Workaround for MSVC warning */ + free((void *)conf->item_origins); // Workaround for MSVC warning free(conf); } diff --git a/src/execute.c b/src/execute.c index ae305520..8c4849a9 100644 --- a/src/execute.c +++ b/src/execute.c @@ -40,7 +40,7 @@ win32argvtos(char *prefix, char **argv) break; case '"': bs = (bs << 1) + 1; - // Fallthrough. + // Fallthrough. default: k += bs + 1; bs = 0; -- cgit v1.2.1 From c8590d9016445549405fc95995a9d89c9bd0f94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 2 May 2018 00:00:00 +0000 Subject: Avoid TOCTOU issue when deciding if config is valid Previously, a separate call to access had been used to distinguish between I/O errors and invalid configuration file. This could lead to spurious errors if configuration file have been created in-between call to conf_read and access. Use errno to tell those two cases apart. Closes #260. --- src/ccache.c | 4 ++-- src/conf.c | 4 ++++ unittest/test_conf.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ccache.c b/src/ccache.c index 277b55b4..43421830 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -3124,7 +3124,7 @@ initialize(void) } else { secondary_config_path = format("%s/ccache.conf", TO_STRING(SYSCONFDIR)); if (!conf_read(conf, secondary_config_path, &errmsg)) { - if (access(secondary_config_path, R_OK) == 0) { + if (errno == 0) { // We could read the file but it contained errors. fatal("%s", errmsg); } @@ -3148,7 +3148,7 @@ initialize(void) bool should_create_initial_config = false; if (!conf_read(conf, primary_config_path, &errmsg)) { - if (access(primary_config_path, R_OK) == 0) { + if (errno == 0) { // We could read the file but it contained errors. fatal("%s", errmsg); } diff --git a/src/conf.c b/src/conf.c index 20e744a0..4fbc7d0b 100644 --- a/src/conf.c +++ b/src/conf.c @@ -381,6 +381,9 @@ conf_free(struct conf *conf) } // Note: The path pointer is stored in conf, so path must outlive conf. +// +// On failure, if an I/O error occured errno is set approriately, otherwise +// errno is set to zero indicating that config itself was invalid. bool conf_read(struct conf *conf, const char *path, char **errmsg) { @@ -411,6 +414,7 @@ conf_read(struct conf *conf, const char *path, char **errmsg) if (!ok) { *errmsg = format("%s:%u: %s", path, line_number, errmsg2); free(errmsg2); + errno = 0; result = false; goto out; } diff --git a/unittest/test_conf.c b/unittest/test_conf.c index 9f88133b..0718a2e8 100644 --- a/unittest/test_conf.c +++ b/unittest/test_conf.c @@ -183,6 +183,7 @@ TEST(conf_read_with_missing_equal_sign) char *errmsg; create_file("ccache.conf", "no equal sign"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: missing equal sign", errmsg); conf_free(conf); @@ -194,6 +195,7 @@ TEST(conf_read_with_bad_config_key) char *errmsg; create_file("ccache.conf", "# Comment\nfoo = bar"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:2: unknown configuration option \"foo\"", errmsg); conf_free(conf); @@ -206,11 +208,13 @@ TEST(conf_read_invalid_bool) create_file("ccache.conf", "disable="); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: not a boolean value: \"\"", errmsg); create_file("ccache.conf", "disable=foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: not a boolean value: \"foo\"", errmsg); conf_free(conf); @@ -222,6 +226,7 @@ TEST(conf_read_invalid_env_string) char *errmsg; create_file("ccache.conf", "base_dir = ${foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: syntax error: missing '}' after \"foo\"", errmsg); // Other cases tested in test_util.c. @@ -244,6 +249,7 @@ TEST(conf_read_invalid_size) char *errmsg; create_file("ccache.conf", "max_size = foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: invalid size: \"foo\"", errmsg); // Other cases tested in test_util.c. @@ -256,6 +262,7 @@ TEST(conf_read_invalid_sloppiness) char *errmsg; create_file("ccache.conf", "sloppiness = file_macro, foo"); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: unknown sloppiness: \"foo\"", errmsg); conf_free(conf); @@ -268,6 +275,7 @@ TEST(conf_read_invalid_unsigned) create_file("ccache.conf", "max_files ="); CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, 0); CHECK_STR_EQ_FREE2("ccache.conf:1: invalid unsigned integer: \"\"", errmsg); @@ -284,6 +292,14 @@ TEST(conf_read_invalid_unsigned) conf_free(conf); } +TEST(conf_read_missing_config_file) +{ + struct conf *conf = conf_create(); + char *errmsg; + CHECK(!conf_read(conf, "ccache.conf", &errmsg)); + CHECK_INT_EQ(errno, ENOENT); +} + TEST(verify_absolute_base_dir) { struct conf *conf = conf_create(); -- cgit v1.2.1 From c90c1efbc8e14be832bb99221d4d4dad97d05c4c Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 7 May 2018 21:45:12 +0200 Subject: Update NEWS --- doc/NEWS.adoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/NEWS.adoc b/doc/NEWS.adoc index 7cd4b604..907c7e80 100644 --- a/doc/NEWS.adoc +++ b/doc/NEWS.adoc @@ -1,6 +1,17 @@ ccache news =========== +ccache 3.4.3 +----------- +Release date: unknown + +Bug fixes +~~~~~~~~~ + +- Fixed a race condition when creating the initial config file in the cache + directory. + + ccache 3.4.2 ------------ Release date: 2018-03-25 -- cgit v1.2.1 From 30868c931b91685a641c489b5a6144dc87b567a8 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 7 Jun 2018 21:31:38 +0200 Subject: Improve installation instructions --- doc/INSTALL-from-release-archive.md | 7 ++++--- doc/INSTALL.md | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/INSTALL-from-release-archive.md b/doc/INSTALL-from-release-archive.md index be25d028..e5e335d4 100644 --- a/doc/INSTALL-from-release-archive.md +++ b/doc/INSTALL-from-release-archive.md @@ -1,10 +1,11 @@ -ccache installation -=================== +ccache installation from release archive +======================================== Prerequisites ------------- -To build ccache, you need: +To build ccache from a +[release archive](https://ccache.samba.org/download.html), you need: - A C compiler (for instance GCC) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index d0531943..4d2a55ca 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -1,10 +1,10 @@ -ccache installation -=================== +ccache installation from source repository +========================================== Prerequisites ------------- -To build ccache from the source repository, you need: +To build ccache from a source repository, you need: - A C compiler (for instance GCC) - GNU Bourne Again SHell (bash) for tests. -- cgit v1.2.1 From e34368197b3d2acf44adc7ab2c9aa95b4d1e4206 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 7 Jun 2018 21:48:42 +0200 Subject: Improve logging related to hashing of the CWD --- src/ccache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ccache.c b/src/ccache.c index 43421830..848eecbb 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -1600,7 +1600,7 @@ calculate_common_hash(struct args *args, struct mdfour *hash) if (sep) { char *old = x_strndup(map, sep - map); char *new = x_strdup(sep + 1); - cc_log("Relocating debuginfo cwd %s, from %s to %s", cwd, old, new); + cc_log("Relocating debuginfo CWD %s from %s to %s", cwd, old, new); if (str_startswith(cwd, old)) { char *dir = format("%s%s", new, cwd + strlen(old)); free(cwd); @@ -1611,6 +1611,7 @@ calculate_common_hash(struct args *args, struct mdfour *hash) } } if (cwd) { + cc_log("Hashing CWD %s", cwd); hash_delimiter(hash, "cwd"); hash_string(hash, cwd); free(cwd); -- cgit v1.2.1 From fab038e6ff8997a5025e80c6f5eaa98e69be6dcb Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 7 Jun 2018 21:52:09 +0200 Subject: Remove debug log --- test/suites/cleanup.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/cleanup.bash b/test/suites/cleanup.bash index 45dccb08..f36dc75c 100644 --- a/test/suites/cleanup.bash +++ b/test/suites/cleanup.bash @@ -87,7 +87,7 @@ SUITE_cleanup() { prepare_cleanup_test_dir $CCACHE_DIR/a $CCACHE -F 0 -M 256K >/dev/null - CCACHE_LOGFILE=/tmp/foo $CCACHE -c >/dev/null + $CCACHE -c >/dev/null expect_file_count 3 '*.o' $CCACHE_DIR expect_file_count 4 '*.d' $CCACHE_DIR expect_file_count 4 '*.stderr' $CCACHE_DIR -- cgit v1.2.1 From a59166b5a9815e18d83756fa957cd441667d992f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Thu, 7 Jun 2018 21:20:19 +0200 Subject: Add configure option to disable man pages Building the man page requires asciidoc, if building from the source repository. Add option to only install the program, but not the man. When building from the release tarball, the man page is already built. So we can still default to installing it, and requiring asciidoc/a2x. Closes #264 --- Makefile.in | 6 +++--- configure.ac | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index dd0fc571..6f94fb01 100644 --- a/Makefile.in +++ b/Makefile.in @@ -101,11 +101,11 @@ ccache.1: doc/ccache.1 cp $< $@ .PHONY: install -install: ccache$(EXEEXT) ccache.1 +install: ccache$(EXEEXT) @disable_man@ccache.1 $(installcmd) -d $(DESTDIR)$(bindir) $(installcmd) -m 755 ccache$(EXEEXT) $(DESTDIR)$(bindir) - $(installcmd) -d $(DESTDIR)$(mandir)/man1 - -$(installcmd) -m 644 ccache.1 $(DESTDIR)$(mandir)/man1/ +@disable_man@ $(installcmd) -d $(DESTDIR)$(mandir)/man1 +@disable_man@ -$(installcmd) -m 644 ccache.1 $(DESTDIR)$(mandir)/man1/ .PHONY: clean clean: diff --git a/configure.ac b/configure.ac index e2a348d9..ae2c208b 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,7 @@ esac AC_SUBST(extra_libs) AC_SUBST(include_dev_mk) AC_SUBST(test_suites) +AC_SUBST(disable_man) m4_include(m4/feature_macros.m4) @@ -126,6 +127,13 @@ else LIBS="$LIBS -lz" fi +AC_ARG_ENABLE(man, + [AS_HELP_STRING([--disable-man], + [disable installing man pages])]) +if test x${enable_man} = xno; then + disable_man='#' +fi + dnl Linking on Windows needs ws2_32 if test x${windows_os} = xyes; then LIBS="$LIBS -lws2_32" -- cgit v1.2.1