diff options
author | Zack Weinberg <zack@rabi.phys.columbia.edu> | 1998-10-29 11:55:06 +0000 |
---|---|---|
committer | Dave Brolley <brolley@gcc.gnu.org> | 1998-10-29 06:55:06 -0500 |
commit | 7140b0dba6389942f7dd33e4629fe85a5df7db52 (patch) | |
tree | 7a41568dce8aee7bafc71cedf34c4112d3c9dbaf | |
parent | add7091b5b09593736c839d9ffa33d74f5d7cb61 (diff) | |
download | gcc-7140b0dba6389942f7dd33e4629fe85a5df7db52.zip gcc-7140b0dba6389942f7dd33e4629fe85a5df7db52.tar.gz gcc-7140b0dba6389942f7dd33e4629fe85a5df7db52.tar.bz2 |
lex.c: Call check_newline from lang_init always.
1998-10-28 Zack Weinberg <zack@rabi.phys.columbia.edu>
* cp/lex.c: Call check_newline from lang_init always. After
calling cpp_start_read, set yy_cur and yy_lim to read from the
cpplib token buffer.
From-SVN: r23425
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/lex.c | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 64fa422..fd5706b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -8,6 +8,12 @@ * Makefile.in (cc1plus): Put CXX_OBJS, and thence @extra_cxx_objs@, last. +1998-10-28 Zack Weinberg <zack@rabi.phys.columbia.edu> + + * cp/lex.c: Call check_newline from lang_init always. After + calling cpp_start_read, set yy_cur and yy_lim to read from the + cpplib token buffer. + 1998-10-28 Jason Merrill <jason@yorick.cygnus.com> * class.c (instantiate_type): Don't consider templates for a normal diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 30c7048..5901c8a 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -395,11 +395,14 @@ lang_init_options () void lang_init () { -#if ! USE_CPPLIB /* the beginning of the file is a new line; check for # */ /* With luck, we discover the real source file's name from that and put it in input_filename. */ +#if ! USE_CPPLIB put_back (check_newline ()); +#else + check_newline (); + yy_cur--; #endif if (flag_gnu_xref) GNU_xref_begin (input_filename); init_repo (input_filename); @@ -475,12 +478,15 @@ init_parse (filename) #endif #if USE_CPPLIB - yy_cur = "\n"; - yy_lim = yy_cur + 1; - parse_in.show_column = 1; if (! cpp_start_read (&parse_in, filename)) abort (); + + /* cpp_start_read always puts at least one line directive into the + token buffer. We must arrange to read it out here. */ + yy_cur = parse_in.token_buffer; + yy_lim = CPP_PWRITTEN (&parse_in); + #else /* Open input file. */ if (filename == 0 || !strcmp (filename, "-")) |