]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add option handling code for `depend_mode`
authorGeert Kloosterman <geert.kloosterman@brightcomputing.com>
Wed, 4 Apr 2018 19:26:34 +0000 (21:26 +0200)
committerGeert Kloosterman <geert.kloosterman@brightcomputing.com>
Wed, 4 Apr 2018 19:26:34 +0000 (21:26 +0200)
Only code for the option itself, the option is not being used yet.

src/conf.c
src/conf.h
src/confitems.gperf
src/confitems_lookup.c
src/envtoconfitems.gperf
src/envtoconfitems_lookup.c
unittest/test_conf.c

index fbc06af77d100ecc3ad84bc5320479acd92c195f..9eb0b0371c8abdfd0baa689e84142ef9072aad76 100644 (file)
@@ -328,6 +328,7 @@ conf_create(void)
        conf->compression = false;
        conf->compression_level = 6;
        conf->cpp_extension = x_strdup("");
+       conf->depend_mode = false;
        conf->direct_mode = true;
        conf->disable = false;
        conf->extra_files_to_hash = x_strdup("");
@@ -564,6 +565,9 @@ conf_print_items(struct conf *conf,
        reformat(&s, "cpp_extension = %s", conf->cpp_extension);
        printer(s, conf->item_origins[find_conf("cpp_extension")->number], context);
 
+       reformat(&s, "depend_mode = %s", bool_to_string(conf->depend_mode));
+       printer(s, conf->item_origins[find_conf("depend_mode")->number], context);
+
        reformat(&s, "direct_mode = %s", bool_to_string(conf->direct_mode));
        printer(s, conf->item_origins[find_conf("direct_mode")->number], context);
 
index 3ea756c739dfcce6fa826ac7f2ebe0ddd7f876b1..0109665e7e1cf942fe7a5b0d62f7753100378439 100644 (file)
@@ -12,6 +12,7 @@ struct conf {
        bool compression;
        unsigned compression_level;
        char *cpp_extension;
+       bool depend_mode;
        bool direct_mode;
        bool disable;
        char *extra_files_to_hash;
index eef78c5f92e36152e6bc021ffd31dbf467bcf743..e324e544fdc7f03867b1b775c034001930040415 100644 (file)
@@ -15,27 +15,28 @@ compiler_check,       4, ITEM(compiler_check, string)
 compression,          5, ITEM(compression, bool)
 compression_level,    6, ITEM(compression_level, unsigned)
 cpp_extension,        7, ITEM(cpp_extension, string)
-direct_mode,          8, ITEM(direct_mode, bool)
-disable,              9, ITEM(disable, bool)
-extra_files_to_hash, 10, ITEM(extra_files_to_hash, env_string)
-hard_link,           11, ITEM(hard_link, bool)
-hash_dir,            12, ITEM(hash_dir, bool)
-ignore_headers_in_manifest, 13, ITEM(ignore_headers_in_manifest, env_string)
-keep_comments_cpp,   14, ITEM(keep_comments_cpp, bool)
-limit_multiple,      15, ITEM(limit_multiple, float)
-log_file,            16, ITEM(log_file, env_string)
-max_files,           17, ITEM(max_files, unsigned)
-max_size,            18, ITEM(max_size, size)
-path,                19, ITEM(path, env_string)
-pch_external_checksum, 20, ITEM(pch_external_checksum, bool)
-prefix_command,      21, ITEM(prefix_command, env_string)
-prefix_command_cpp,  22, ITEM(prefix_command_cpp, env_string)
-read_only,           23, ITEM(read_only, bool)
-read_only_direct,    24, ITEM(read_only_direct, bool)
-recache,             25, ITEM(recache, bool)
-run_second_cpp,      26, ITEM(run_second_cpp, bool)
-sloppiness,          27, ITEM(sloppiness, sloppiness)
-stats,               28, ITEM(stats, bool)
-temporary_dir,       29, ITEM(temporary_dir, env_string)
-umask,               30, ITEM(umask, umask)
-unify,               31, ITEM(unify, bool)
+depend_mode,          8, ITEM(depend_mode, bool)
+direct_mode,          9, ITEM(direct_mode, bool)
+disable,             10, ITEM(disable, bool)
+extra_files_to_hash, 11, ITEM(extra_files_to_hash, env_string)
+hard_link,           12, ITEM(hard_link, bool)
+hash_dir,            13, ITEM(hash_dir, bool)
+ignore_headers_in_manifest, 14, ITEM(ignore_headers_in_manifest, env_string)
+keep_comments_cpp,   15, ITEM(keep_comments_cpp, bool)
+limit_multiple,      16, ITEM(limit_multiple, float)
+log_file,            17, ITEM(log_file, env_string)
+max_files,           18, ITEM(max_files, unsigned)
+max_size,            19, ITEM(max_size, size)
+path,                20, ITEM(path, env_string)
+pch_external_checksum, 21, ITEM(pch_external_checksum, bool)
+prefix_command,      22, ITEM(prefix_command, env_string)
+prefix_command_cpp,  23, ITEM(prefix_command_cpp, env_string)
+read_only,           24, ITEM(read_only, bool)
+read_only_direct,    25, ITEM(read_only_direct, bool)
+recache,             26, ITEM(recache, bool)
+run_second_cpp,      27, ITEM(run_second_cpp, bool)
+sloppiness,          28, ITEM(sloppiness, sloppiness)
+stats,               29, ITEM(stats, bool)
+temporary_dir,       30, ITEM(temporary_dir, env_string)
+umask,               31, ITEM(umask, umask)
+unify,               32, ITEM(unify, bool)
index 04458d225dbf25c9b0e3428d7aab30c0bed30cb1..f40ed264e937dfdd191b5b5dc22595b612cbb96f 100644 (file)
@@ -87,7 +87,7 @@ confitems_get (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 32,
+      TOTAL_KEYWORDS = 33,
       MIN_WORD_LENGTH = 4,
       MAX_WORD_LENGTH = 26,
       MIN_HASH_VALUE = 4,
@@ -98,8 +98,8 @@ confitems_get (register const char *str, register unsigned int len)
     {
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
-#line 29 "src/confitems.gperf"
-      {"path",                19, ITEM(path, env_string)},
+#line 30 "src/confitems.gperf"
+      {"path",                20, ITEM(path, env_string)},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
       {"",0,NULL,0,NULL},
 #line 13 "src/confitems.gperf"
@@ -114,65 +114,66 @@ confitems_get (register const char *str, register unsigned int len)
       {"cpp_extension",        7, ITEM(cpp_extension, string)},
 #line 14 "src/confitems.gperf"
       {"compiler_check",       4, ITEM(compiler_check, string)},
-#line 38 "src/confitems.gperf"
-      {"stats",               28, ITEM(stats, bool)},
+#line 39 "src/confitems.gperf"
+      {"stats",               29, ITEM(stats, bool)},
 #line 12 "src/confitems.gperf"
       {"cache_dir_levels",     2, ITEM_V(cache_dir_levels, unsigned, dir_levels)},
 #line 16 "src/confitems.gperf"
       {"compression_level",    6, ITEM(compression_level, unsigned)},
-#line 26 "src/confitems.gperf"
-      {"log_file",            16, ITEM(log_file, env_string)},
-#line 31 "src/confitems.gperf"
-      {"prefix_command",      21, ITEM(prefix_command, env_string)},
-#line 37 "src/confitems.gperf"
-      {"sloppiness",          27, ITEM(sloppiness, sloppiness)},
-#line 30 "src/confitems.gperf"
-      {"pch_external_checksum", 20, ITEM(pch_external_checksum, bool)},
-#line 35 "src/confitems.gperf"
-      {"recache",             25, ITEM(recache, bool)},
+#line 27 "src/confitems.gperf"
+      {"log_file",            17, ITEM(log_file, env_string)},
 #line 32 "src/confitems.gperf"
-      {"prefix_command_cpp",  22, ITEM(prefix_command_cpp, env_string)},
+      {"prefix_command",      22, ITEM(prefix_command, env_string)},
+#line 38 "src/confitems.gperf"
+      {"sloppiness",          28, ITEM(sloppiness, sloppiness)},
+#line 31 "src/confitems.gperf"
+      {"pch_external_checksum", 21, ITEM(pch_external_checksum, bool)},
+#line 36 "src/confitems.gperf"
+      {"recache",             26, ITEM(recache, bool)},
 #line 33 "src/confitems.gperf"
-      {"read_only",           23, ITEM(read_only, bool)},
-#line 41 "src/confitems.gperf"
-      {"unify",               31, ITEM(unify, bool)},
-      {"",0,NULL,0,NULL},
-#line 24 "src/confitems.gperf"
-      {"keep_comments_cpp",   14, ITEM(keep_comments_cpp, bool)},
+      {"prefix_command_cpp",  23, ITEM(prefix_command_cpp, env_string)},
+#line 34 "src/confitems.gperf"
+      {"read_only",           24, ITEM(read_only, bool)},
+#line 42 "src/confitems.gperf"
+      {"unify",               32, ITEM(unify, bool)},
+#line 18 "src/confitems.gperf"
+      {"depend_mode",          8, ITEM(depend_mode, bool)},
+#line 25 "src/confitems.gperf"
+      {"keep_comments_cpp",   15, ITEM(keep_comments_cpp, bool)},
+#line 29 "src/confitems.gperf"
+      {"max_size",            19, ITEM(max_size, size)},
 #line 28 "src/confitems.gperf"
-      {"max_size",            18, ITEM(max_size, size)},
-#line 27 "src/confitems.gperf"
-      {"max_files",           17, ITEM(max_files, unsigned)},
+      {"max_files",           18, ITEM(max_files, unsigned)},
       {"",0,NULL,0,NULL},
-#line 34 "src/confitems.gperf"
-      {"read_only_direct",    24, ITEM(read_only_direct, bool)},
-#line 19 "src/confitems.gperf"
-      {"disable",              9, ITEM(disable, bool)},
-#line 39 "src/confitems.gperf"
-      {"temporary_dir",       29, ITEM(temporary_dir, env_string)},
-#line 36 "src/confitems.gperf"
-      {"run_second_cpp",      26, ITEM(run_second_cpp, bool)},
+#line 35 "src/confitems.gperf"
+      {"read_only_direct",    25, ITEM(read_only_direct, bool)},
+#line 20 "src/confitems.gperf"
+      {"disable",             10, ITEM(disable, bool)},
+#line 40 "src/confitems.gperf"
+      {"temporary_dir",       30, ITEM(temporary_dir, env_string)},
+#line 37 "src/confitems.gperf"
+      {"run_second_cpp",      27, ITEM(run_second_cpp, bool)},
       {"",0,NULL,0,NULL},
-#line 18 "src/confitems.gperf"
-      {"direct_mode",          8, ITEM(direct_mode, bool)},
+#line 19 "src/confitems.gperf"
+      {"direct_mode",          9, ITEM(direct_mode, bool)},
       {"",0,NULL,0,NULL},
+#line 23 "src/confitems.gperf"
+      {"hash_dir",            13, ITEM(hash_dir, bool)},
 #line 22 "src/confitems.gperf"
-      {"hash_dir",            12, ITEM(hash_dir, bool)},
-#line 21 "src/confitems.gperf"
-      {"hard_link",           11, ITEM(hard_link, bool)},
-#line 40 "src/confitems.gperf"
-      {"umask",               30, ITEM(umask, umask)},
+      {"hard_link",           12, ITEM(hard_link, bool)},
+#line 41 "src/confitems.gperf"
+      {"umask",               31, ITEM(umask, umask)},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
 #line 10 "src/confitems.gperf"
       {"base_dir",             0, ITEM_V(base_dir, env_string, absolute_path)},
-#line 25 "src/confitems.gperf"
-      {"limit_multiple",      15, ITEM(limit_multiple, float)},
+#line 26 "src/confitems.gperf"
+      {"limit_multiple",      16, ITEM(limit_multiple, float)},
       {"",0,NULL,0,NULL},
-#line 23 "src/confitems.gperf"
-      {"ignore_headers_in_manifest", 13, ITEM(ignore_headers_in_manifest, env_string)},
+#line 24 "src/confitems.gperf"
+      {"ignore_headers_in_manifest", 14, ITEM(ignore_headers_in_manifest, env_string)},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
-#line 20 "src/confitems.gperf"
-      {"extra_files_to_hash", 10, ITEM(extra_files_to_hash, env_string)}
+#line 21 "src/confitems.gperf"
+      {"extra_files_to_hash", 11, ITEM(extra_files_to_hash, env_string)}
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -189,4 +190,4 @@ confitems_get (register const char *str, register unsigned int len)
     }
   return 0;
 }
-static const size_t CONFITEMS_TOTAL_KEYWORDS = 32;
+static const size_t CONFITEMS_TOTAL_KEYWORDS = 33;
index 47abe5e625fb8ce90d62570457e3648e869ab542..af537dd0361b30fb3ef1f90e4170d200005aaaf6 100644 (file)
@@ -16,6 +16,7 @@ COMPRESS, "compression"
 COMPRESSLEVEL, "compression_level"
 CPP2, "run_second_cpp"
 COMMENTS, "keep_comments_cpp"
+DEPEND, "depend_mode"
 DIR, "cache_dir"
 DIRECT, "direct_mode"
 DISABLE, "disable"
index 16a905f93587efd6b60ce24dff45d7005f8b667e..84acb92fbf6893b1bb702af095d7d52d123c1ec3 100644 (file)
@@ -51,10 +51,10 @@ envtoconfitems_hash (register const char *str, register unsigned int len)
       54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
       54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
        0, 54, 54, 54, 54, 54, 54, 54, 54, 54,
-      54, 54, 54, 54, 54, 25, 10,  0,  0, 15,
-      10, 54,  5,  0, 54, 10, 35, 15,  0, 25,
-       0, 54, 15, 20,  0, 54, 15, 54, 54,  0,
-      54, 54, 54, 54, 54,  5, 54, 54, 54, 54,
+      54, 54, 54, 54, 54, 25, 10,  0,  0,  5,
+      10, 54, 15,  0, 54, 10, 35, 25, 10, 25,
+       0, 54, 15, 20,  0, 54, 25, 54, 54, 15,
+      54, 54, 54, 54, 54,  0, 54, 54, 54, 54,
       54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
       54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
       54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
@@ -101,7 +101,7 @@ envtoconfitems_get (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 33,
+      TOTAL_KEYWORDS = 34,
       MIN_WORD_LENGTH = 2,
       MAX_WORD_LENGTH = 15,
       MIN_HASH_VALUE = 2,
@@ -113,81 +113,82 @@ envtoconfitems_get (register const char *str, register unsigned int len)
       {"",""}, {"",""},
 #line 12 "src/envtoconfitems.gperf"
       {"CC", "compiler"},
-#line 19 "src/envtoconfitems.gperf"
+#line 20 "src/envtoconfitems.gperf"
       {"DIR", "cache_dir"},
 #line 17 "src/envtoconfitems.gperf"
       {"CPP2", "run_second_cpp"},
       {"",""}, {"",""},
-#line 41 "src/envtoconfitems.gperf"
+#line 42 "src/envtoconfitems.gperf"
       {"TEMPDIR", "temporary_dir"},
 #line 13 "src/envtoconfitems.gperf"
       {"COMPILER", "compiler"},
-#line 32 "src/envtoconfitems.gperf"
-      {"PATH", "path"},
-#line 39 "src/envtoconfitems.gperf"
-      {"SLOPPINESS", "sloppiness"},
       {"",""},
-#line 25 "src/envtoconfitems.gperf"
-      {"HASHDIR", "hash_dir"},
+#line 40 "src/envtoconfitems.gperf"
+      {"SLOPPINESS", "sloppiness"},
+#line 21 "src/envtoconfitems.gperf"
+      {"DIRECT", "direct_mode"},
+#line 11 "src/envtoconfitems.gperf"
+      {"BASEDIR", "base_dir"},
 #line 14 "src/envtoconfitems.gperf"
       {"COMPILERCHECK", "compiler_check"},
-#line 27 "src/envtoconfitems.gperf"
+#line 28 "src/envtoconfitems.gperf"
       {"LIMIT_MULTIPLE", "limit_multiple"},
-#line 43 "src/envtoconfitems.gperf"
-      {"UNIFY", "unify"},
 #line 34 "src/envtoconfitems.gperf"
+      {"PCH_EXTSUM", "pch_external_checksum"},
+#line 35 "src/envtoconfitems.gperf"
       {"PREFIX", "prefix_command"},
-#line 28 "src/envtoconfitems.gperf"
-      {"LOGFILE", "log_file"},
 #line 29 "src/envtoconfitems.gperf"
+      {"LOGFILE", "log_file"},
+#line 30 "src/envtoconfitems.gperf"
       {"MAXFILES", "max_files"},
-      {"",""},
-#line 35 "src/envtoconfitems.gperf"
+#line 33 "src/envtoconfitems.gperf"
+      {"PATH", "path"},
+#line 36 "src/envtoconfitems.gperf"
       {"PREFIX_CPP", "prefix_command_cpp"},
-#line 20 "src/envtoconfitems.gperf"
-      {"DIRECT", "direct_mode"},
-#line 11 "src/envtoconfitems.gperf"
-      {"BASEDIR", "base_dir"},
+#line 19 "src/envtoconfitems.gperf"
+      {"DEPEND", "depend_mode"},
+#line 26 "src/envtoconfitems.gperf"
+      {"HASHDIR", "hash_dir"},
 #line 15 "src/envtoconfitems.gperf"
       {"COMPRESS", "compression"},
-#line 22 "src/envtoconfitems.gperf"
+#line 23 "src/envtoconfitems.gperf"
       {"EXTENSION", "cpp_extension"},
-#line 40 "src/envtoconfitems.gperf"
+#line 41 "src/envtoconfitems.gperf"
       {"STATS", "stats"},
       {"",""},
-#line 30 "src/envtoconfitems.gperf"
+#line 31 "src/envtoconfitems.gperf"
       {"MAXSIZE", "max_size"},
 #line 16 "src/envtoconfitems.gperf"
       {"COMPRESSLEVEL", "compression_level"},
       {"",""},
-#line 33 "src/envtoconfitems.gperf"
-      {"PCH_EXTSUM", "pch_external_checksum"},
+#line 44 "src/envtoconfitems.gperf"
+      {"UNIFY", "unify"},
       {"",""},
-#line 38 "src/envtoconfitems.gperf"
+#line 39 "src/envtoconfitems.gperf"
       {"RECACHE", "recache"},
-#line 36 "src/envtoconfitems.gperf"
+#line 37 "src/envtoconfitems.gperf"
       {"READONLY", "read_only"},
       {"",""},
-#line 42 "src/envtoconfitems.gperf"
+#line 43 "src/envtoconfitems.gperf"
       {"UMASK", "umask"},
       {"",""},
-#line 31 "src/envtoconfitems.gperf"
+#line 32 "src/envtoconfitems.gperf"
       {"NLEVELS", "cache_dir_levels"},
 #line 18 "src/envtoconfitems.gperf"
       {"COMMENTS", "keep_comments_cpp"},
       {"",""},
-#line 37 "src/envtoconfitems.gperf"
+#line 38 "src/envtoconfitems.gperf"
       {"READONLY_DIRECT", "read_only_direct"},
       {"",""},
-#line 21 "src/envtoconfitems.gperf"
+#line 22 "src/envtoconfitems.gperf"
       {"DISABLE", "disable"},
-#line 24 "src/envtoconfitems.gperf"
+#line 25 "src/envtoconfitems.gperf"
       {"HARDLINK", "hard_link"},
       {"",""}, {"",""}, {"",""}, {"",""}, {"",""}, {"",""},
-#line 23 "src/envtoconfitems.gperf"
+#line 24 "src/envtoconfitems.gperf"
       {"EXTRAFILES", "extra_files_to_hash"},
       {"",""}, {"",""},
-#line 26 "src/envtoconfitems.gperf"
+#line 27 "src/envtoconfitems.gperf"
       {"IGNOREHEADERS", "ignore_headers_in_manifest"}
     };
 
@@ -205,4 +206,4 @@ envtoconfitems_get (register const char *str, register unsigned int len)
     }
   return 0;
 }
-static const size_t ENVTOCONFITEMS_TOTAL_KEYWORDS = 33;
+static const size_t ENVTOCONFITEMS_TOTAL_KEYWORDS = 34;
index a3ded426069113f703b7b525ab3ea92fc22f6a76..199ece27595c7a4ce825665f90137bed88428df1 100644 (file)
@@ -18,7 +18,7 @@
 #include "framework.h"
 #include "util.h"
 
-#define N_CONFIG_ITEMS 32
+#define N_CONFIG_ITEMS 33
 static struct {
        char *descr;
        const char *origin;
@@ -57,6 +57,7 @@ TEST(conf_create)
        CHECK(!conf->compression);
        CHECK_INT_EQ(6, conf->compression_level);
        CHECK_STR_EQ("", conf->cpp_extension);
+       CHECK(!conf->depend_mode);
        CHECK(conf->direct_mode);
        CHECK(!conf->disable);
        CHECK_STR_EQ("", conf->extra_files_to_hash);
@@ -109,6 +110,7 @@ TEST(conf_read_valid_config)
          "compression=true\n"
          "compression_level= 2\n"
          "cpp_extension = .foo\n"
+         "depend_mode = true\n"
          "direct_mode = false\n"
          "disable = true\n"
          "extra_files_to_hash = a:b c:$USER\n"
@@ -148,6 +150,7 @@ TEST(conf_read_valid_config)
        CHECK(conf->compression);
        CHECK_INT_EQ(2, conf->compression_level);
        CHECK_STR_EQ(".foo", conf->cpp_extension);
+       CHECK(conf->depend_mode);
        CHECK(!conf->direct_mode);
        CHECK(conf->disable);
        CHECK_STR_EQ_FREE1(format("a:b c:%s", user), conf->extra_files_to_hash);
@@ -377,6 +380,7 @@ TEST(conf_print_items)
                true,
                8,
                "ce",
+               true,
                false,
                true,
                "efth",
@@ -427,6 +431,7 @@ TEST(conf_print_items)
        CHECK_STR_EQ("compression = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("compression_level = 8", received_conf_items[n++].descr);
        CHECK_STR_EQ("cpp_extension = ce", received_conf_items[n++].descr);
+       CHECK_STR_EQ("depend_mode = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("direct_mode = false", received_conf_items[n++].descr);
        CHECK_STR_EQ("disable = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("extra_files_to_hash = efth", received_conf_items[n++].descr);