// GCC
if (str_eq(argv[i], "-fdirectives-only")) {
found_directives_only = true;
+ continue;
}
// Clang
if (str_eq(argv[i], "-frewrite-includes")) {
found_rewrite_includes = true;
+ continue;
}
// Options taking an argument that we may want to rewrite to relative paths
} else if (found_directives_only || found_rewrite_includes) {
// Need to pass the macros and any other preprocessor directives again
args_extend(*compiler_args, cpp_args);
+ if (found_directives_only) {
+ args_add(cpp_args, "-fdirectives-only");
+ // The preprocessed source code still needs some more preprocessing
+ args_add(*compiler_args, "-fpreprocessed");
+ args_add(*compiler_args, "-fdirectives-only");
+ }
if (found_rewrite_includes) {
+ args_add(cpp_args, "-frewrite-includes");
// The preprocessed source code still needs some more preprocessing
args_add(*compiler_args, "-x");
args_add(*compiler_args, actual_language);