Fixes #1238.
-// 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.
//
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")
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 "--"
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"