diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2012-01-08 15:17:00 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2012-01-08 15:17:00 +0100 |
commit | e9e8f5b2099092bb746a7ac0d635120bfb7cac86 (patch) | |
tree | bd800143ab8420a97ca8813b990ca990c7496082 | |
parent | aab78af38c0d21356c887c1ec3bb3699e4052e81 (diff) | |
parent | 90779f7dceea3e84e01c8908383a97ac1a7f8b45 (diff) | |
download | ccache-e9e8f5b2099092bb746a7ac0d635120bfb7cac86.tar.gz |
Merge branch 'master' into config
* master:
while (1) -> while (true)
Fixup after merge: Make directory creation failure fatal
Update NEWS
Also recognize -specs=file in addition to --specs=file
Revert GCC bug compatibility for -MTarg and -MQarg
Fix minor memory leaks
Correct log message when unify mode is enabled
Hash environment variables that affect the preprocessor output
Hash mtime or content of GCC plugins specified with -fplugin=
Use hash_compiler for explicit --specs= options as well
Refactor code into a hash_compiler function
Improve description on how to fix bad object files in the cache
Make failure to create files in cache fatal
Make failure to create cache directories fatal
Remove unused print_executed_command function
Handle non-writable CCACHE_DIR gracefully
Conflicts:
manifest.c
test/framework.c
-rw-r--r-- | NEWS.txt | 34 | ||||
-rw-r--r-- | ccache.c | 38 | ||||
-rw-r--r-- | lockfile.c | 4 | ||||
-rw-r--r-- | manifest.c | 3 | ||||
-rw-r--r-- | stats.c | 4 | ||||
-rw-r--r-- | test/framework.c | 4 | ||||
-rw-r--r-- | test/test_argument_processing.c | 10 | ||||
-rw-r--r-- | util.c | 16 |
8 files changed, 75 insertions, 38 deletions
@@ -2,6 +2,40 @@ ccache news =========== +ccache 3.1.7 +------------ +Release date: 2012-01-08 + + +Bug fixes +~~~~~~~~~ + + - Non-writable `CCACHE_DIR` is now handled gracefully when + `CCACHE_READONLY` is set. + - Made failure to create files (typically due to bad directory permissions) + in the cache directory fatal. Previously, such failures were silently and + erroneously flagged as "compiler produced stdout". + - Both the `-specs=file` and `--specs=file` forms are now recognized. + - Added recognition and hashing of GCC plugins specified with + `-fplugin=file`. + - `CCACHE_COMPILERCHECK` now also determines how to hash explicit specs + files (`-specs=file`). + - Added `CPATH`, `C_INCLUDE_PATH` and similar environment variables to the + hash to avoid false cache hits when such variables have changed. + - Corrected log message when unify mode is enabled. + - Reverted the GCC bug compatibility for `-MT`/`-MQ` options with + concatenated arguments introduced in ccache 3.1.5. (The bug is fixed in + recent GCC versions.) + + +Other +~~~~~ + + - Corrected license header for `mdfour.c`. + - Improved documentation on how to fix bad object files in the cache. + + + ccache 3.1.6 ------------ Release date: 2011-08-21 @@ -537,9 +537,8 @@ to_cache(struct args *args) unsigned added_files = 0; if (create_parent_dirs(cached_obj) != 0) { - cc_log("Failed to create parent directories for %s: %s", - cached_obj, strerror(errno)); - failed(); + fatal("Failed to create parent directory for %s: %s", + cached_obj, strerror(errno)); } tmp_stdout = format("%s.tmp.stdout.%s", cached_obj, tmp_string()); tmp_stderr = format("%s.tmp.stderr.%s", cached_obj, tmp_string()); @@ -767,12 +766,8 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash) path_stderr = format("%s/tmp.cpp_stderr.%s", temp_dir(), tmp_string()); if (create_parent_dirs(path_stdout) != 0) { - char *parent = dirname(path_stdout); - fprintf(stderr, - "ccache: failed to create %s (%s)\n", - parent, strerror(errno)); - free(parent); - exit(1); + fatal("Failed to create parent directory for %s: %s\n", + path_stdout, strerror(errno)); } time_of_compilation = time(NULL); @@ -902,6 +897,7 @@ static void calculate_common_hash(struct args *args, struct mdfour *hash) { struct stat st; + char *p; hash_string(hash, HASH_PREFIX); @@ -928,7 +924,9 @@ calculate_common_hash(struct args *args, struct mdfour *hash) * behave differently depending on the real name. */ hash_delimiter(hash, "cc_name"); - hash_string(hash, basename(args->argv[0])); + p = basename(args->argv[0]); + hash_string(hash, p); + free(p); /* Possibly hash the current working directory. */ if (conf->hash_dir) { @@ -970,6 +968,7 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode) struct stat st; int result; struct file_hash *object_hash = NULL; + char *p; /* first the arguments */ for (i = 1; i < args->argc; i++) { @@ -997,12 +996,17 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode) } } - if (str_startswith(args->argv[i], "--specs=") - && stat(args->argv[i] + 8, &st) == 0) { + p = NULL; + if (str_startswith(args->argv[i], "-specs=")) { + p = args->argv[i] + 7; + } else if (str_startswith(args->argv[i], "--specs=")) { + p = args->argv[i] + 8; + } + if (p && stat(p, &st) == 0) { /* If given an explicit specs file, then hash that file, but don't include the path to it in the hash. */ hash_delimiter(hash, "specs"); - hash_compiler(hash, &st, args->argv[i] + 8, false); + hash_compiler(hash, &st, p, false); continue; } @@ -1539,6 +1543,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args, continue; } if (str_startswith(argv[i], "-MQ") || str_startswith(argv[i], "-MT")) { + dependency_target_specified = true; args_add(dep_args, argv[i]); if (strlen(argv[i]) == 3) { /* -MQ arg or -MT arg */ @@ -1550,13 +1555,6 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args, } args_add(dep_args, argv[i + 1]); i++; - /* - * Yes, that's right. It's strange, but apparently, GCC behaves - * differently for -MT arg and -MTarg (and similar for -MQ): in the - * latter case, but not in the former, an implicit dependency for the - * object file is added to the dependency file. - */ - dependency_target_specified = true; } continue; } @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Joel Rosdahl + * Copyright (C) 2010-2012 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -43,7 +43,7 @@ lockfile_acquire(const char *path, unsigned staleness_limit) #endif unsigned to_sleep = 1000, slept = 0; /* Microseconds. */ - while (1) { + while (true) { free(my_content); my_content = format("%s:%d:%d", hostname, (int)getpid(), (int)time(NULL)); @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 Joel Rosdahl + * Copyright (C) 2009-2012 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -139,6 +139,7 @@ free_manifest(struct manifest *mf) free(mf->objects[i].file_info_indexes); } free(mf->objects); + free(mf); } #define READ_INT(size, var) \ @@ -1,6 +1,6 @@ /* * Copyright (C) 2002-2004 Andrew Tridgell - * Copyright (C) 2009-2011 Joel Rosdahl + * Copyright (C) 2009-2012 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -107,7 +107,7 @@ parse_stats(struct counters *counters, const char *buf) long val; p = buf; - while (1) { + while (true) { val = strtol(p, &p2, 10); if (p2 == p) { break; diff --git a/test/framework.c b/test/framework.c index 425e9ff5..fd6ce721 100644 --- a/test/framework.c +++ b/test/framework.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Joel Rosdahl + * Copyright (C) 2010-2012 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -68,7 +68,7 @@ cct_run(suite_fn *suites, int verbose_output) for (suite = suites; *suite; suite++) { unsigned test_index = 0; - while (1) { + while (true) { test_index = (*suite)(test_index + 1); if (test_index == 0) { /* We have reached the end of the suite. */ diff --git a/test/test_argument_processing.c b/test/test_argument_processing.c index 68aa3788..4ffe931f 100644 --- a/test/test_argument_processing.c +++ b/test/test_argument_processing.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Joel Rosdahl + * Copyright (C) 2010-2012 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -198,12 +198,12 @@ TEST(MT_flag_without_immediate_argument_should_not_add_MTobj) args_free(orig); } -TEST(MQ_flag_with_immediate_argument_should_add_MQobj) +TEST(MQ_flag_with_immediate_argument_should_not_add_MQobj) { struct args *orig = args_init_from_string( "gcc -c -MD -MP -MFfoo.d -MQfoo.d foo.c"); struct args *exp_cpp = args_init_from_string( - "gcc -MD -MP -MFfoo.d -MQfoo.d -MQ foo.o"); + "gcc -MD -MP -MFfoo.d -MQfoo.d"); struct args *exp_cc = args_init_from_string("gcc -c"); struct args *act_cpp = NULL, *act_cc = NULL; create_file("foo.c", ""); @@ -215,12 +215,12 @@ TEST(MQ_flag_with_immediate_argument_should_add_MQobj) args_free(orig); } -TEST(MT_flag_with_immediate_argument_should_add_MQobj) +TEST(MT_flag_with_immediate_argument_should_not_add_MQobj) { struct args *orig = args_init_from_string( "gcc -c -MD -MP -MFfoo.d -MTfoo.d foo.c"); struct args *exp_cpp = args_init_from_string( - "gcc -MD -MP -MFfoo.d -MTfoo.d -MQ foo.o"); + "gcc -MD -MP -MFfoo.d -MTfoo.d"); struct args *exp_cc = args_init_from_string("gcc -c"); struct args *act_cpp = NULL, *act_cc = NULL; create_file("foo.c", ""); @@ -1,6 +1,6 @@ /* * Copyright (C) 2002 Andrew Tridgell - * Copyright (C) 2009-2011 Joel Rosdahl + * Copyright (C) 2009-2012 Joel Rosdahl * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -976,7 +976,7 @@ gnu_getcwd(void) { unsigned size = 128; - while (1) { + while (true) { char *buffer = (char *)x_malloc(size); if (getcwd(buffer, size) == buffer) { return buffer; @@ -1245,15 +1245,19 @@ x_unlink(const char *path) * file. We don't care if the temp file is trashed, so it's always safe to * unlink it first. */ - const char* tmp_name = format("%s.%s.rmXXXXXX", path, tmp_string()); + char* tmp_name = format("%s.%s.rmXXXXXX", path, tmp_string()); + int result = 0; cc_log("Unlink %s via %s", path, tmp_name); if (x_rename(path, tmp_name) == -1) { - return -1; + result = -1; + goto out; } if (unlink(tmp_name) == -1) { - return -1; + result = -1; } - return 0; +out: + free(tmp_name); + return result; } #ifndef _WIN32 |