]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add prefix option for precompiler too
authorAnders Björklund <anders@itension.se>
Wed, 4 Nov 2015 21:58:25 +0000 (22:58 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 14 Jan 2016 20:54:23 +0000 (21:54 +0100)
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
ccache.c
conf.c
conf.h
confitems.gperf
confitems_lookup.c
envtoconfitems.gperf
envtoconfitems_lookup.c
test.sh
test/test_conf.c

index 10a654275063a7cabf379a9cf5cbb886c1d2b3b8..9852cb372f42176e796c0f8d77aad91511615db8 100644 (file)
@@ -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
index 3b1d4d08cd802c5bd9d1bb982ddccbdb6e02cd2b..efaedfba8d0a1ce2dff1e6d6e41b991f05d59932 100644 (file)
--- 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 cf65c08b94fe2198d817cd94b086976421923bec..8ab60c3915fb784657ea6714313f41db3aff7986 100644 (file)
--- 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 df0ac98e9da21d8d765b23a38840765887b7b37c..238cb8d949f0483ef55c832e332a21ec2a1a5b1c 100644 (file)
--- 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;
index 3f092069601e149fc2cafed79564a1f6bdd02263..d7041992bc2bbd26cfceb44fc628572853fc1994 100644 (file)
@@ -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)
index 539f8601a77bbf47166c836f5a64f673892caeee..dc4eb43d7aa744b84db81456f1404bafd3159ecc 100644 (file)
@@ -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;
index 340e71555790da213a72c2d8150448d45d0dd34f..a3808aa7ba25ecfcf410ca0d8207ac9015ca752d 100644 (file)
@@ -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"
index 2d9a33e08a725052ec39b6ce1609cb41ab829c3e..0b6357fe3c1af75d86bdf0bbce0e4731bdcf1365 100644 (file)
@@ -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 7038e4fa102c8e12b6f6c36ef293b5aad9921649..c2ae3cc5bd97d86b679f199068d892332ba882ad 100755 (executable)
--- 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"
 }
 
 ######################################################################
index 57dab354be15443082e0b9b9b9112ce65af7ffa6..d6e3bc32af1718ad3de762011f3532306131fe33 100644 (file)
@@ -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);