/* Indicate date and time not yet calculated. */
pfile->date.type = CPP_EOF;
+ /* Create a token buffer for the lexer. */
+ _cpp_init_tokenrun (&pfile->base_run, 250);
+ pfile->cur_run = &pfile->base_run;
+ pfile->cur_token = pfile->base_run.base;
+
/* Initialise the base context. */
pfile->context = &pfile->base_context;
pfile->base_context.macro = 0;
_cpp_destroy_hashtable (pfile);
_cpp_cleanup_includes (pfile);
- _cpp_free_lookaheads (pfile);
_cpp_free_pool (&pfile->ident_pool);
_cpp_free_pool (&pfile->macro_pool);
/* Scan -imacros files after command line defines, but before
files given with -include. */
- for (p = CPP_OPTION (pfile, pending)->imacros_head; p; p = p->next)
+ while ((p = CPP_OPTION (pfile, pending)->imacros_head) != NULL)
{
if (push_include (pfile, p))
{
pfile->buffer->return_at_eof = true;
cpp_scan_nooutput (pfile);
}
+ CPP_OPTION (pfile, pending)->imacros_head = p->next;
+ free (p);
}
}
free_chain (CPP_OPTION (pfile, pending)->directive_head);
- free_chain (CPP_OPTION (pfile, pending)->imacros_head);
_cpp_push_next_buffer (pfile);
return 1;
{
bool pushed = false;
- if (CPP_OPTION (pfile, pending))
+ /* This is't pretty; we'd rather not be relying on this as a boolean
+ for reverting the line map. Further, we only free the chains in
+ this conditional, so an early call to cpp_finish / cpp_destroy
+ will leak that memory. */
+ if (CPP_OPTION (pfile, pending)
+ && CPP_OPTION (pfile, pending)->imacros_head == NULL)
{
while (!pushed)
{
{
/* Stream on which to print the dependency information. */
FILE *deps_stream = 0;
- const char *deps_mode = CPP_OPTION (pfile, print_deps_append) ? "a" : "w";
+ const char *const deps_mode =
+ CPP_OPTION (pfile, print_deps_append) ? "a" : "w";
if (CPP_OPTION (pfile, deps_file) == 0)
deps_stream = stdout;