[qfcc] Separate preprocess only and preprocess output

-M does only preprocessing but does not generate the preprocessed output
(which is -E's job). Prevents mangled dependency files.
This commit is contained in:
Bill Currie 2023-10-31 08:42:28 +09:00
parent b3cbec7f87
commit 51f3915e12
3 changed files with 9 additions and 8 deletions

View file

@ -135,7 +135,7 @@ typedef struct {
bool compile; // serparate compilation mode
bool partial_link; // partial linking
bool preprocess_only; // run only cpp, don't compile
bool preprocess_ouput; // emit preprocessor output
bool preprocess_output; // emit preprocessor output
bool dependencies; // generate dependency rules
bool gzip; // compress qfo files when writing
const char *output_file;

View file

@ -798,7 +798,7 @@ DecodeArgs (int argc, char **argv)
if (saw_MD) {
options.preprocess_only = 0;
}
options.preprocess_ouput = saw_E;
options.preprocess_output = saw_E;
if (!source_files && !options.advanced) {
// progs.src mode without --advanced or --ruamoko implies --traditional
// but --extended overrides

View file

@ -1056,8 +1056,7 @@ next_line (rua_loc_t *loc, yyscan_t scanner)
loc->last_column = 1;
loc->last_line++;
pr.source_line++;
//printf ("\n%3d:", pr.source_line);
if (!extra->recording && options.preprocess_ouput) {
if (!extra->recording && options.preprocess_output) {
puts ("");
}
}
@ -1284,7 +1283,7 @@ qc_token (rua_extra_t *extra, int token, rua_tok_t *tok, yyscan_t *scanner)
token = parse_string (tok, -token, scanner);
break;
case rua_space:
if (options.preprocess_ouput) {
if (options.preprocess_output) {
printf (" ");
}
break;
@ -1415,8 +1414,10 @@ qc_process (rua_extra_t *extra, int token, rua_tok_t *tok, yyscan_t scanner)
return pre_yypush_parse (state, token, tok, loc, scanner);
} else {
if (!extra->suppressed) {
if (options.preprocess_ouput) {
printf ("%s", tok->text);
if (options.preprocess_only) {
if (options.preprocess_output) {
printf ("%s", tok->text);
}
return token ? YYPUSH_MORE : 0;
}
token = qc_token (extra, token, tok, scanner);
@ -1673,7 +1674,7 @@ rua_macro_arg (rua_tok_t *token, void *scanner)
void
rua_start_pragma (void *scanner)
{
if (options.preprocess_ouput) {
if (options.preprocess_output) {
printf ("#pragma");
}
yy_pop_state (scanner);