summaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-18 23:25:06 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-18 23:25:06 +0000
commit96be6998336d305447f3963eb2c9d902eae516a7 (patch)
treebe6672085587ff8d9d75f630009b64878dc2aec5 /gcc/cppexp.c
parentd0089985e7e6ec8fd020e40eb59667a88d0282de (diff)
downloadgcc-96be6998336d305447f3963eb2c9d902eae516a7.tar.gz
cpplib.h (TTYPE_TABLE): Rearrange to use only two per-entry macros, not five.
* cpplib.h (TTYPE_TABLE): Rearrange to use only two per-entry macros, not five. * cpphash.h (TOKEN_NAME): New macro. (_cpp_spell_operator): Deleted. (token_spellings): Now _cpp_token_spellings. * cppexp.c: Use TOKEN_NAME or TYPE_NAME, not _cpp_spell_operator. * cpplex.c: Use OP and TK macros when expanding the TTYPE_TABLE. Eliminate token_names. For non-OPERATOR tokens, store the stringification of the enumeration name (CPP_CHAR, etc.) in the name slot of token_spellings. Use TOKEN_NAME and/or TOKEN_SPELL, do not reference token_spellings directly. * cpplib.c: Use TOKEN_SPELL. * cpplex.c (_cpp_push_token): If the token being pushed back is the previous token in this context, just subtract one from context->posn. * cppmacro.c (save_expansion): Clear aux field when storing a placemarker. * gcc.dg/cpp/paste5.c: New test. * gcc.dg/cpp/vararg1.c: New test. From-SVN: r35124
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index ce1d82b5cc5..deb5ffb2d49 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -397,7 +397,6 @@ lex (pfile, skip_evaluation)
switch (tok->type)
{
case CPP_PLACEMARKER:
- /* XXX These shouldn't be visible outside cpplex.c. */
goto retry;
case CPP_INT:
@@ -443,8 +442,7 @@ lex (pfile, skip_evaluation)
return op;
}
- SYNTAX_ERROR2("'%s' is not valid in #if expressions",
- _cpp_spell_operator (tok->type));
+ SYNTAX_ERROR2("'%s' is not valid in #if expressions", TOKEN_NAME (tok));
}
syntax_error:
@@ -718,6 +716,8 @@ op_to_prio[] =
/* Parse and evaluate a C expression, reading from PFILE.
Returns the truth value of the expression. */
+#define TYPE_NAME(t) _cpp_token_spellings[t].name
+
int
_cpp_parse_expr (pfile)
cpp_reader *pfile;
@@ -804,7 +804,7 @@ _cpp_parse_expr (pfile)
SYNTAX_ERROR ("void expression between '(' and ')'");
else
SYNTAX_ERROR2 ("operator '%s' has no right operand",
- _cpp_spell_operator (top->op));
+ TYPE_NAME (top->op));
}
unsigned2 = top->unsignedp, v2 = top->value;
@@ -815,8 +815,7 @@ _cpp_parse_expr (pfile)
switch (top[1].op)
{
default:
- cpp_ice (pfile, "impossible operator type %s",
- _cpp_spell_operator (op.op));
+ cpp_ice (pfile, "impossible operator type %s", TYPE_NAME (op.op));
goto syntax_error;
case CPP_NOT: UNARY(!); break;
@@ -969,13 +968,13 @@ _cpp_parse_expr (pfile)
{
if (top->flags & HAVE_VALUE)
SYNTAX_ERROR2 ("missing binary operator before '%s'",
- _cpp_spell_operator (op.op));
+ TYPE_NAME (op.op));
}
else
{
if (!(top->flags & HAVE_VALUE))
SYNTAX_ERROR2 ("operator '%s' has no left operand",
- _cpp_spell_operator (op.op));
+ TYPE_NAME (op.op));
}
/* Check for and handle stack overflow. */