aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-09-15 10:18:03 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-09-15 10:18:03 +0000
commit5041042620988be8180d56e808f8efe66c56c79b (patch)
tree8e0d501bff80d035729518382d4a712cf34238c5 /gcc/cppinit.c
parent6131fd23f505853e49b7f394b2dcb5de50076ad1 (diff)
downloadgcc-5041042620988be8180d56e808f8efe66c56c79b.zip
gcc-5041042620988be8180d56e808f8efe66c56c79b.tar.gz
gcc-5041042620988be8180d56e808f8efe66c56c79b.tar.bz2
cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos.
* 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. From-SVN: r45627
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 94e1198..7c7f8dc 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);
}