char *itemname;
char *includename;
+ bool in_macro;
} ftepp_t;
/*
size_t o, pi;
lex_file *inlex;
+ bool old_inmacro;
+
int nextok;
if (vararg_start < vec_size(params))
inlex->line = ftepp->lex->line;
inlex->sline = ftepp->lex->sline;
ftepp->lex = inlex;
- if (has_newlines)
+ if (has_newlines && !ftepp->in_macro)
ftepp_recursion_header(ftepp);
+ old_inmacro = ftepp->in_macro;
+ ftepp->in_macro = true;
if (!ftepp_preprocess(ftepp)) {
+ ftepp->in_macro = old_inmacro;
vec_free(ftepp->lex->open_string);
old_string = ftepp->output_string;
lex_close(ftepp->lex);
retval = false;
goto cleanup;
}
+ ftepp->in_macro = old_inmacro;
vec_free(ftepp->lex->open_string);
- if (has_newlines)
+ if (has_newlines && !ftepp->in_macro)
ftepp_recursion_footer(ftepp);
- if (resetline) {
+ if (resetline && !ftepp->in_macro) {
char lineno[128];
- sprintf(lineno, "\n#pragma line(%lu)\n", old_lexer->sline);
+ sprintf(lineno, "\n#pragma line(%lu)\n", (unsigned long)(old_lexer->sline));
ftepp_out(ftepp, lineno, false);
}
old_string = ftepp->output_string;
break;
case TOKEN_WHITE:
/* same as default but don't set newline=false */
- ftepp_out(ftepp, ftepp_tokval(ftepp), false);
+ ftepp_out(ftepp, ftepp_tokval(ftepp), true);
ftepp_next(ftepp);
break;
default: