1 /* Parse C expressions for cpplib.
2 Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
3 2002 Free Software Foundation.
4 Contributed by Per Bothner, 1994.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
26 /* Yield nonzero if adding two numbers with A's and B's signs can yield a
27 number with SUM's sign, where A, B, and SUM are all C integers. */
28 #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
30 static void integer_overflow
PARAMS ((cpp_reader
*));
31 static HOST_WIDEST_INT left_shift
PARAMS ((cpp_reader
*, HOST_WIDEST_INT
,
33 unsigned HOST_WIDEST_INT
));
34 static HOST_WIDEST_INT right_shift
PARAMS ((cpp_reader
*, HOST_WIDEST_INT
,
36 unsigned HOST_WIDEST_INT
));
37 static struct op parse_number
PARAMS ((cpp_reader
*, const cpp_token
*));
38 static struct op parse_defined
PARAMS ((cpp_reader
*));
39 static struct op eval_token
PARAMS ((cpp_reader
*, const cpp_token
*));
40 static struct op
*reduce
PARAMS ((cpp_reader
*, struct op
*, enum cpp_ttype
));
45 uchar unsignedp
; /* True if value should be treated as unsigned. */
46 HOST_WIDEST_INT value
; /* The value logically "right" of op. */
49 /* Token type abuse. There is no "error" token, but we can't get
50 comments in #if, so we can abuse that token type. Similarly,
51 create unary plus and minus operators. */
52 #define CPP_ERROR CPP_COMMENT
53 #define CPP_UPLUS (CPP_LAST_CPP_OP + 1)
54 #define CPP_UMINUS (CPP_LAST_CPP_OP + 2)
56 /* With -O2, gcc appears to produce nice code, moving the error
57 message load and subsequent jump completely out of the main path. */
58 #define SYNTAX_ERROR(msgid) \
59 do { cpp_error (pfile, DL_ERROR, msgid); goto syntax_error; } while(0)
60 #define SYNTAX_ERROR2(msgid, arg) \
61 do { cpp_error (pfile, DL_ERROR, msgid, arg); goto syntax_error; } while(0)
65 const unsigned char s
[4];
66 const unsigned char u
;
67 const unsigned char l
;
70 static const struct suffix vsuf_1
[] = {
71 { "u", 1, 0 }, { "U", 1, 0 },
72 { "l", 0, 1 }, { "L", 0, 1 }
75 static const struct suffix vsuf_2
[] = {
76 { "ul", 1, 1 }, { "UL", 1, 1 }, { "uL", 1, 1 }, { "Ul", 1, 1 },
77 { "lu", 1, 1 }, { "LU", 1, 1 }, { "Lu", 1, 1 }, { "lU", 1, 1 },
78 { "ll", 0, 2 }, { "LL", 0, 2 }
81 static const struct suffix vsuf_3
[] = {
82 { "ull", 1, 2 }, { "ULL", 1, 2 }, { "uLL", 1, 2 }, { "Ull", 1, 2 },
83 { "llu", 1, 2 }, { "LLU", 1, 2 }, { "LLu", 1, 2 }, { "llU", 1, 2 }
86 /* Parse and convert what is presumably an integer in TOK. Accepts
87 decimal, hex, or octal with or without size suffixes. Returned op
88 is CPP_ERROR on error, otherwise it is a CPP_NUMBER. */
90 parse_number (pfile
, tok
)
95 const uchar
*start
= tok
->val
.str
.text
;
96 const uchar
*end
= start
+ tok
->val
.str
.len
;
97 const uchar
*p
= start
;
99 unsigned HOST_WIDEST_INT n
= 0, nd
, MAX_over_base
;
102 int digit
, largest_digit
= 0;
103 const struct suffix
*sufftab
;
109 if (end
- start
>= 3 && (p
[1] == 'x' || p
[1] == 'X'))
121 /* Some buggy compilers (e.g. MPW C) seem to need both casts. */
122 MAX_over_base
= (((unsigned HOST_WIDEST_INT
) -1)
123 / ((unsigned HOST_WIDEST_INT
) base
));
130 || (base
== 16 && ISXDIGIT (c
)))
131 digit
= hex_value (c
);
135 if (largest_digit
< digit
)
136 largest_digit
= digit
;
137 nd
= n
* base
+ digit
;
138 overflow
|= MAX_over_base
< n
|| nd
< n
;
144 /* Check for a floating point constant. Note that float constants
145 with an exponent or suffix but no decimal point are technically
146 invalid (C99 6.4.4.2) but accepted elsewhere. */
147 if ((c
== '.' || c
== 'F' || c
== 'f')
148 || (base
== 10 && (c
== 'E' || c
== 'e')
149 && p
+1 < end
&& (p
[1] == '+' || p
[1] == '-'))
150 || (base
== 16 && (c
== 'P' || c
== 'p')
151 && p
+1 < end
&& (p
[1] == '+' || p
[1] == '-')))
152 SYNTAX_ERROR ("floating point numbers are not valid in #if");
154 /* Determine the suffix. l means long, and u means unsigned.
155 See the suffix tables, above. */
158 case 1: sufftab
= vsuf_1
; nsuff
= ARRAY_SIZE (vsuf_1
); break;
159 case 2: sufftab
= vsuf_2
; nsuff
= ARRAY_SIZE (vsuf_2
); break;
160 case 3: sufftab
= vsuf_3
; nsuff
= ARRAY_SIZE (vsuf_3
); break;
161 default: goto invalid_suffix
;
164 for (i
= 0; i
< nsuff
; i
++)
165 if (memcmp (p
, sufftab
[i
].s
, end
- p
) == 0)
169 op
.unsignedp
= sufftab
[i
].u
;
171 if (CPP_WTRADITIONAL (pfile
)
173 && ! cpp_sys_macro_p (pfile
))
174 cpp_error (pfile
, DL_WARNING
, "traditional C rejects the `U' suffix");
175 if (sufftab
[i
].l
== 2 && CPP_OPTION (pfile
, pedantic
)
176 && ! CPP_OPTION (pfile
, c99
))
177 cpp_error (pfile
, DL_PEDWARN
,
178 "too many 'l' suffixes in integer constant");
181 if (base
<= largest_digit
)
182 cpp_error (pfile
, DL_PEDWARN
,
183 "integer constant contains digits beyond the radix");
186 cpp_error (pfile
, DL_PEDWARN
, "integer constant out of range");
188 /* If too big to be signed, consider it unsigned. */
189 else if ((HOST_WIDEST_INT
) n
< 0 && ! op
.unsignedp
)
192 cpp_error (pfile
, DL_WARNING
,
193 "integer constant is so large that it is unsigned");
202 cpp_error (pfile
, DL_ERROR
, "invalid suffix '%.*s' on integer constant",
209 /* Handle meeting "defined" in a preprocessor expression. */
211 parse_defined (pfile
)
215 cpp_hashnode
*node
= 0;
216 const cpp_token
*token
;
218 cpp_context
*initial_context
= pfile
->context
;
220 /* Don't expand macros. */
221 pfile
->state
.prevent_expansion
++;
223 token
= cpp_get_token (pfile
);
224 if (token
->type
== CPP_OPEN_PAREN
)
227 token
= cpp_get_token (pfile
);
230 if (token
->type
== CPP_NAME
)
232 node
= token
->val
.node
;
233 if (paren
&& cpp_get_token (pfile
)->type
!= CPP_CLOSE_PAREN
)
235 cpp_error (pfile
, DL_ERROR
, "missing ')' after \"defined\"");
241 cpp_error (pfile
, DL_ERROR
,
242 "operator \"defined\" requires an identifier");
243 if (token
->flags
& NAMED_OP
)
248 op
.type
= token
->type
;
249 cpp_error (pfile
, DL_ERROR
,
250 "(\"%s\" is an alternative token for \"%s\" in C++)",
251 cpp_token_as_text (pfile
, token
),
252 cpp_token_as_text (pfile
, &op
));
260 if (pfile
->context
!= initial_context
)
261 cpp_error (pfile
, DL_WARNING
,
262 "this use of \"defined\" may not be portable");
264 op
.value
= node
->type
== NT_MACRO
;
268 /* A possible controlling macro of the form #if !defined ().
269 _cpp_parse_expr checks there was no other junk on the line. */
270 pfile
->mi_ind_cmacro
= node
;
273 pfile
->state
.prevent_expansion
--;
277 /* Convert a token into a CPP_NUMBER (an interpreted preprocessing
278 number or character constant, or the result of the "defined" or "#"
279 operators), or CPP_ERROR on error. */
281 eval_token (pfile
, token
)
283 const cpp_token
*token
;
294 return parse_number (pfile
, token
);
297 op
.unsignedp
= WCHAR_UNSIGNED
;
298 case CPP_CHAR
: /* Always unsigned. */
299 op
.value
= cpp_interpret_charconst (pfile
, token
, 1, &temp
);
303 if (token
->val
.node
== pfile
->spec_nodes
.n_defined
)
304 return parse_defined (pfile
);
305 else if (CPP_OPTION (pfile
, cplusplus
)
306 && (token
->val
.node
== pfile
->spec_nodes
.n_true
307 || token
->val
.node
== pfile
->spec_nodes
.n_false
))
309 op
.value
= (token
->val
.node
== pfile
->spec_nodes
.n_true
);
311 /* Warn about use of true or false in #if when pedantic
312 and stdbool.h has not been included. */
313 if (CPP_PEDANTIC (pfile
)
314 && ! cpp_defined (pfile
, DSC("__bool_true_false_are_defined")))
315 cpp_error (pfile
, DL_PEDWARN
,
316 "ISO C++ does not permit \"%s\" in #if",
317 NODE_NAME (token
->val
.node
));
322 if (CPP_OPTION (pfile
, warn_undef
) && !pfile
->state
.skip_eval
)
323 cpp_error (pfile
, DL_WARNING
, "\"%s\" is not defined",
324 NODE_NAME (token
->val
.node
));
328 default: /* CPP_HASH */
329 if (_cpp_test_assertion (pfile
, &temp
))
337 /* Warn if appropriate on overflow. */
339 integer_overflow (pfile
)
342 if (CPP_PEDANTIC (pfile
))
343 cpp_error (pfile
, DL_PEDWARN
,
344 "integer overflow in preprocessor expression");
347 /* Handle shifting A left by B bits. UNSIGNEDP is non-zero if A is
349 static HOST_WIDEST_INT
350 left_shift (pfile
, a
, unsignedp
, b
)
353 unsigned int unsignedp
;
354 unsigned HOST_WIDEST_INT b
;
356 if (b
>= HOST_BITS_PER_WIDEST_INT
)
358 if (! unsignedp
&& a
!= 0)
359 integer_overflow (pfile
);
363 return (unsigned HOST_WIDEST_INT
) a
<< b
;
366 HOST_WIDEST_INT l
= a
<< b
;
368 integer_overflow (pfile
);
373 /* Handle shifting A right by B bits. UNSIGNEDP is non-zero if A is
375 static HOST_WIDEST_INT
376 right_shift (pfile
, a
, unsignedp
, b
)
377 cpp_reader
*pfile ATTRIBUTE_UNUSED
;
379 unsigned int unsignedp
;
380 unsigned HOST_WIDEST_INT b
;
382 if (b
>= HOST_BITS_PER_WIDEST_INT
)
383 return unsignedp
? 0 : a
>> (HOST_BITS_PER_WIDEST_INT
- 1);
385 return (unsigned HOST_WIDEST_INT
) a
>> b
;
390 /* Operator precedence and flags table.
392 After an operator is returned from the lexer, if it has priority less
393 than the operator on the top of the stack, we reduce the stack by one
394 operator and repeat the test. Since equal priorities do not reduce,
395 this is naturally right-associative.
397 We handle left-associative operators by decrementing the priority of
398 just-lexed operators by one, but retaining the priority of operators
399 already on the stack.
401 The remaining cases are '(' and ')'. We handle '(' by skipping the
402 reduction phase completely. ')' is given lower priority than
403 everything else, including '(', effectively forcing a reduction of the
404 parenthesised expression. If there is a matching '(', the routine
405 reduce() exits immediately. If the normal exit route sees a ')', then
406 there cannot have been a matching '(' and an error message is output.
408 The parser assumes all shifted operators require a left operand unless
409 the flag NO_L_OPERAND is set. These semantics are automatic; any
410 extra semantics need to be handled with operator-specific code. */
413 #define NO_L_OPERAND (1 << 0)
414 #define LEFT_ASSOC (1 << 1)
416 /* Operator to priority map. Must be in the same order as the first
417 N entries of enum cpp_ttype. */
418 static const struct operator
424 /* EQ */ {0, 0}, /* Shouldn't happen. */
425 /* NOT */ {16, NO_L_OPERAND
},
426 /* GREATER */ {12, LEFT_ASSOC
},
427 /* LESS */ {12, LEFT_ASSOC
},
428 /* PLUS */ {14, LEFT_ASSOC
},
429 /* MINUS */ {14, LEFT_ASSOC
},
430 /* MULT */ {15, LEFT_ASSOC
},
431 /* DIV */ {15, LEFT_ASSOC
},
432 /* MOD */ {15, LEFT_ASSOC
},
433 /* AND */ {9, LEFT_ASSOC
},
434 /* OR */ {7, LEFT_ASSOC
},
435 /* XOR */ {8, LEFT_ASSOC
},
436 /* RSHIFT */ {13, LEFT_ASSOC
},
437 /* LSHIFT */ {13, LEFT_ASSOC
},
438 /* MIN */ {10, LEFT_ASSOC
}, /* C++ specific */
439 /* MAX */ {10, LEFT_ASSOC
}, /* extensions */
441 /* COMPL */ {16, NO_L_OPERAND
},
442 /* AND_AND */ {6, LEFT_ASSOC
},
443 /* OR_OR */ {5, LEFT_ASSOC
},
445 /* COLON */ {4, LEFT_ASSOC
},
446 /* COMMA */ {2, LEFT_ASSOC
},
447 /* OPEN_PAREN */ {1, NO_L_OPERAND
},
448 /* CLOSE_PAREN */ {0, 0},
450 /* EQ_EQ */ {11, LEFT_ASSOC
},
451 /* NOT_EQ */ {11, LEFT_ASSOC
},
452 /* GREATER_EQ */ {12, LEFT_ASSOC
},
453 /* LESS_EQ */ {12, LEFT_ASSOC
},
454 /* UPLUS */ {16, NO_L_OPERAND
},
455 /* UMINUS */ {16, NO_L_OPERAND
}
458 #define COMPARE(OP) \
459 top->unsignedp = 0; \
460 top->value = (unsigned1 | unsigned2) \
461 ? (unsigned HOST_WIDEST_INT) v1 OP (unsigned HOST_WIDEST_INT) v2 \
463 #define EQUALITY(OP) \
464 top->value = v1 OP v2; \
466 #define BITWISE(OP) \
467 top->value = v1 OP v2; \
468 top->unsignedp = unsigned1 | unsigned2;
470 top->value = (v1 OP v2) ? v1 : v2; \
471 top->unsignedp = unsigned1 | unsigned2;
473 top->value = OP v2; \
474 top->unsignedp = unsigned2;
475 #define SHIFT(PSH, MSH) \
476 if (pfile->state.skip_eval) \
478 top->unsignedp = unsigned1; \
479 if (v2 < 0 && ! unsigned2) \
480 top->value = MSH (pfile, v1, unsigned1, -v2); \
482 top->value = PSH (pfile, v1, unsigned1, v2);
484 /* Parse and evaluate a C expression, reading from PFILE.
485 Returns the truth value of the expression.
487 The implementation is an operator precedence parser, i.e. a
488 bottom-up parser, using a stack for not-yet-reduced tokens.
490 The stack base is op_stack, and the current stack pointer is 'top'.
491 There is a stack element for each operator (only), and the most
492 recently pushed operator is 'top->op'. An operand (value) is
493 stored in the 'value' field of the stack element of the operator
496 _cpp_parse_expr (pfile
)
499 struct op
*top
= pfile
->op_stack
;
500 const cpp_token
*token
= NULL
, *prev_token
;
501 unsigned int lex_count
;
502 bool saw_leading_not
, want_value
= true;
504 pfile
->state
.skip_eval
= 0;
506 /* Set up detection of #if ! defined(). */
507 pfile
->mi_ind_cmacro
= 0;
508 saw_leading_not
= false;
511 /* Lowest priority operator prevents further reductions. */
519 token
= cpp_get_token (pfile
);
525 /* These tokens convert into values. */
532 SYNTAX_ERROR2 ("missing binary operator before token \"%s\"",
533 cpp_token_as_text (pfile
, token
));
535 op
= eval_token (pfile
, token
);
536 if (op
.op
== CPP_ERROR
)
538 top
->value
= op
.value
;
539 top
->unsignedp
= op
.unsignedp
;
543 saw_leading_not
= lex_count
== 1;
554 if (ISGRAPH (token
->val
.c
))
555 SYNTAX_ERROR2 ("invalid character '%c' in #if", token
->val
.c
);
557 SYNTAX_ERROR2 ("invalid character '\\%03o' in #if", token
->val
.c
);
560 if ((int) op
.op
<= (int) CPP_EQ
|| (int) op
.op
>= (int) CPP_PLUS_EQ
)
561 SYNTAX_ERROR2 ("token \"%s\" is not valid in #if expressions",
562 cpp_token_as_text (pfile
, token
));
566 /* Check we have a value or operator as appropriate. */
567 if (optab
[op
.op
].flags
& NO_L_OPERAND
)
570 SYNTAX_ERROR2 ("missing binary operator before token \"%s\"",
571 cpp_token_as_text (pfile
, token
));
575 /* Ordering here is subtle and intended to favour the
576 missing parenthesis diagnostics over alternatives. */
577 if (op
.op
== CPP_CLOSE_PAREN
)
579 if (top
->op
== CPP_OPEN_PAREN
)
580 SYNTAX_ERROR ("void expression between '(' and ')'");
582 else if (top
->op
== CPP_EOF
)
583 SYNTAX_ERROR ("#if with no expression");
584 if (top
->op
!= CPP_EOF
&& top
->op
!= CPP_OPEN_PAREN
)
585 SYNTAX_ERROR2 ("operator '%s' has no right operand",
586 cpp_token_as_text (pfile
, prev_token
));
589 top
= reduce (pfile
, top
, op
.op
);
593 if (op
.op
== CPP_EOF
)
598 case CPP_CLOSE_PAREN
:
602 pfile
->state
.skip_eval
++;
607 pfile
->state
.skip_eval
++;
610 if (top
->op
!= CPP_QUERY
)
611 SYNTAX_ERROR (" ':' without preceding '?'");
612 if (top
[-1].value
) /* Was '?' condition true? */
613 pfile
->state
.skip_eval
++;
615 pfile
->state
.skip_eval
--;
622 /* Check for and handle stack overflow. */
623 if (++top
== pfile
->op_limit
)
624 top
= _cpp_expand_op_stack (pfile
);
629 /* The controlling macro expression is only valid if we called lex 3
630 times: <!> <defined expression> and <EOF>. push_conditional ()
631 checks that we are at top-of-file. */
632 if (pfile
->mi_ind_cmacro
&& !(saw_leading_not
&& lex_count
== 3))
633 pfile
->mi_ind_cmacro
= 0;
635 if (top
!= pfile
->op_stack
)
637 cpp_error (pfile
, DL_ICE
, "unbalanced stack in #if");
639 return false; /* Return false on syntax error. */
642 return top
->value
!= 0;
645 /* Reduce the operator / value stack if possible, in preparation for
646 pushing operator OP. Returns NULL on error, otherwise the top of
649 reduce (pfile
, top
, op
)
656 if (op
== CPP_OPEN_PAREN
)
659 /* Decrement the priority of left-associative operators to force a
660 reduction with operators of otherwise equal priority. */
661 prio
= optab
[op
].prio
- ((optab
[op
].flags
& LEFT_ASSOC
) != 0);
662 while (prio
< optab
[top
->op
].prio
)
664 HOST_WIDEST_INT v1
, v2
;
665 unsigned int unsigned1
, unsigned2
;
667 unsigned2
= top
->unsignedp
, v2
= top
->value
;
669 unsigned1
= top
->unsignedp
, v1
= top
->value
;
671 /* Now set top->value = (top[1].op)(v1, v2); */
675 cpp_error (pfile
, DL_ICE
, "impossible operator '%u'", top
[1].op
);
678 case CPP_NOT
: UNARY(!); break;
679 case CPP_COMPL
: UNARY(~); break;
680 case CPP_LESS
: COMPARE(<); break;
681 case CPP_GREATER
: COMPARE(>); break;
682 case CPP_LESS_EQ
: COMPARE(<=); break;
683 case CPP_GREATER_EQ
: COMPARE(>=); break;
684 case CPP_EQ_EQ
: EQUALITY(==); break;
685 case CPP_NOT_EQ
: EQUALITY(!=); break;
686 case CPP_AND
: BITWISE(&); break;
687 case CPP_XOR
: BITWISE(^); break;
688 case CPP_OR
: BITWISE(|); break;
689 case CPP_LSHIFT
: SHIFT(left_shift
, right_shift
); break;
690 case CPP_RSHIFT
: SHIFT(right_shift
, left_shift
); break;
691 case CPP_MIN
: MINMAX(<); break;
692 case CPP_MAX
: MINMAX(>); break;
695 /* Can't use UNARY(+) because K+R C did not have unary
696 plus. Can't use UNARY() because some compilers object
697 to the empty argument. */
699 top
->unsignedp
= unsigned2
;
700 if (CPP_WTRADITIONAL (pfile
))
701 cpp_error (pfile
, DL_WARNING
,
702 "traditional C rejects the unary plus operator");
706 if (!pfile
->state
.skip_eval
&& (top
->value
& v2
) < 0 && !unsigned2
)
707 integer_overflow (pfile
);
711 top
->value
= v1
+ v2
;
712 top
->unsignedp
= unsigned1
| unsigned2
;
713 if (! top
->unsignedp
&& ! pfile
->state
.skip_eval
714 && ! possible_sum_sign (v1
, v2
, top
->value
))
715 integer_overflow (pfile
);
718 top
->value
= v1
- v2
;
719 top
->unsignedp
= unsigned1
| unsigned2
;
720 if (! top
->unsignedp
&& ! pfile
->state
.skip_eval
721 && ! possible_sum_sign (top
->value
, v2
, v1
))
722 integer_overflow (pfile
);
725 top
->unsignedp
= unsigned1
| unsigned2
;
727 top
->value
= (unsigned HOST_WIDEST_INT
) v1
* v2
;
728 else if (!pfile
->state
.skip_eval
)
730 top
->value
= v1
* v2
;
731 if (v1
&& (top
->value
/ v1
!= v2
732 || (top
->value
& v1
& v2
) < 0))
733 integer_overflow (pfile
);
738 if (pfile
->state
.skip_eval
)
742 cpp_error (pfile
, DL_ERROR
, "division by zero in #if");
745 top
->unsignedp
= unsigned1
| unsigned2
;
746 if (top
[1].op
== CPP_DIV
)
749 top
->value
= (unsigned HOST_WIDEST_INT
) v1
/ v2
;
752 top
->value
= v1
/ v2
;
753 if ((top
->value
& v1
& v2
) < 0)
754 integer_overflow (pfile
);
760 top
->value
= (unsigned HOST_WIDEST_INT
) v1
% v2
;
762 top
->value
= v1
% v2
;
767 top
->value
= v1
|| v2
;
769 if (v1
) pfile
->state
.skip_eval
--;
772 top
->value
= v1
&& v2
;
774 if (!v1
) pfile
->state
.skip_eval
--;
777 if (CPP_PEDANTIC (pfile
))
778 cpp_error (pfile
, DL_PEDWARN
,
779 "comma operator in operand of #if");
781 top
->unsignedp
= unsigned2
;
784 cpp_error (pfile
, DL_ERROR
, "'?' without following ':'");
788 if (top
->value
) pfile
->state
.skip_eval
--;
789 top
->value
= top
->value
? v1
: v2
;
790 top
->unsignedp
= unsigned1
| unsigned2
;
793 if (op
!= CPP_CLOSE_PAREN
)
795 cpp_error (pfile
, DL_ERROR
, "missing ')' in expression");
799 top
->unsignedp
= unsigned2
;
804 if (op
== CPP_CLOSE_PAREN
)
806 cpp_error (pfile
, DL_ERROR
, "missing '(' in expression");
813 /* Returns the position of the old top of stack after expansion. */
815 _cpp_expand_op_stack (pfile
)
818 size_t n
= (size_t) (pfile
->op_limit
- pfile
->op_stack
);
820 pfile
->op_stack
= (struct op
*) xrealloc (pfile
->op_stack
,
821 (n
* 2 + 20) * sizeof (struct op
));
823 return pfile
->op_stack
+ n
;