diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-15 10:18:03 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-15 10:18:03 +0000 |
commit | 729d202287ec3a6291ee893585b188a25ceabfde (patch) | |
tree | 8e0d501bff80d035729518382d4a712cf34238c5 /gcc/cppinit.c | |
parent | 5d91cd56a92bd29537b46c0bad34d45fb768f4e1 (diff) | |
download | gcc-729d202287ec3a6291ee893585b188a25ceabfde.tar.gz |
* cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos.
Split mlstring_pos into mls_line and mls_col.
* cppinit.c (cpp_create_reader): Initialize line to 1.
(cpp_destroy): Free tokenruns.
(push_include): Don't update lexer_pos.
* cpplex.c (unterminated, parse_string): Update.
(lex_token): Don't update lexer_pos, update.
* cpplib.c (if_stack): Save line instead of line + col.
(start_directive, _cpp_do__Pragma, do_else, do_elif,
push_conditional, _cpp_pop_buffer): Update.
* cppmacro.c (funlike_invocation_p): Don't save lexer_pos.
(_cpp_create_definition): Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45627 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r-- | gcc/cppinit.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 94e11981b64..7c7f8dcdf05 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -502,8 +502,10 @@ cpp_create_reader (table, lang) be needed. */ pfile->deps = deps_init (); - /* Initialise the line map. */ + /* 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; /* Initialize lexer state. */ pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments); @@ -564,6 +566,7 @@ cpp_destroy (pfile) int result; struct search_path *dir, *dirn; cpp_context *context, *contextn; + tokenrun *run, *runn; while (CPP_BUFFER (pfile) != NULL) _cpp_pop_buffer (pfile); @@ -585,6 +588,14 @@ cpp_destroy (pfile) _cpp_free_pool (&pfile->macro_pool); _cpp_free_pool (&pfile->argument_pool); + for (run = &pfile->base_run; run; run = runn) + { + runn = run->next; + free (run->base); + if (run != &pfile->base_run) + free (run); + } + for (dir = CPP_OPTION (pfile, quote_include); dir; dir = dirn) { dirn = dir->next; @@ -886,7 +897,7 @@ push_include (pfile, p) header.val.str.text = (const unsigned char *) p->arg; header.val.str.len = strlen (p->arg); /* Make the command line directive take up a line. */ - pfile->lexer_pos.line = ++pfile->line; + pfile->line++; return _cpp_execute_include (pfile, &header, IT_CMDLINE); } |