This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: splitting up cpplib, revised
- To: Zack Weinberg <zack at rabi dot columbia dot edu>
- Subject: Re: splitting up cpplib, revised
- From: Dave Brolley <brolley at cygnus dot com>
- Date: Wed, 28 Oct 1998 15:07:20 -0500
- CC: bothner at cygnus dot com, egcs-patches at cygnus dot com
- Organization: Cygnus Solutions Canada Ltd
- References: <199810272337.SAA17266@blastula.phys.columbia.edu>
Also approved.
Dave
Zack Weinberg wrote:
> On Tue, 27 Oct 1998 11:56:25 -0500, Dave Brolley wrote:
>
> >I would also like to point out that you will probably have to make
> >similar changes to cp/lex.c regardless of what the final patch looks
> >like.
>
> Yup. Here they are.
>
> zw
>
> 1998-10-27 18:36 -0500 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.
>
> ============================================================
> Index: cp/lex.c
> --- cp/lex.c 1998/10/23 14:53:08 1.81
> +++ cp/lex.c 1998/10/27 23:36:15
> @@ -395,11 +395,14 @@
> 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 @@
> #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, "-"))