}
// Detect PCH for options with concatenated path (relative or absolute).
- if (util::starts_with(args[i], "-Fp") || util::starts_with(args[i], "-Yu")) {
- const size_t path_pos = 3;
+ if (util::starts_with(args[i], "-include")
+ || util::starts_with(args[i], "-Fp")
+ || util::starts_with(args[i], "-Yu")) {
+ const size_t path_pos = util::starts_with(args[i], "-include") ? 8 : 3;
if (!detect_pch(args[i].substr(0, path_pos),
args[i].substr(path_pos),
args_info.included_pch_file,
expect_stat preprocessor_error 1
# -------------------------------------------------------------------------
- TEST "Use .gch, -include, no sloppiness"
-
- $COMPILER $SYSROOT -c pch.h
- backdate pch.h.gch
-
- $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c
- expect_stat direct_cache_hit 0
- expect_stat preprocessed_cache_hit 0
- expect_stat cache_miss 0
- # Must enable sloppy time macros:
- expect_stat could_not_use_precompiled_header 1
+ include_pch_variants=(
+ "-include pch.h"
+ "-includepch.h"
+ )
+ for args in "${include_pch_variants[@]}"; do
+ TEST "Use .gch, $args, no sloppiness"
+
+ $COMPILER $SYSROOT -c pch.h
+ backdate pch.h.gch
+
+ $CCACHE_COMPILE $SYSROOT -c $args pch2.c
+ expect_stat direct_cache_hit 0
+ expect_stat preprocessed_cache_hit 0
+ expect_stat cache_miss 0
+ # Must enable sloppy time macros:
+ expect_stat could_not_use_precompiled_header 1
+ done
# -------------------------------------------------------------------------
TEST "Use .gch, -include"