aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index bdc09ed..c79f20d 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -36,7 +36,7 @@ static HOST_WIDEST_INT right_shift PARAMS ((cpp_reader *, HOST_WIDEST_INT,
unsigned HOST_WIDEST_INT));
static struct op parse_number PARAMS ((cpp_reader *, const cpp_token *));
static struct op parse_defined PARAMS ((cpp_reader *));
-static struct op lex PARAMS ((cpp_reader *, int, cpp_token *));
+static struct op lex PARAMS ((cpp_reader *, int));
static const unsigned char *op_as_text PARAMS ((cpp_reader *, enum cpp_ttype));
struct op
@@ -217,44 +217,40 @@ parse_defined (pfile)
{
int paren = 0;
cpp_hashnode *node = 0;
- cpp_token token;
+ const cpp_token *token;
struct op op;
/* Don't expand macros. */
pfile->state.prevent_expansion++;
- cpp_get_token (pfile, &token);
- if (token.type == CPP_OPEN_PAREN)
+ token = cpp_get_token (pfile);
+ if (token->type == CPP_OPEN_PAREN)
{
paren = 1;
- cpp_get_token (pfile, &token);
+ token = cpp_get_token (pfile);
}
- if (token.type == CPP_NAME)
+ if (token->type == CPP_NAME)
{
- node = token.val.node;
- if (paren)
+ node = token->val.node;
+ if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
{
- cpp_get_token (pfile, &token);
- if (token.type != CPP_CLOSE_PAREN)
- {
- cpp_error (pfile, "missing ')' after \"defined\"");
- node = 0;
- }
+ cpp_error (pfile, "missing ')' after \"defined\"");
+ node = 0;
}
}
else
{
cpp_error (pfile, "operator \"defined\" requires an identifier");
- if (token.flags & NAMED_OP)
+ if (token->flags & NAMED_OP)
{
cpp_token op;
op.flags = 0;
- op.type = token.type;
+ op.type = token->type;
cpp_error (pfile,
"(\"%s\" is an alternative token for \"%s\" in C++)",
- cpp_token_as_text (pfile, &token),
+ cpp_token_as_text (pfile, token),
cpp_token_as_text (pfile, &op));
}
}
@@ -282,14 +278,12 @@ parse_defined (pfile)
CPP_EOF, or the type of an operator token. */
static struct op
-lex (pfile, skip_evaluation, token)
+lex (pfile, skip_evaluation)
cpp_reader *pfile;
int skip_evaluation;
- cpp_token *token;
{
struct op op;
-
- cpp_get_token (pfile, token);
+ const cpp_token *token = cpp_get_token (pfile);
switch (token->type)
{
@@ -578,7 +572,6 @@ _cpp_parse_expr (pfile)
struct op init_stack[INIT_STACK_SIZE];
struct op *stack = init_stack;
struct op *limit = stack + INIT_STACK_SIZE;
- cpp_token token;
register struct op *top = stack + 1;
int skip_evaluation = 0;
int result;
@@ -603,7 +596,7 @@ _cpp_parse_expr (pfile)
struct op op;
/* Read a token */
- op = lex (pfile, skip_evaluation, &token);
+ op = lex (pfile, skip_evaluation);
lex_count++;
/* If the token is an operand, push its value and get next