This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++: enum parsing speedups
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 30 Aug 2004 21:29:39 -0700
- Subject: Re: C++: enum parsing speedups
- Organization: CodeSourcery, LLC
- References: <87wtzg2avt.fsf@codesourcery.com>
Zack Weinberg wrote:
Mark: I'd like you to check my work, because in order to get the
correct locations assigned for enum TYPE_DECLs (where 'correct' is
defined by g++.old-deja/g++.other/enum2.C) I had to add calls to
cp_lexer_set_source_position_from_token to both
cp_lexer_peek_nth_token and cp_lexer_consume_token. It seems to me
that this is consistent with the intent of the parser generally, but
I'm not sure. (It is lame that we need this at all, but that's the
way the world is.)
We don't want do add more of those calls if we can help it; those
functions are on the fast path, and the c_l_s_s_p function is not free.
Just change the error markers in the test case, assuming the messages
come out somewhere sensible. We've done that plenty in the past;
whether or not an error message shows up on the {enum,class}-specifier,
or the curly brace, is not a very big deal.
I took the opportunity to replace a few calls to cp_lexer_peek_token
Good. Other than the source-position setting, it looks good to me.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com