From: Joel Rosdahl Date: Fri, 6 Jan 2012 16:03:38 +0000 (+0100) Subject: Merge branch 'master' into config X-Git-Tag: v3.2~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aab78af38c0d21356c887c1ec3bb3699e4052e81;p=thirdparty%2Fccache.git Merge branch 'master' into config * master: Merge branch 'maint' Sync mdfour.c license header with other files, notably fixing FSF's address. Conflicts: ccache.c --- aab78af38c0d21356c887c1ec3bb3699e4052e81 diff --cc ccache.c index 234dd6a23,2b0fce065..ddc919b7c --- a/ccache.c +++ b/ccache.c @@@ -866,6 -891,36 +869,31 @@@ update_cached_result_globals(struct fil free(object_name); } + /* + * Hash mtime or content of a file, or the output of a command, according to + * the CCACHE_COMPILERCHECK setting. + */ + static void + hash_compiler(struct mdfour *hash, struct stat *st, const char *path, + bool allow_command) + { - const char *compilercheck; - - compilercheck = getenv("CCACHE_COMPILERCHECK"); - if (!compilercheck) { - compilercheck = "mtime"; - } - if (str_eq(compilercheck, "none")) { ++ if (str_eq(conf->compiler_check, "none")) { + /* Do nothing. */ - } else if (str_eq(compilercheck, "mtime")) { ++ } else if (str_eq(conf->compiler_check, "mtime")) { + hash_delimiter(hash, "cc_mtime"); + hash_int(hash, st->st_size); + hash_int(hash, st->st_mtime); - } else if (str_eq(compilercheck, "content") || !allow_command) { ++ } else if (str_eq(conf->compiler_check, "content") || !allow_command) { + hash_delimiter(hash, "cc_content"); + hash_file(hash, path); + } else { /* command string */ - if (!hash_multicommand_output(hash, compilercheck, orig_args->argv[0])) { - fatal("Failure running compiler check command: %s", compilercheck); ++ if (!hash_multicommand_output( ++ hash, conf->compiler_check, orig_args->argv[0])) { ++ fatal("Failure running compiler check command: %s", conf->compiler_check); + } + } + } + /* * Update a hash sum with information common for the direct and preprocessor * modes. @@@ -1046,7 -1094,25 +1065,25 @@@ calculate_object_hash(struct args *args } if (direct_mode) { + /* Hash environment variables that affect the preprocessor output. */ + const char **p; + const char *envvars[] = { + "CPATH", + "C_INCLUDE_PATH", + "CPLUS_INCLUDE_PATH", + "OBJC_INCLUDE_PATH", + "OBJCPLUS_INCLUDE_PATH", /* clang */ + NULL + }; + for (p = envvars; *p != NULL ; ++p) { + char *v = getenv(*p); + if (v) { + hash_delimiter(hash, *p); + hash_string(hash, v); + } + } + - if (!(sloppiness & SLOPPY_FILE_MACRO)) { + if (!(conf->sloppiness & SLOPPY_FILE_MACRO)) { /* * The source code file or an include file may contain * __FILE__, so make sure that the hash is unique for