From 3fbd20042187f29cf19282f3afb46c56db4155a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Anders=20Bj=C3=B6rklund?= Date: Wed, 4 Nov 2015 22:58:25 +0100 Subject: [PATCH] Add prefix option for precompiler too To avoid overload the local CPU with precompiling, it can be useful to let distcc know (take a local slot) when ccache is precompiling. Those slots are kept in a separate locking queue (--localslots_cpp) from the remote compilations, in order to use many more remote slots. --- MANUAL.txt | 7 ++ ccache.c | 13 ++-- conf.c | 6 ++ conf.h | 1 + confitems.gperf | 19 +++--- confitems_lookup.c | 148 +++++++++++++++++++--------------------- envtoconfitems.gperf | 1 + envtoconfitems_lookup.c | 132 ++++++++++++++++++----------------- test.sh | 9 +++ test/test_conf.c | 7 +- 10 files changed, 188 insertions(+), 155 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index 10a654275..9852cb372 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -413,6 +413,11 @@ WRAPPERS>>. <<_using_ccache_with_other_compiler_wrappers,USING CCACHE WITH OTHER COMPILER WRAPPERS>>. +*prefix_command_cpp* (*CCACHE_PREFIX_CPP*):: + + This option adds a list of prefixes (separated by space) to the command + line that ccache uses when invoking the preprocessor. + *read_only* (*CCACHE_READONLY*) [boolean]:: If true, ccache will attempt to use existing cached object files, but it @@ -763,6 +768,8 @@ size of the other wrapper instead of the real compiler, which means that: Another minor thing is that if *prefix_command* is used, ccache will not invoke the other wrapper when running the preprocessor, which increase performance. +You can use the *prefix_command_cpp* configuration setting, if you also want to +invoke the other wrapper when doing preprocessing (normally by adding *-E*). Bugs diff --git a/ccache.c b/ccache.c index 3b1d4d08c..efaedfba8 100644 --- a/ccache.c +++ b/ccache.c @@ -261,19 +261,19 @@ static pid_t compiler_pid = 0; static const char HASH_PREFIX[] = "3"; static void -add_prefix(struct args *args) +add_prefix(struct args *args, char *prefix_command) { char *e; char *tok, *saveptr = NULL; struct args *prefix; int i; - if (str_eq(conf->prefix_command, "")) { + if (str_eq(prefix_command, "")) { return; } prefix = args_init(0, NULL); - e = x_strdup(conf->prefix_command); + e = x_strdup(prefix_command); for (tok = strtok_r(e, " ", &saveptr); tok; tok = strtok_r(NULL, " ", &saveptr)) { @@ -289,7 +289,7 @@ add_prefix(struct args *args) } free(e); - cc_log("Using command-line prefix %s", conf->prefix_command); + cc_log("Using command-line prefix %s", prefix_command); for (i = prefix->argc; i != 0; i--) { args_add_prefix(args, prefix->argv[i-1]); } @@ -303,7 +303,7 @@ failed(void) assert(orig_args); args_strip(orig_args, "--ccache-"); - add_prefix(orig_args); + add_prefix(orig_args, conf->prefix_command); cc_log("Failed; falling back to running the real compiler"); cc_log_argv("Executing ", orig_args->argv); @@ -1281,6 +1281,7 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash) args_add(args, "-E"); args_add(args, input_file); + add_prefix(args, conf->prefix_command_cpp); cc_log("Running preprocessor"); status = execute(args->argv, path_stdout_fd, path_stderr_fd, &compiler_pid); args_pop(args, 2); @@ -3196,7 +3197,7 @@ ccache(int argc, char *argv[]) failed(); } - add_prefix(compiler_args); + add_prefix(compiler_args, conf->prefix_command); /* run real compiler, sending output to cache */ to_cache(compiler_args); diff --git a/conf.c b/conf.c index cf65c08b9..8ab60c391 100644 --- a/conf.c +++ b/conf.c @@ -321,6 +321,7 @@ conf_create(void) conf->max_size = (uint64_t)5 * 1000 * 1000 * 1000; conf->path = x_strdup(""); conf->prefix_command = x_strdup(""); + conf->prefix_command_cpp = x_strdup(""); conf->read_only = false; conf->read_only_direct = false; conf->recache = false; @@ -353,6 +354,7 @@ conf_free(struct conf *conf) free(conf->log_file); free(conf->path); free(conf->prefix_command); + free(conf->prefix_command_cpp); free(conf->temporary_dir); free(conf->item_origins); free(conf); @@ -591,6 +593,10 @@ conf_print_items(struct conf *conf, reformat(&s, "prefix_command = %s", conf->prefix_command); printer(s, conf->item_origins[find_conf("prefix_command")->number], context); + reformat(&s, "prefix_command_cpp = %s", conf->prefix_command_cpp); + printer(s, conf->item_origins[find_conf( + "prefix_command_cpp")->number], context); + reformat(&s, "read_only = %s", bool_to_string(conf->read_only)); printer(s, conf->item_origins[find_conf("read_only")->number], context); diff --git a/conf.h b/conf.h index df0ac98e9..238cb8d94 100644 --- a/conf.h +++ b/conf.h @@ -23,6 +23,7 @@ struct conf { uint64_t max_size; char *path; char *prefix_command; + char *prefix_command_cpp; bool read_only; bool read_only_direct; bool recache; diff --git a/confitems.gperf b/confitems.gperf index 3f0920696..d7041992b 100644 --- a/confitems.gperf +++ b/confitems.gperf @@ -26,12 +26,13 @@ max_files, 15, ITEM(max_files, unsigned) max_size, 16, ITEM(max_size, size) path, 17, ITEM(path, env_string) prefix_command, 18, ITEM(prefix_command, env_string) -read_only, 19, ITEM(read_only, bool) -read_only_direct, 20, ITEM(read_only_direct, bool) -recache, 21, ITEM(recache, bool) -run_second_cpp, 22, ITEM(run_second_cpp, bool) -sloppiness, 23, ITEM(sloppiness, sloppiness) -stats, 24, ITEM(stats, bool) -temporary_dir, 25, ITEM(temporary_dir, env_string) -umask, 26, ITEM(umask, umask) -unify, 27, ITEM(unify, bool) +prefix_command_cpp, 19, ITEM(prefix_command_cpp, env_string) +read_only, 20, ITEM(read_only, bool) +read_only_direct, 21, ITEM(read_only_direct, bool) +recache, 22, ITEM(recache, bool) +run_second_cpp, 23, ITEM(run_second_cpp, bool) +sloppiness, 24, ITEM(sloppiness, sloppiness) +stats, 25, ITEM(stats, bool) +temporary_dir, 26, ITEM(temporary_dir, env_string) +umask, 27, ITEM(umask, umask) +unify, 28, ITEM(unify, bool) diff --git a/confitems_lookup.c b/confitems_lookup.c index 539f8601a..dc4eb43d7 100644 --- a/confitems_lookup.c +++ b/confitems_lookup.c @@ -31,7 +31,7 @@ #line 8 "confitems.gperf" struct conf_item; -/* maximum key range = 45, duplicates = 0 */ +/* maximum key range = 41, duplicates = 0 */ #ifdef __GNUC__ __inline @@ -45,32 +45,32 @@ confitems_hash (register const char *str, register unsigned int len) { static const unsigned char asso_values[] = { - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 20, 5, 0, - 10, 0, 50, 0, 15, 5, 50, 50, 20, 10, - 0, 0, 10, 50, 0, 0, 0, 5, 50, 50, - 30, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50 + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 0, 13, 0, + 15, 10, 45, 5, 30, 10, 45, 45, 10, 20, + 5, 0, 0, 45, 5, 0, 10, 15, 45, 45, + 15, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45 }; return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]]; } @@ -87,85 +87,81 @@ confitems_get (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 28, + TOTAL_KEYWORDS = 29, MIN_WORD_LENGTH = 4, MAX_WORD_LENGTH = 26, - MIN_HASH_VALUE = 5, - MAX_HASH_VALUE = 49 + MIN_HASH_VALUE = 4, + MAX_HASH_VALUE = 44 }; static const struct conf_item wordlist[] = { {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, +#line 27 "confitems.gperf" + {"path", 17, ITEM(path, env_string)}, + {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, -#line 34 "confitems.gperf" - {"stats", 24, ITEM(stats, bool)}, - {"",0,NULL,0,NULL}, -#line 31 "confitems.gperf" - {"recache", 21, ITEM(recache, bool)}, #line 13 "confitems.gperf" {"compiler", 3, ITEM(compiler, string)}, -#line 29 "confitems.gperf" - {"read_only", 19, ITEM(read_only, bool)}, -#line 37 "confitems.gperf" - {"unify", 27, ITEM(unify, bool)}, +#line 11 "confitems.gperf" + {"cache_dir", 1, ITEM(cache_dir, env_string)}, + {"",0,NULL,0,NULL}, #line 15 "confitems.gperf" {"compression", 5, ITEM(compression, bool)}, {"",0,NULL,0,NULL}, -#line 35 "confitems.gperf" - {"temporary_dir", 25, ITEM(temporary_dir, env_string)}, +#line 17 "confitems.gperf" + {"cpp_extension", 7, ITEM(cpp_extension, string)}, #line 14 "confitems.gperf" {"compiler_check", 4, ITEM(compiler_check, string)}, - {"",0,NULL,0,NULL}, -#line 30 "confitems.gperf" - {"read_only_direct", 20, ITEM(read_only_direct, bool)}, +#line 35 "confitems.gperf" + {"stats", 25, ITEM(stats, bool)}, +#line 12 "confitems.gperf" + {"cache_dir_levels", 2, ITEM_V(cache_dir_levels, unsigned, dir_levels)}, #line 16 "confitems.gperf" {"compression_level", 6, ITEM(compression_level, unsigned)}, - {"",0,NULL,0,NULL}, -#line 32 "confitems.gperf" - {"run_second_cpp", 22, ITEM(run_second_cpp, bool)}, -#line 36 "confitems.gperf" - {"umask", 26, ITEM(umask, umask)}, - {"",0,NULL,0,NULL}, -#line 19 "confitems.gperf" - {"disable", 9, ITEM(disable, bool)}, -#line 17 "confitems.gperf" - {"cpp_extension", 7, ITEM(cpp_extension, string)}, -#line 28 "confitems.gperf" - {"prefix_command", 18, ITEM(prefix_command, env_string)}, - {"",0,NULL,0,NULL}, -#line 18 "confitems.gperf" - {"direct_mode", 8, ITEM(direct_mode, bool)}, - {"",0,NULL,0,NULL}, #line 24 "confitems.gperf" {"log_file", 14, ITEM(log_file, env_string)}, -#line 11 "confitems.gperf" - {"cache_dir", 1, ITEM(cache_dir, env_string)}, -#line 33 "confitems.gperf" - {"sloppiness", 23, ITEM(sloppiness, sloppiness)}, -#line 23 "confitems.gperf" - {"ignore_headers_in_manifest", 13, ITEM(ignore_headers_in_manifest, env_string)}, - {"",0,NULL,0,NULL}, +#line 28 "confitems.gperf" + {"prefix_command", 18, ITEM(prefix_command, env_string)}, +#line 34 "confitems.gperf" + {"sloppiness", 24, ITEM(sloppiness, sloppiness)}, #line 10 "confitems.gperf" {"base_dir", 0, ITEM_V(base_dir, env_string, absolute_path)}, -#line 27 "confitems.gperf" - {"path", 17, ITEM(path, env_string)}, - {"",0,NULL,0,NULL}, -#line 12 "confitems.gperf" - {"cache_dir_levels", 2, ITEM_V(cache_dir_levels, unsigned, dir_levels)}, - {"",0,NULL,0,NULL}, +#line 32 "confitems.gperf" + {"recache", 22, ITEM(recache, bool)}, +#line 29 "confitems.gperf" + {"prefix_command_cpp", 19, ITEM(prefix_command_cpp, env_string)}, +#line 30 "confitems.gperf" + {"read_only", 20, ITEM(read_only, bool)}, +#line 38 "confitems.gperf" + {"unify", 28, ITEM(unify, bool)}, + {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, #line 26 "confitems.gperf" {"max_size", 16, ITEM(max_size, size)}, #line 25 "confitems.gperf" {"max_files", 15, ITEM(max_files, unsigned)}, - {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, + {"",0,NULL,0,NULL}, +#line 31 "confitems.gperf" + {"read_only_direct", 21, ITEM(read_only_direct, bool)}, +#line 19 "confitems.gperf" + {"disable", 9, ITEM(disable, bool)}, +#line 36 "confitems.gperf" + {"temporary_dir", 26, ITEM(temporary_dir, env_string)}, +#line 33 "confitems.gperf" + {"run_second_cpp", 23, ITEM(run_second_cpp, bool)}, + {"",0,NULL,0,NULL}, +#line 18 "confitems.gperf" + {"direct_mode", 8, ITEM(direct_mode, bool)}, {"",0,NULL,0,NULL}, #line 22 "confitems.gperf" {"hash_dir", 12, ITEM(hash_dir, bool)}, #line 21 "confitems.gperf" {"hard_link", 11, ITEM(hard_link, bool)}, - {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, +#line 37 "confitems.gperf" + {"umask", 27, ITEM(umask, umask)}, +#line 23 "confitems.gperf" + {"ignore_headers_in_manifest", 13, ITEM(ignore_headers_in_manifest, env_string)}, {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL}, #line 20 "confitems.gperf" {"extra_files_to_hash", 10, ITEM(extra_files_to_hash, env_string)} @@ -185,4 +181,4 @@ confitems_get (register const char *str, register unsigned int len) } return 0; } -static const size_t CONFITEMS_TOTAL_KEYWORDS = 28; +static const size_t CONFITEMS_TOTAL_KEYWORDS = 29; diff --git a/envtoconfitems.gperf b/envtoconfitems.gperf index 340e71555..a3808aa7b 100644 --- a/envtoconfitems.gperf +++ b/envtoconfitems.gperf @@ -28,6 +28,7 @@ MAXSIZE, "max_size" NLEVELS, "cache_dir_levels" PATH, "path" PREFIX, "prefix_command" +PREFIX_CPP, "prefix_command_cpp" READONLY, "read_only" READONLY_DIRECT, "read_only_direct" RECACHE, "recache" diff --git a/envtoconfitems_lookup.c b/envtoconfitems_lookup.c index 2d9a33e08..0b6357fe3 100644 --- a/envtoconfitems_lookup.c +++ b/envtoconfitems_lookup.c @@ -31,7 +31,7 @@ #line 9 "envtoconfitems.gperf" struct env_to_conf_item; -/* maximum key range = 41, duplicates = 0 */ +/* maximum key range = 42, duplicates = 0 */ #ifdef __GNUC__ __inline @@ -45,32 +45,32 @@ envtoconfitems_hash (register const char *str, register unsigned int len) { static const unsigned char asso_values[] = { - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 20, 0, 0, 10, - 20, 43, 15, 25, 10, 43, 5, 10, 15, 0, - 5, 10, 5, 0, 0, 0, 43, 43, 43, 43, - 10, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43 + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 10, 0, 0, 10, + 20, 44, 5, 15, 0, 44, 30, 25, 15, 0, + 5, 15, 5, 15, 0, 0, 44, 44, 44, 44, + 0, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44 }; register int hval = len; @@ -101,11 +101,11 @@ envtoconfitems_get (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 28, + TOTAL_KEYWORDS = 29, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 15, MIN_HASH_VALUE = 2, - MAX_HASH_VALUE = 42 + MAX_HASH_VALUE = 43 }; static const struct env_to_conf_item wordlist[] = @@ -117,65 +117,71 @@ envtoconfitems_get (register const char *str, register unsigned int len) {"DIR", "cache_dir"}, #line 16 "envtoconfitems.gperf" {"CPP2", "run_second_cpp"}, -#line 35 "envtoconfitems.gperf" - {"STATS", "stats"}, +#line 39 "envtoconfitems.gperf" + {"UNIFY", "unify"}, #line 18 "envtoconfitems.gperf" {"DIRECT", "direct_mode"}, #line 19 "envtoconfitems.gperf" {"DISABLE", "disable"}, -#line 14 "envtoconfitems.gperf" - {"COMPRESS", "compression"}, + {"",""}, #line 29 "envtoconfitems.gperf" {"PATH", "path"}, -#line 37 "envtoconfitems.gperf" - {"UMASK", "umask"}, {"",""}, -#line 33 "envtoconfitems.gperf" +#line 30 "envtoconfitems.gperf" + {"PREFIX", "prefix_command"}, +#line 34 "envtoconfitems.gperf" {"RECACHE", "recache"}, -#line 15 "envtoconfitems.gperf" - {"COMPRESSLEVEL", "compression_level"}, +#line 13 "envtoconfitems.gperf" + {"COMPILERCHECK", "compiler_check"}, {"",""}, -#line 38 "envtoconfitems.gperf" - {"UNIFY", "unify"}, +#line 31 "envtoconfitems.gperf" + {"PREFIX_CPP", "prefix_command_cpp"}, {"",""}, -#line 36 "envtoconfitems.gperf" +#line 37 "envtoconfitems.gperf" {"TEMPDIR", "temporary_dir"}, -#line 31 "envtoconfitems.gperf" +#line 32 "envtoconfitems.gperf" {"READONLY", "read_only"}, #line 20 "envtoconfitems.gperf" {"EXTENSION", "cpp_extension"}, -#line 34 "envtoconfitems.gperf" - {"SLOPPINESS", "sloppiness"}, -#line 30 "envtoconfitems.gperf" - {"PREFIX", "prefix_command"}, -#line 25 "envtoconfitems.gperf" - {"LOGFILE", "log_file"}, -#line 13 "envtoconfitems.gperf" - {"COMPILERCHECK", "compiler_check"}, +#line 36 "envtoconfitems.gperf" + {"STATS", "stats"}, {"",""}, -#line 32 "envtoconfitems.gperf" +#line 23 "envtoconfitems.gperf" + {"HASHDIR", "hash_dir"}, +#line 14 "envtoconfitems.gperf" + {"COMPRESS", "compression"}, + {"",""}, +#line 33 "envtoconfitems.gperf" {"READONLY_DIRECT", "read_only_direct"}, {"",""}, +#line 11 "envtoconfitems.gperf" + {"BASEDIR", "base_dir"}, +#line 15 "envtoconfitems.gperf" + {"COMPRESSLEVEL", "compression_level"}, + {"",""}, +#line 21 "envtoconfitems.gperf" + {"EXTRAFILES", "extra_files_to_hash"}, + {"",""}, #line 27 "envtoconfitems.gperf" {"MAXSIZE", "max_size"}, #line 26 "envtoconfitems.gperf" {"MAXFILES", "max_files"}, - {"",""}, {"",""}, {"",""}, -#line 23 "envtoconfitems.gperf" - {"HASHDIR", "hash_dir"}, + {"",""}, +#line 38 "envtoconfitems.gperf" + {"UMASK", "umask"}, + {"",""}, +#line 25 "envtoconfitems.gperf" + {"LOGFILE", "log_file"}, #line 22 "envtoconfitems.gperf" {"HARDLINK", "hard_link"}, - {"",""}, {"",""}, {"",""}, -#line 11 "envtoconfitems.gperf" - {"BASEDIR", "base_dir"}, -#line 24 "envtoconfitems.gperf" - {"IGNOREHEADERS", "ignore_headers_in_manifest"}, {"",""}, -#line 21 "envtoconfitems.gperf" - {"EXTRAFILES", "extra_files_to_hash"}, +#line 35 "envtoconfitems.gperf" + {"SLOPPINESS", "sloppiness"}, {"",""}, #line 28 "envtoconfitems.gperf" - {"NLEVELS", "cache_dir_levels"} + {"NLEVELS", "cache_dir_levels"}, +#line 24 "envtoconfitems.gperf" + {"IGNOREHEADERS", "ignore_headers_in_manifest"} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) @@ -192,4 +198,4 @@ envtoconfitems_get (register const char *str, register unsigned int len) } return 0; } -static const size_t ENVTOCONFITEMS_TOTAL_KEYWORDS = 28; +static const size_t ENVTOCONFITEMS_TOTAL_KEYWORDS = 29; diff --git a/test.sh b/test.sh index 7038e4fa1..c2ae3cc5b 100755 --- a/test.sh +++ b/test.sh @@ -37,6 +37,7 @@ unset CCACHE_NODIRECT unset CCACHE_NOSTATS unset CCACHE_PATH unset CCACHE_PREFIX +unset CCACHE_PREFIX_CPP unset CCACHE_READONLY unset CCACHE_READONLY_DIRECT unset CCACHE_RECACHE @@ -2433,6 +2434,14 @@ b" checkstat 'cache miss' 1 checkfile prefix.result "a b" + + rm -f prefix.result + PATH=.:$PATH CCACHE_PREFIX_CPP="prefix-a prefix-b" $CCACHE $COMPILER -c file.c + checkstat 'cache hit (direct)' 0 + checkstat 'cache hit (preprocessed)' 2 + checkstat 'cache miss' 1 + checkfile prefix.result "a +b" } ###################################################################### diff --git a/test/test_conf.c b/test/test_conf.c index 57dab354b..d6e3bc32a 100644 --- a/test/test_conf.c +++ b/test/test_conf.c @@ -20,7 +20,7 @@ #include "test/framework.h" #include "test/util.h" -#define N_CONFIG_ITEMS 28 +#define N_CONFIG_ITEMS 29 static struct { char *descr; const char *origin; @@ -70,6 +70,7 @@ TEST(conf_create) CHECK_INT_EQ((uint64_t)5 * 1000 * 1000 * 1000, conf->max_size); CHECK_STR_EQ("", conf->path); CHECK_STR_EQ("", conf->prefix_command); + CHECK_STR_EQ("", conf->prefix_command_cpp); CHECK(!conf->read_only); CHECK(!conf->read_only_direct); CHECK(!conf->recache); @@ -114,6 +115,7 @@ TEST(conf_read_valid_config) "max_size = 123M\n" "path = $USER.x\n" "prefix_command = x$USER\n" + "prefix_command_cpp = y\n" "read_only = true\n" "read_only_direct = true\n" "recache = true\n" @@ -145,6 +147,7 @@ TEST(conf_read_valid_config) CHECK_INT_EQ(123 * 1000 * 1000, conf->max_size); CHECK_STR_EQ_FREE1(format("%s.x", user), conf->path); CHECK_STR_EQ_FREE1(format("x%s", user), conf->prefix_command); + CHECK_STR_EQ("y", conf->prefix_command_cpp); CHECK(conf->read_only); CHECK(conf->read_only_direct); CHECK(conf->recache); @@ -368,6 +371,7 @@ TEST(conf_print_items) 98.7 * 1000 * 1000, "p", "pc", + "pcc", true, true, true, @@ -410,6 +414,7 @@ TEST(conf_print_items) CHECK_STR_EQ("max_size = 98.7M", received_conf_items[n++].descr); CHECK_STR_EQ("path = p", received_conf_items[n++].descr); CHECK_STR_EQ("prefix_command = pc", received_conf_items[n++].descr); + CHECK_STR_EQ("prefix_command_cpp = pcc", received_conf_items[n++].descr); CHECK_STR_EQ("read_only = true", received_conf_items[n++].descr); CHECK_STR_EQ("read_only_direct = true", received_conf_items[n++].descr); CHECK_STR_EQ("recache = true", received_conf_items[n++].descr); -- 2.47.2