* <<config_direct_mode,*direct_mode*>> is false
* 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 compiler option not supported by the direct mode is used, for example:
** a `-Wp,++*++` compiler option other than `-Wp,-MD,<path>`, `-Wp,-MMD,<path>`,
`-Wp,-D<macro[=defn]>` or `-Wp,-U<macro>`
-** `-Xpreprocessor`
+** most uses of `-Xpreprocessor`
* the string `+__TIME__+` is present in the source code
config.set_direct_mode(false);
}
+ // Handle -Xpreprocessor options.
+ if (util::starts_with(arg, "-Xpreprocessor")) {
+ if (i == args.size() - 1) {
+ LOG("Missing argument to {}", args[i]);
+ return Statistic::bad_compiler_arguments;
+ }
+ if (args[i + 1] == "-fopenmp") {
+ ++i;
+ return Statistic::none;
+ } else {
+ LOG("Unsupported compiler option for direct mode: {} {}",
+ args[i],
+ args[i + 1]);
+ config.set_direct_mode(false);
+ }
+ }
+
// Handle -Xarch_* options.
if (util::starts_with(arg, "-Xarch_")) {
if (i == args.size() - 1) {
{"-Xclang", TAKES_ARG},
{"-Xcompiler", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"-Xlinker", TAKES_ARG | TAKES_CONCAT_ARG | AFFECTS_COMP},
- {"-Xpreprocessor", AFFECTS_CPP | TOO_HARD_DIRECT | TAKES_ARG},
+ {"-Xpreprocessor", AFFECTS_CPP | TAKES_ARG},
{"-Yc", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH}, // msvc
{"-Yu", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH}, // msvc
{"-all_load", AFFECTS_COMP},
TEST_CASE("too_hard_for_direct_mode")
{
- CHECK(compopt_too_hard_for_direct_mode("-Xpreprocessor"));
CHECK(!compopt_too_hard_for_direct_mode("-nostdinc"));
}