/* Initialise the line map. Start at logical line 1, so we can use
a line number of zero for special states. */
init_line_maps (&pfile->line_maps);
- pfile->line = 1;
+ pfile->trad_line = pfile->line = 1;
/* Initialize lexer state. */
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
while (CPP_BUFFER (pfile) != NULL)
_cpp_pop_buffer (pfile);
+ if (pfile->trad_out_base)
+ free (pfile->trad_out_base);
+
if (pfile->macro_buffer)
{
free ((PTR) pfile->macro_buffer);
of the front ends. */
if (CPP_OPTION (pfile, preprocessed))
read_original_filename (pfile);
+ /* Overlay an empty buffer to seed traditional preprocessing. */
+ else if (CPP_OPTION (pfile, traditional))
+ _cpp_overlay_buffer (pfile, U"", 0);
return pfile->map->to_file;
}
struct pending_option *p;
_cpp_do_file_change (pfile, LC_RENAME, _("<built-in>"), 1, 0);
- init_builtins (pfile);
+ if (!CPP_OPTION (pfile, traditional) /* REMOVEME */)
+ init_builtins (pfile);
_cpp_do_file_change (pfile, LC_RENAME, _("<command line>"), 1, 0);
- for (p = CPP_OPTION (pfile, pending)->directive_head; p; p = p->next)
- (*p->handler) (pfile, p->arg);
+ if (!CPP_OPTION (pfile, traditional) /* REMOVEME */)
+ for (p = CPP_OPTION (pfile, pending)->directive_head; p; p = p->next)
+ (*p->handler) (pfile, p->arg);
/* Scan -imacros files after -D, -U, but before -include.
pfile->next_include_file is NULL, so _cpp_pop_buffer does not
DEF_OPT("std=iso9899:199409", 0, OPT_std_iso9899_199409) \
DEF_OPT("std=iso9899:1999", 0, OPT_std_iso9899_1999) \
DEF_OPT("std=iso9899:199x", 0, OPT_std_iso9899_199x) \
+ DEF_OPT("traditional-cpp", 0, OPT_traditional_cpp) \
DEF_OPT("trigraphs", 0, OPT_trigraphs) \
DEF_OPT("v", 0, OPT_v) \
DEF_OPT("version", 0, OPT_version) \
case OPT_remap:
CPP_OPTION (pfile, remap) = 1;
break;
+ case OPT_traditional_cpp:
+ CPP_OPTION (pfile, traditional) = 1;
+ break;
case OPT_iprefix:
CPP_OPTION (pfile, include_prefix) = arg;
CPP_OPTION (pfile, include_prefix_len) = strlen (arg);