]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
feat: Add support for -Wp,-U<macro> in direct mode
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 18 Jan 2023 20:34:00 +0000 (21:34 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 18 Jan 2023 21:01:15 +0000 (22:01 +0100)
doc/MANUAL.adoc
src/argprocessing.cpp
test/suites/direct.bash

index b6d52f1adf9b96e38463b13f2079870673647507..b8cd4179ba6b249d4a740390aeced10147e97541 100644 (file)
@@ -1536,8 +1536,8 @@ The direct mode will be disabled if any of the following holds:
 * a modification time of one of the include files is too new (needed to avoid a
   race condition)
 * a compiler option not supported by the direct mode is used:
-** a `-Wp,++*++` compiler option other than `-Wp,-MD,<path>`, `-Wp,-MMD,<path>`
-   and `-Wp,-D<define>`
+** a `-Wp,++*++` compiler option other than `-Wp,-MD,<path>`, `-Wp,-MMD,<path>`,
+   `-Wp,-D<macro[=defn]>` or `-Wp,-U<macro>`
 ** `-Xpreprocessor`
 * the string `+__TIME__+` is present in the source code
 
index 80905b36c8421e6d6fc4d5e5a74bf2a54414c798..9bb1d38bb5c947ded0bea34852d17324c6b17558 100644 (file)
@@ -815,7 +815,8 @@ process_option_arg(const Context& ctx,
       }
       state.dep_args.push_back(args[i]);
       return Statistic::none;
-    } else if (util::starts_with(args[i], "-Wp,-D")
+    } else if ((util::starts_with(args[i], "-Wp,-D")
+                || util::starts_with(args[i], "-Wp,-U"))
                && args[i].find(',', 6) == std::string::npos) {
       state.cpp_args.push_back(args[i]);
       return Statistic::none;
index a9dc9c5e326007eb62a4f11417a9f42c6a7ace64..c21969be7a0bfe77f80e27293faf9b8041d3f9b2 100644 (file)
@@ -458,6 +458,19 @@ fi
     expect_stat preprocessed_cache_hit 0
     expect_stat cache_miss 2
 
+    # -------------------------------------------------------------------------
+    TEST "-Wp,-U"
+
+    $CCACHE_COMPILE -c -Wp,-UFOO test.c
+    expect_stat direct_cache_hit 0
+    expect_stat preprocessed_cache_hit 0
+    expect_stat cache_miss 1
+
+    $CCACHE_COMPILE -c -Wp,-UFOO test.c
+    expect_stat direct_cache_hit 1
+    expect_stat preprocessed_cache_hit 0
+    expect_stat cache_miss 1
+
     # -------------------------------------------------------------------------
     TEST "-Wp, with multiple arguments"