aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-05-01 10:53:09 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-05-01 10:53:09 +0000
commit1bcea8d764215f8b04d69c5e8a991b715db54304 (patch)
treea2a7a74a9f17f7b22c02065ccda78f69942ed026
parentd0e66dbb95b7d611428f4974aebf0d3ac320ff41 (diff)
downloadgcc-1bcea8d764215f8b04d69c5e8a991b715db54304.zip
gcc-1bcea8d764215f8b04d69c5e8a991b715db54304.tar.gz
gcc-1bcea8d764215f8b04d69c5e8a991b715db54304.tar.bz2
spew.c (last_token_id): New static variable.
cp: * spew.c (last_token_id): New static variable. (read_token): Set it here. (yyerror): Use it here. From-SVN: r41719
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/spew.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e952168..5255f15 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2001-04-30 Richard Henderson <rth@redhat.com>
* cvt.c: Downcase C_PROMOTING_INTEGER_TYPE_P invocations.
diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c
index ea2392a..4a230f0 100644
--- a/gcc/cp/spew.c
+++ b/gcc/cp/spew.c
@@ -140,6 +140,7 @@ static void debug_yychar PARAMS ((int));
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.
@@ -259,7 +260,8 @@ read_token (t)
{
retry:
- last_token = c_lex (&t->yylval.ttype);
+ last_token = c_lex (&last_token_id);
+ t->yylval.ttype = last_token_id;
switch (last_token)
{
@@ -1499,10 +1501,12 @@ yyerror (msgid)
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
+ 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));