diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2023-01-18 21:30:25 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2023-01-18 22:00:59 +0100 |
commit | 00fe1341235fd3fa755b0044f14de324097e3dc9 (patch) | |
tree | 9b3f5c89f60197e7c1cdd66898e635424c5366b7 | |
parent | debf622f16227c5a5a8824f4b15bcde4b9159c97 (diff) | |
download | ccache-00fe1341235fd3fa755b0044f14de324097e3dc9.tar.gz |
fix: Don't treat -Wp,-D as interchangeable with -D
Fixes #1238.
-rw-r--r-- | src/argprocessing.cpp | 5 | ||||
-rw-r--r-- | test/suites/base.bash | 12 | ||||
-rw-r--r-- | test/suites/direct.bash | 12 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/argprocessing.cpp b/src/argprocessing.cpp index 0bc37e57..80905b36 100644 --- a/src/argprocessing.cpp +++ b/src/argprocessing.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2022 Joel Rosdahl and other contributors +// Copyright (C) 2020-2023 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -817,8 +817,7 @@ process_option_arg(const Context& ctx, return Statistic::none; } else if (util::starts_with(args[i], "-Wp,-D") && args[i].find(',', 6) == std::string::npos) { - // Treat it like -D. - state.cpp_args.push_back(args[i].substr(4)); + state.cpp_args.push_back(args[i]); return Statistic::none; } else if (args[i] == "-Wp,-MP" || (args[i].size() > 8 && util::starts_with(args[i], "-Wp,-M") diff --git a/test/suites/base.bash b/test/suites/base.bash index 2bb8d349..ff905942 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -1520,11 +1520,21 @@ EOF expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 - $CCACHE_COMPILE -c -DFOO test1.c + $CCACHE_COMPILE -c -Wp,-DFOO test1.c expect_stat direct_cache_hit 0 expect_stat preprocessed_cache_hit 1 expect_stat cache_miss 1 + $CCACHE_COMPILE -c -DFOO test1.c + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + + $CCACHE_COMPILE -c -DFOO test1.c + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 + # ------------------------------------------------------------------------- if touch empty.c && $COMPILER -c -- empty.c 2>/dev/null; then TEST "--" diff --git a/test/suites/direct.bash b/test/suites/direct.bash index e297d688..a9dc9c5e 100644 --- a/test/suites/direct.bash +++ b/test/suites/direct.bash @@ -443,11 +443,21 @@ fi expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 - $CCACHE_COMPILE -c -DFOO test.c + $CCACHE_COMPILE -c -Wp,-DFOO test.c expect_stat direct_cache_hit 1 expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 + $CCACHE_COMPILE -c -DFOO test.c + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + + $CCACHE_COMPILE -c -DFOO test.c + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + # ------------------------------------------------------------------------- TEST "-Wp, with multiple arguments" |