From: Joel Rosdahl Date: Wed, 18 Jan 2023 20:34:00 +0000 (+0100) Subject: feat: Add support for -Wp,-U in direct mode X-Git-Tag: v4.8~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb75cdaae0aab357b41c2a892fa3b0b5f8424485;p=thirdparty%2Fccache.git feat: Add support for -Wp,-U in direct mode --- diff --git a/doc/MANUAL.adoc b/doc/MANUAL.adoc index b6d52f1ad..b8cd4179b 100644 --- a/doc/MANUAL.adoc +++ b/doc/MANUAL.adoc @@ -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,`, `-Wp,-MMD,` - and `-Wp,-D` +** a `-Wp,++*++` compiler option other than `-Wp,-MD,`, `-Wp,-MMD,`, + `-Wp,-D` or `-Wp,-U` ** `-Xpreprocessor` * the string `+__TIME__+` is present in the source code diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index 80905b36c..9bb1d38bb 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -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; diff --git a/test/suites/direct.bash b/test/suites/direct.bash index a9dc9c5e3..c21969be7 100644 --- a/test/suites/direct.bash +++ b/test/suites/direct.bash @@ -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"