This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH]: fix 2197
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH]: fix 2197
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Tue, 01 May 2001 12:06:28 +0100
- Organization: Codesourcery LLC
Hi,
I've installed this patch on both mainline and branch, as it is the
obvious fix for bug 2197, a regression.
yylval.ttype turns into an INT_CST for things like `public'.
built & tested on i686-pc-linux-gnu.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-05-01 Nathan Sidwell <nathan@codesourcery.com>
* spew.c (last_token_id): New static variable.
(read_token): Set it here.
(yyerror): Use it here.
Index: cp/spew.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/spew.c,v
retrieving revision 1.46
diff -c -3 -p -r1.46 spew.c
*** spew.c 2001/04/26 20:05:33 1.46
--- spew.c 2001/05/01 08:10:34
*************** static void debug_yychar PARAMS ((int));
*** 140,145 ****
--- 140,146 ----
extern char *debug_yytranslate PARAMS ((int));
#endif
static enum cpp_ttype last_token;
+ static tree last_token_id;
/* From lex.c: */
/* the declaration found for the last IDENTIFIER token read in.
*************** read_token (t)
*** 259,265 ****
{
retry:
! last_token = c_lex (&t->yylval.ttype);
switch (last_token)
{
--- 260,267 ----
{
retry:
! last_token = c_lex (&last_token_id);
! t->yylval.ttype = last_token_id;
switch (last_token)
{
*************** yyerror (msgid)
*** 1499,1508 ****
error ("%s before numeric constant", string);
else if (last_token == CPP_NAME)
{
! if (yylval.ttype && TREE_CODE (yylval.ttype) == IDENTIFIER_NODE)
! error ("%s before `%s'", string, IDENTIFIER_POINTER (yylval.ttype));
! else
error ("%s before `%c'", string, yychar);
}
else
error ("%s before `%s' token", string, NAME (last_token));
--- 1501,1512 ----
error ("%s before numeric constant", string);
else if (last_token == CPP_NAME)
{
! if (TREE_CODE (last_token_id) == IDENTIFIER_NODE)
! error ("%s before `%s'", string, IDENTIFIER_POINTER (last_token_id));
! else if (ISGRAPH (yychar))
error ("%s before `%c'", string, yychar);
+ else
+ error ("%s before `\%o'", string, yychar);
}
else
error ("%s before `%s' token", string, NAME (last_token));