import of gcc-2.8
[official-gcc.git] / gcc / cexp.c
blobf7c51a7d233e1fe602e4e3c3a5ef2d33166b7cae
2 /* A Bison parser, made from cexp.y
3 by Bison version A2.5 (Andrew Consortium)
4 */
6 #define YYBISON 1 /* Identify Bison output. */
8 #define INT 258
9 #define CHAR 259
10 #define NAME 260
11 #define ERROR 261
12 #define OR 262
13 #define AND 263
14 #define EQUAL 264
15 #define NOTEQUAL 265
16 #define LEQ 266
17 #define GEQ 267
18 #define LSH 268
19 #define RSH 269
20 #define UNARY 270
22 #line 27 "cexp.y"
24 #include "config.h"
25 #include <setjmp.h>
26 /* #define YYDEBUG 1 */
29 #ifdef HAVE_STRING_H
30 # include <string.h>
31 #endif
33 #ifdef HAVE_STDLIB_H
34 # include <stdlib.h>
35 #endif
37 #ifdef HAVE_LIMITS_H
38 # include <limits.h>
39 #endif
41 #ifdef MULTIBYTE_CHARS
42 #include <locale.h>
43 #endif
45 #include <stdio.h>
47 typedef unsigned char U_CHAR;
49 /* This is used for communicating lists of keywords with cccp.c. */
50 struct arglist {
51 struct arglist *next;
52 U_CHAR *name;
53 int length;
54 int argno;
57 /* Define a generic NULL if one hasn't already been defined. */
59 #ifndef NULL
60 #define NULL 0
61 #endif
63 #ifndef GENERIC_PTR
64 #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
65 #define GENERIC_PTR void *
66 #else
67 #define GENERIC_PTR char *
68 #endif
69 #endif
71 #ifndef NULL_PTR
72 #define NULL_PTR ((GENERIC_PTR) 0)
73 #endif
75 /* Find the largest host integer type and set its size and type.
76 Watch out: on some crazy hosts `long' is shorter than `int'. */
78 #ifndef HOST_WIDE_INT
79 # if HAVE_INTTYPES_H
80 # include <inttypes.h>
81 # define HOST_WIDE_INT intmax_t
82 # define unsigned_HOST_WIDE_INT uintmax_t
83 # else
84 # if (HOST_BITS_PER_LONG <= HOST_BITS_PER_INT && HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_INT)
85 # define HOST_WIDE_INT int
86 # else
87 # if (HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_LONG || ! (defined LONG_LONG_MAX || defined LLONG_MAX))
88 # define HOST_WIDE_INT long
89 # else
90 # define HOST_WIDE_INT long long
91 # endif
92 # endif
93 # endif
94 #endif
96 #ifndef unsigned_HOST_WIDE_INT
97 #define unsigned_HOST_WIDE_INT unsigned HOST_WIDE_INT
98 #endif
100 #ifndef CHAR_BIT
101 #define CHAR_BIT 8
102 #endif
104 #ifndef HOST_BITS_PER_WIDE_INT
105 #define HOST_BITS_PER_WIDE_INT (CHAR_BIT * sizeof (HOST_WIDE_INT))
106 #endif
108 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
109 # define __attribute__(x)
110 #endif
112 #ifndef PROTO
113 # if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
114 # define PROTO(ARGS) ARGS
115 # else
116 # define PROTO(ARGS) ()
117 # endif
118 #endif
120 #if defined (__STDC__) && defined (HAVE_VPRINTF)
121 # include <stdarg.h>
122 # define VA_START(va_list, var) va_start (va_list, var)
123 # define PRINTF_ALIST(msg) char *msg, ...
124 # define PRINTF_DCL(msg)
125 # define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
126 #else
127 # include <varargs.h>
128 # define VA_START(va_list, var) va_start (va_list)
129 # define PRINTF_ALIST(msg) msg, va_alist
130 # define PRINTF_DCL(msg) char *msg; va_dcl
131 # define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
132 # define vfprintf(file, msg, args) \
134 char *a0 = va_arg(args, char *); \
135 char *a1 = va_arg(args, char *); \
136 char *a2 = va_arg(args, char *); \
137 char *a3 = va_arg(args, char *); \
138 fprintf (file, msg, a0, a1, a2, a3); \
140 #endif
142 #define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
144 HOST_WIDE_INT parse_c_expression PROTO((char *, int));
146 static int yylex PROTO((void));
147 static void yyerror PROTO((char *)) __attribute__ ((noreturn));
148 static HOST_WIDE_INT expression_value;
149 #ifdef TEST_EXP_READER
150 static int expression_signedp;
151 #endif
153 static jmp_buf parse_return_error;
155 /* Nonzero means count most punctuation as part of a name. */
156 static int keyword_parsing = 0;
158 /* Nonzero means do not evaluate this expression.
159 This is a count, since unevaluated expressions can nest. */
160 static int skip_evaluation;
162 /* Nonzero means warn if undefined identifiers are evaluated. */
163 static int warn_undef;
165 /* some external tables of character types */
166 extern unsigned char is_idstart[], is_idchar[], is_space[];
168 /* Flag for -pedantic. */
169 extern int pedantic;
171 /* Flag for -traditional. */
172 extern int traditional;
174 /* Flag for -lang-c89. */
175 extern int c89;
177 #ifndef CHAR_TYPE_SIZE
178 #define CHAR_TYPE_SIZE BITS_PER_UNIT
179 #endif
181 #ifndef INT_TYPE_SIZE
182 #define INT_TYPE_SIZE BITS_PER_WORD
183 #endif
185 #ifndef LONG_TYPE_SIZE
186 #define LONG_TYPE_SIZE BITS_PER_WORD
187 #endif
189 #ifndef WCHAR_TYPE_SIZE
190 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
191 #endif
193 #ifndef MAX_CHAR_TYPE_SIZE
194 #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
195 #endif
197 #ifndef MAX_INT_TYPE_SIZE
198 #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
199 #endif
201 #ifndef MAX_LONG_TYPE_SIZE
202 #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
203 #endif
205 #ifndef MAX_WCHAR_TYPE_SIZE
206 #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
207 #endif
209 #define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
210 ? (~ (~ (HOST_WIDE_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
211 : ~ (HOST_WIDE_INT) 0)
213 #define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
214 ? ~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
215 : ~ (HOST_WIDE_INT) 0)
217 /* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow.
218 Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1.
219 Suppose SIGNEDP is negative if the result is signed, zero if unsigned.
220 Then this yields nonzero if overflow occurred during the addition.
221 Overflow occurs if A and B have the same sign, but A and SUM differ in sign,
222 and SIGNEDP is negative.
223 Use `^' to test whether signs differ, and `< 0' to isolate the sign. */
224 #define overflow_sum_sign(a, b, sum, signedp) \
225 ((~((a) ^ (b)) & ((a) ^ (sum)) & (signedp)) < 0)
227 struct constant;
229 GENERIC_PTR xmalloc PROTO((size_t));
230 HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
231 int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
232 struct hashnode *lookup PROTO((U_CHAR *, int, int));
233 void error PRINTF_PROTO_1((char *, ...));
234 void pedwarn PRINTF_PROTO_1((char *, ...));
235 void warning PRINTF_PROTO_1((char *, ...));
237 static int parse_number PROTO((int));
238 static HOST_WIDE_INT left_shift PROTO((struct constant *, unsigned_HOST_WIDE_INT));
239 static HOST_WIDE_INT right_shift PROTO((struct constant *, unsigned_HOST_WIDE_INT));
240 static void integer_overflow PROTO((void));
242 /* `signedp' values */
243 #define SIGNED (~0)
244 #define UNSIGNED 0
246 #line 251 "cexp.y"
247 typedef union {
248 struct constant {HOST_WIDE_INT value; int signedp;} integer;
249 struct name {U_CHAR *address; int length;} name;
250 struct arglist *keywords;
251 } YYSTYPE;
252 #include <stdio.h>
254 #ifndef __cplusplus
255 #ifndef __STDC__
256 #define const
257 #endif
258 #endif
262 #define YYFINAL 77
263 #define YYFLAG -32768
264 #define YYNTBASE 34
266 #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 43)
268 static const char yytranslate[] = { 0,
269 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
270 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
271 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
272 2, 2, 29, 2, 31, 2, 27, 14, 2, 32,
273 33, 25, 23, 9, 24, 2, 26, 2, 2, 2,
274 2, 2, 2, 2, 2, 2, 2, 8, 2, 17,
275 2, 18, 7, 2, 2, 2, 2, 2, 2, 2,
276 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
277 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
278 2, 2, 2, 13, 2, 2, 2, 2, 2, 2,
279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
281 2, 2, 2, 12, 2, 30, 2, 2, 2, 2,
282 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
291 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
292 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
293 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
294 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
295 6, 10, 11, 15, 16, 19, 20, 21, 22, 28
298 #if YYDEBUG != 0
299 static const short yyprhs[] = { 0,
300 0, 2, 4, 8, 11, 14, 17, 20, 23, 24,
301 31, 35, 39, 43, 47, 51, 55, 59, 63, 67,
302 71, 75, 79, 83, 87, 91, 95, 99, 100, 105,
303 106, 111, 112, 113, 121, 123, 125, 127, 128, 133
306 static const short yyrhs[] = { 35,
307 0, 36, 0, 35, 9, 36, 0, 24, 36, 0,
308 29, 36, 0, 23, 36, 0, 30, 36, 0, 31,
309 5, 0, 0, 31, 5, 37, 32, 42, 33, 0,
310 32, 35, 33, 0, 36, 25, 36, 0, 36, 26,
311 36, 0, 36, 27, 36, 0, 36, 23, 36, 0,
312 36, 24, 36, 0, 36, 21, 36, 0, 36, 22,
313 36, 0, 36, 15, 36, 0, 36, 16, 36, 0,
314 36, 19, 36, 0, 36, 20, 36, 0, 36, 17,
315 36, 0, 36, 18, 36, 0, 36, 14, 36, 0,
316 36, 13, 36, 0, 36, 12, 36, 0, 0, 36,
317 11, 38, 36, 0, 0, 36, 10, 39, 36, 0,
318 0, 0, 36, 7, 40, 36, 8, 41, 36, 0,
319 3, 0, 4, 0, 5, 0, 0, 32, 42, 33,
320 42, 0, 5, 42, 0
323 #endif
325 #if YYDEBUG != 0
326 static const short yyrline[] = { 0,
327 281, 291, 292, 299, 304, 307, 309, 312, 316, 318,
328 323, 328, 341, 358, 371, 377, 383, 389, 395, 398,
329 401, 408, 415, 422, 429, 432, 435, 438, 441, 444,
330 447, 450, 452, 455, 458, 460, 462, 470, 472, 485
332 #endif
335 #if YYDEBUG != 0
337 static const char * const yytname[] = { "$","error","$undefined.","INT","CHAR",
338 "NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
339 "'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
340 "'~'","'#'","'('","')'","start","exp1","exp","@1","@2","@3","@4","@5","keywords", NULL
342 #endif
344 static const short yyr1[] = { 0,
345 34, 35, 35, 36, 36, 36, 36, 36, 37, 36,
346 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
347 36, 36, 36, 36, 36, 36, 36, 38, 36, 39,
348 36, 40, 41, 36, 36, 36, 36, 42, 42, 42
351 static const short yyr2[] = { 0,
352 1, 1, 3, 2, 2, 2, 2, 2, 0, 6,
353 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
354 3, 3, 3, 3, 3, 3, 3, 0, 4, 0,
355 4, 0, 0, 7, 1, 1, 1, 0, 4, 2
358 static const short yydefact[] = { 0,
359 35, 36, 37, 0, 0, 0, 0, 0, 0, 1,
360 2, 6, 4, 5, 7, 8, 0, 0, 32, 30,
361 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
362 0, 0, 0, 0, 0, 0, 0, 0, 11, 3,
363 0, 0, 0, 27, 26, 25, 19, 20, 23, 24,
364 21, 22, 17, 18, 15, 16, 12, 13, 14, 38,
365 0, 31, 29, 38, 38, 0, 33, 40, 0, 10,
366 0, 38, 34, 39, 0, 0, 0
369 static const short yydefgoto[] = { 75,
370 10, 11, 38, 43, 42, 41, 71, 66
373 static const short yypact[] = { 12,
374 -32768,-32768,-32768, 12, 12, 12, 12, 1, 12, 4,
375 79,-32768,-32768,-32768,-32768, -21, 31, 12,-32768,-32768,
376 -32768, 12, 12, 12, 12, 12, 12, 12, 12, 12,
377 12, 12, 12, 12, 12, 12, 12, 30,-32768, 79,
378 12, 12, 12, 110, 124, 137, 148, 148, 155, 155,
379 155, 155, 160, 160, -17, -17,-32768,-32768,-32768, 2,
380 58, 34, 95, 2, 2, 54,-32768,-32768, 55,-32768,
381 12, 2, 79,-32768, 63, 188,-32768
384 static const short yypgoto[] = {-32768,
385 180, -4,-32768,-32768,-32768,-32768,-32768, -60
389 #define YYLAST 189
392 static const short yytable[] = { 12,
393 13, 14, 15, 68, 69, 16, 64, 35, 36, 37,
394 -9, 74, 18, 40, 1, 2, 3, 44, 45, 46,
395 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
396 57, 58, 59, 65, 4, 5, 61, 62, 63, 18,
397 6, 7, 8, 9, 21, 22, 23, 24, 25, 26,
398 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
399 37, 60, 76, 39, 19, 67, 73, 20, 21, 22,
400 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
401 33, 34, 35, 36, 37, 19, 70, 72, 20, 21,
402 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
403 32, 33, 34, 35, 36, 37, 22, 23, 24, 25,
404 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
405 36, 37, 23, 24, 25, 26, 27, 28, 29, 30,
406 31, 32, 33, 34, 35, 36, 37, 24, 25, 26,
407 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
408 37, 25, 26, 27, 28, 29, 30, 31, 32, 33,
409 34, 35, 36, 37, 27, 28, 29, 30, 31, 32,
410 33, 34, 35, 36, 37, 31, 32, 33, 34, 35,
411 36, 37, 33, 34, 35, 36, 37, 77, 17
414 static const short yycheck[] = { 4,
415 5, 6, 7, 64, 65, 5, 5, 25, 26, 27,
416 32, 72, 9, 18, 3, 4, 5, 22, 23, 24,
417 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
418 35, 36, 37, 32, 23, 24, 41, 42, 43, 9,
419 29, 30, 31, 32, 11, 12, 13, 14, 15, 16,
420 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
421 27, 32, 0, 33, 7, 8, 71, 10, 11, 12,
422 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
423 23, 24, 25, 26, 27, 7, 33, 33, 10, 11,
424 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
425 22, 23, 24, 25, 26, 27, 12, 13, 14, 15,
426 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
427 26, 27, 13, 14, 15, 16, 17, 18, 19, 20,
428 21, 22, 23, 24, 25, 26, 27, 14, 15, 16,
429 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
430 27, 15, 16, 17, 18, 19, 20, 21, 22, 23,
431 24, 25, 26, 27, 17, 18, 19, 20, 21, 22,
432 23, 24, 25, 26, 27, 21, 22, 23, 24, 25,
433 26, 27, 23, 24, 25, 26, 27, 0, 9
435 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
436 #line 3 "/usr/share/bison.simple"
438 /* Skeleton output parser for bison,
439 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
441 This program is free software; you can redistribute it and/or modify
442 it under the terms of the GNU General Public License as published by
443 the Free Software Foundation; either version 2, or (at your option)
444 any later version.
446 This program is distributed in the hope that it will be useful,
447 but WITHOUT ANY WARRANTY; without even the implied warranty of
448 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
449 GNU General Public License for more details.
451 You should have received a copy of the GNU General Public License
452 along with this program; if not, write to the Free Software
453 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
455 /* As a special exception, when this file is copied by Bison into a
456 Bison output file, you may use that output file without restriction.
457 This special exception was added by the Free Software Foundation
458 in version 1.24 of Bison. */
460 #ifndef alloca
461 #ifdef __GNUC__
462 #define alloca __builtin_alloca
463 #else /* not GNU C. */
464 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
465 #include <alloca.h>
466 #else /* not sparc */
467 #if defined (MSDOS) && !defined (__TURBOC__)
468 #include <malloc.h>
469 #else /* not MSDOS, or __TURBOC__ */
470 #if defined(_AIX)
471 #include <malloc.h>
472 #pragma alloca
473 #else /* not MSDOS, __TURBOC__, or _AIX */
474 #ifdef __hpux
475 #ifdef __cplusplus
476 extern "C" {
477 void *alloca (unsigned int);
479 #else /* not __cplusplus */
480 void *alloca ();
481 #endif /* not __cplusplus */
482 #endif /* __hpux */
483 #endif /* not _AIX */
484 #endif /* not MSDOS, or __TURBOC__ */
485 #endif /* not sparc. */
486 #endif /* not GNU C. */
487 #endif /* alloca not defined. */
489 /* This is the parser code that is written into each bison parser
490 when the %semantic_parser declaration is not specified in the grammar.
491 It was written by Richard Stallman by simplifying the hairy parser
492 used when %semantic_parser is specified. */
494 /* Note: there must be only one dollar sign in this file.
495 It is replaced by the list of actions, each action
496 as one case of the switch. */
498 #define yyerrok (yyerrstatus = 0)
499 #define yyclearin (yychar = YYEMPTY)
500 #define YYEMPTY -2
501 #define YYEOF 0
502 #define YYACCEPT return(0)
503 #define YYABORT return(1)
504 #define YYERROR goto yyerrlab1
505 /* Like YYERROR except do call yyerror.
506 This remains here temporarily to ease the
507 transition to the new meaning of YYERROR, for GCC.
508 Once GCC version 2 has supplanted version 1, this can go. */
509 #define YYFAIL goto yyerrlab
510 #define YYRECOVERING() (!!yyerrstatus)
511 #define YYBACKUP(token, value) \
512 do \
513 if (yychar == YYEMPTY && yylen == 1) \
514 { yychar = (token), yylval = (value); \
515 yychar1 = YYTRANSLATE (yychar); \
516 YYPOPSTACK; \
517 goto yybackup; \
519 else \
520 { yyerror ("syntax error: cannot back up"); YYERROR; } \
521 while (0)
523 #define YYTERROR 1
524 #define YYERRCODE 256
526 #ifndef YYPURE
527 #define YYLEX yylex()
528 #endif
530 #ifdef YYPURE
531 #ifdef YYLSP_NEEDED
532 #ifdef YYLEX_PARAM
533 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
534 #else
535 #define YYLEX yylex(&yylval, &yylloc)
536 #endif
537 #else /* not YYLSP_NEEDED */
538 #ifdef YYLEX_PARAM
539 #define YYLEX yylex(&yylval, YYLEX_PARAM)
540 #else
541 #define YYLEX yylex(&yylval)
542 #endif
543 #endif /* not YYLSP_NEEDED */
544 #endif
546 /* If nonreentrant, generate the variables here */
548 #ifndef YYPURE
550 int yychar; /* the lookahead symbol */
551 YYSTYPE yylval; /* the semantic value of the */
552 /* lookahead symbol */
554 #ifdef YYLSP_NEEDED
555 YYLTYPE yylloc; /* location data for the lookahead */
556 /* symbol */
557 #endif
559 int yynerrs; /* number of parse errors so far */
560 #endif /* not YYPURE */
562 #if YYDEBUG != 0
563 int yydebug; /* nonzero means print parse trace */
564 /* Since this is uninitialized, it does not stop multiple parsers
565 from coexisting. */
566 #endif
568 /* YYINITDEPTH indicates the initial size of the parser's stacks */
570 #ifndef YYINITDEPTH
571 #define YYINITDEPTH 200
572 #endif
574 /* YYMAXDEPTH is the maximum size the stacks can grow to
575 (effective only if the built-in stack extension method is used). */
577 #if YYMAXDEPTH == 0
578 #undef YYMAXDEPTH
579 #endif
581 #ifndef YYMAXDEPTH
582 #define YYMAXDEPTH 10000
583 #endif
585 /* Prevent warning if -Wstrict-prototypes. */
586 #ifdef __GNUC__
587 int yyparse (void);
588 #endif
590 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
591 #define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
592 #else /* not GNU C or C++ */
593 #ifndef __cplusplus
595 /* This is the most reliable way to avoid incompatibilities
596 in available built-in functions on various systems. */
597 static void
598 __yy_memcpy (from, to, count)
599 char *from;
600 char *to;
601 int count;
603 register char *f = from;
604 register char *t = to;
605 register int i = count;
607 while (i-- > 0)
608 *t++ = *f++;
611 #else /* __cplusplus */
613 /* This is the most reliable way to avoid incompatibilities
614 in available built-in functions on various systems. */
615 static void
616 __yy_memcpy (char *from, char *to, int count)
618 register char *f = from;
619 register char *t = to;
620 register int i = count;
622 while (i-- > 0)
623 *t++ = *f++;
626 #endif
627 #endif
629 #line 192 "/usr/share/bison.simple"
631 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
632 into yyparse. The argument should have type void *.
633 It should actually point to an object.
634 Grammar actions can access the variable by casting it
635 to the proper pointer type. */
637 #ifdef YYPARSE_PARAM
638 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
639 #else
640 #define YYPARSE_PARAM
641 #define YYPARSE_PARAM_DECL
642 #endif
645 yyparse(YYPARSE_PARAM)
646 YYPARSE_PARAM_DECL
648 register int yystate;
649 register int yyn;
650 register short *yyssp;
651 register YYSTYPE *yyvsp;
652 int yyerrstatus; /* number of tokens to shift before error messages enabled */
653 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
655 short yyssa[YYINITDEPTH]; /* the state stack */
656 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
658 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
659 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
661 #ifdef YYLSP_NEEDED
662 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
663 YYLTYPE *yyls = yylsa;
664 YYLTYPE *yylsp;
666 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
667 #else
668 #define YYPOPSTACK (yyvsp--, yyssp--)
669 #endif
671 int yystacksize = YYINITDEPTH;
673 #ifdef YYPURE
674 int yychar;
675 YYSTYPE yylval;
676 int yynerrs;
677 #ifdef YYLSP_NEEDED
678 YYLTYPE yylloc;
679 #endif
680 #endif
682 YYSTYPE yyval; /* the variable used to return */
683 /* semantic values from the action */
684 /* routines */
686 int yylen;
688 #if YYDEBUG != 0
689 if (yydebug)
690 fprintf(stderr, "Starting parse\n");
691 #endif
693 yystate = 0;
694 yyerrstatus = 0;
695 yynerrs = 0;
696 yychar = YYEMPTY; /* Cause a token to be read. */
698 /* Initialize stack pointers.
699 Waste one element of value and location stack
700 so that they stay on the same level as the state stack.
701 The wasted elements are never initialized. */
703 yyssp = yyss - 1;
704 yyvsp = yyvs;
705 #ifdef YYLSP_NEEDED
706 yylsp = yyls;
707 #endif
709 /* Push a new state, which is found in yystate . */
710 /* In all cases, when you get here, the value and location stacks
711 have just been pushed. so pushing a state here evens the stacks. */
712 yynewstate:
714 *++yyssp = yystate;
716 if (yyssp >= yyss + yystacksize - 1)
718 /* Give user a chance to reallocate the stack */
719 /* Use copies of these so that the &'s don't force the real ones into memory. */
720 YYSTYPE *yyvs1 = yyvs;
721 short *yyss1 = yyss;
722 #ifdef YYLSP_NEEDED
723 YYLTYPE *yyls1 = yyls;
724 #endif
726 /* Get the current used size of the three stacks, in elements. */
727 int size = yyssp - yyss + 1;
729 #ifdef yyoverflow
730 /* Each stack pointer address is followed by the size of
731 the data in use in that stack, in bytes. */
732 #ifdef YYLSP_NEEDED
733 /* This used to be a conditional around just the two extra args,
734 but that might be undefined if yyoverflow is a macro. */
735 yyoverflow("parser stack overflow",
736 &yyss1, size * sizeof (*yyssp),
737 &yyvs1, size * sizeof (*yyvsp),
738 &yyls1, size * sizeof (*yylsp),
739 &yystacksize);
740 #else
741 yyoverflow("parser stack overflow",
742 &yyss1, size * sizeof (*yyssp),
743 &yyvs1, size * sizeof (*yyvsp),
744 &yystacksize);
745 #endif
747 yyss = yyss1; yyvs = yyvs1;
748 #ifdef YYLSP_NEEDED
749 yyls = yyls1;
750 #endif
751 #else /* no yyoverflow */
752 /* Extend the stack our own way. */
753 if (yystacksize >= YYMAXDEPTH)
755 yyerror("parser stack overflow");
756 return 2;
758 yystacksize *= 2;
759 if (yystacksize > YYMAXDEPTH)
760 yystacksize = YYMAXDEPTH;
761 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
762 __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
763 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
764 __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
765 #ifdef YYLSP_NEEDED
766 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
767 __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
768 #endif
769 #endif /* no yyoverflow */
771 yyssp = yyss + size - 1;
772 yyvsp = yyvs + size - 1;
773 #ifdef YYLSP_NEEDED
774 yylsp = yyls + size - 1;
775 #endif
777 #if YYDEBUG != 0
778 if (yydebug)
779 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
780 #endif
782 if (yyssp >= yyss + yystacksize - 1)
783 YYABORT;
786 #if YYDEBUG != 0
787 if (yydebug)
788 fprintf(stderr, "Entering state %d\n", yystate);
789 #endif
791 goto yybackup;
792 yybackup:
794 /* Do appropriate processing given the current state. */
795 /* Read a lookahead token if we need one and don't already have one. */
796 /* yyresume: */
798 /* First try to decide what to do without reference to lookahead token. */
800 yyn = yypact[yystate];
801 if (yyn == YYFLAG)
802 goto yydefault;
804 /* Not known => get a lookahead token if don't already have one. */
806 /* yychar is either YYEMPTY or YYEOF
807 or a valid token in external form. */
809 if (yychar == YYEMPTY)
811 #if YYDEBUG != 0
812 if (yydebug)
813 fprintf(stderr, "Reading a token: ");
814 #endif
815 yychar = YYLEX;
818 /* Convert token to internal form (in yychar1) for indexing tables with */
820 if (yychar <= 0) /* This means end of input. */
822 yychar1 = 0;
823 yychar = YYEOF; /* Don't call YYLEX any more */
825 #if YYDEBUG != 0
826 if (yydebug)
827 fprintf(stderr, "Now at end of input.\n");
828 #endif
830 else
832 yychar1 = YYTRANSLATE(yychar);
834 #if YYDEBUG != 0
835 if (yydebug)
837 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
838 /* Give the individual parser a way to print the precise meaning
839 of a token, for further debugging info. */
840 #ifdef YYPRINT
841 YYPRINT (stderr, yychar, yylval);
842 #endif
843 fprintf (stderr, ")\n");
845 #endif
848 yyn += yychar1;
849 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
850 goto yydefault;
852 yyn = yytable[yyn];
854 /* yyn is what to do for this token type in this state.
855 Negative => reduce, -yyn is rule number.
856 Positive => shift, yyn is new state.
857 New state is final state => don't bother to shift,
858 just return success.
859 0, or most negative number => error. */
861 if (yyn < 0)
863 if (yyn == YYFLAG)
864 goto yyerrlab;
865 yyn = -yyn;
866 goto yyreduce;
868 else if (yyn == 0)
869 goto yyerrlab;
871 if (yyn == YYFINAL)
872 YYACCEPT;
874 /* Shift the lookahead token. */
876 #if YYDEBUG != 0
877 if (yydebug)
878 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
879 #endif
881 /* Discard the token being shifted unless it is eof. */
882 if (yychar != YYEOF)
883 yychar = YYEMPTY;
885 *++yyvsp = yylval;
886 #ifdef YYLSP_NEEDED
887 *++yylsp = yylloc;
888 #endif
890 /* count tokens shifted since error; after three, turn off error status. */
891 if (yyerrstatus) yyerrstatus--;
893 yystate = yyn;
894 goto yynewstate;
896 /* Do the default action for the current state. */
897 yydefault:
899 yyn = yydefact[yystate];
900 if (yyn == 0)
901 goto yyerrlab;
903 /* Do a reduction. yyn is the number of a rule to reduce with. */
904 yyreduce:
905 yylen = yyr2[yyn];
906 if (yylen > 0)
907 yyval = yyvsp[1-yylen]; /* implement default value of the action */
909 #if YYDEBUG != 0
910 if (yydebug)
912 int i;
914 fprintf (stderr, "Reducing via rule %d (line %d), ",
915 yyn, yyrline[yyn]);
917 /* Print the symbols being reduced, and their result. */
918 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
919 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
920 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
922 #endif
925 switch (yyn) {
927 case 1:
928 #line 282 "cexp.y"
930 expression_value = yyvsp[0].integer.value;
931 #ifdef TEST_EXP_READER
932 expression_signedp = yyvsp[0].integer.signedp;
933 #endif
935 break;}
936 case 3:
937 #line 293 "cexp.y"
938 { if (pedantic)
939 pedwarn ("comma operator in operand of `#if'");
940 yyval.integer = yyvsp[0].integer; ;
941 break;}
942 case 4:
943 #line 300 "cexp.y"
944 { yyval.integer.value = - yyvsp[0].integer.value;
945 yyval.integer.signedp = yyvsp[0].integer.signedp;
946 if ((yyval.integer.value & yyvsp[0].integer.value & yyval.integer.signedp) < 0)
947 integer_overflow (); ;
948 break;}
949 case 5:
950 #line 305 "cexp.y"
951 { yyval.integer.value = ! yyvsp[0].integer.value;
952 yyval.integer.signedp = SIGNED; ;
953 break;}
954 case 6:
955 #line 308 "cexp.y"
956 { yyval.integer = yyvsp[0].integer; ;
957 break;}
958 case 7:
959 #line 310 "cexp.y"
960 { yyval.integer.value = ~ yyvsp[0].integer.value;
961 yyval.integer.signedp = yyvsp[0].integer.signedp; ;
962 break;}
963 case 8:
964 #line 313 "cexp.y"
965 { yyval.integer.value = check_assertion (yyvsp[0].name.address, yyvsp[0].name.length,
966 0, NULL_PTR);
967 yyval.integer.signedp = SIGNED; ;
968 break;}
969 case 9:
970 #line 317 "cexp.y"
971 { keyword_parsing = 1; ;
972 break;}
973 case 10:
974 #line 319 "cexp.y"
975 { yyval.integer.value = check_assertion (yyvsp[-4].name.address, yyvsp[-4].name.length,
976 1, yyvsp[-1].keywords);
977 keyword_parsing = 0;
978 yyval.integer.signedp = SIGNED; ;
979 break;}
980 case 11:
981 #line 324 "cexp.y"
982 { yyval.integer = yyvsp[-1].integer; ;
983 break;}
984 case 12:
985 #line 329 "cexp.y"
986 { yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
987 if (yyval.integer.signedp)
989 yyval.integer.value = yyvsp[-2].integer.value * yyvsp[0].integer.value;
990 if (yyvsp[-2].integer.value
991 && (yyval.integer.value / yyvsp[-2].integer.value != yyvsp[0].integer.value
992 || (yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0))
993 integer_overflow ();
995 else
996 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
997 * yyvsp[0].integer.value); ;
998 break;}
999 case 13:
1000 #line 342 "cexp.y"
1001 { if (yyvsp[0].integer.value == 0)
1003 if (!skip_evaluation)
1004 error ("division by zero in #if");
1005 yyvsp[0].integer.value = 1;
1007 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
1008 if (yyval.integer.signedp)
1010 yyval.integer.value = yyvsp[-2].integer.value / yyvsp[0].integer.value;
1011 if ((yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0)
1012 integer_overflow ();
1014 else
1015 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
1016 / yyvsp[0].integer.value); ;
1017 break;}
1018 case 14:
1019 #line 359 "cexp.y"
1020 { if (yyvsp[0].integer.value == 0)
1022 if (!skip_evaluation)
1023 error ("division by zero in #if");
1024 yyvsp[0].integer.value = 1;
1026 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
1027 if (yyval.integer.signedp)
1028 yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value;
1029 else
1030 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
1031 % yyvsp[0].integer.value); ;
1032 break;}
1033 case 15:
1034 #line 372 "cexp.y"
1035 { yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value;
1036 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
1037 if (overflow_sum_sign (yyvsp[-2].integer.value, yyvsp[0].integer.value,
1038 yyval.integer.value, yyval.integer.signedp))
1039 integer_overflow (); ;
1040 break;}
1041 case 16:
1042 #line 378 "cexp.y"
1043 { yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value;
1044 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
1045 if (overflow_sum_sign (yyval.integer.value, yyvsp[0].integer.value,
1046 yyvsp[-2].integer.value, yyval.integer.signedp))
1047 integer_overflow (); ;
1048 break;}
1049 case 17:
1050 #line 384 "cexp.y"
1051 { yyval.integer.signedp = yyvsp[-2].integer.signedp;
1052 if ((yyvsp[0].integer.value & yyvsp[0].integer.signedp) < 0)
1053 yyval.integer.value = right_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
1054 else
1055 yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
1056 break;}
1057 case 18:
1058 #line 390 "cexp.y"
1059 { yyval.integer.signedp = yyvsp[-2].integer.signedp;
1060 if ((yyvsp[0].integer.value & yyvsp[0].integer.signedp) < 0)
1061 yyval.integer.value = left_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
1062 else
1063 yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
1064 break;}
1065 case 19:
1066 #line 396 "cexp.y"
1067 { yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
1068 yyval.integer.signedp = SIGNED; ;
1069 break;}
1070 case 20:
1071 #line 399 "cexp.y"
1072 { yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
1073 yyval.integer.signedp = SIGNED; ;
1074 break;}
1075 case 21:
1076 #line 402 "cexp.y"
1077 { yyval.integer.signedp = SIGNED;
1078 if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
1079 yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value;
1080 else
1081 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
1082 <= yyvsp[0].integer.value); ;
1083 break;}
1084 case 22:
1085 #line 409 "cexp.y"
1086 { yyval.integer.signedp = SIGNED;
1087 if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
1088 yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value;
1089 else
1090 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
1091 >= yyvsp[0].integer.value); ;
1092 break;}
1093 case 23:
1094 #line 416 "cexp.y"
1095 { yyval.integer.signedp = SIGNED;
1096 if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
1097 yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value;
1098 else
1099 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
1100 < yyvsp[0].integer.value); ;
1101 break;}
1102 case 24:
1103 #line 423 "cexp.y"
1104 { yyval.integer.signedp = SIGNED;
1105 if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
1106 yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value;
1107 else
1108 yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
1109 > yyvsp[0].integer.value); ;
1110 break;}
1111 case 25:
1112 #line 430 "cexp.y"
1113 { yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value;
1114 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp; ;
1115 break;}
1116 case 26:
1117 #line 433 "cexp.y"
1118 { yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value;
1119 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp; ;
1120 break;}
1121 case 27:
1122 #line 436 "cexp.y"
1123 { yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value;
1124 yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp; ;
1125 break;}
1126 case 28:
1127 #line 439 "cexp.y"
1128 { skip_evaluation += !yyvsp[-1].integer.value; ;
1129 break;}
1130 case 29:
1131 #line 441 "cexp.y"
1132 { skip_evaluation -= !yyvsp[-3].integer.value;
1133 yyval.integer.value = (yyvsp[-3].integer.value && yyvsp[0].integer.value);
1134 yyval.integer.signedp = SIGNED; ;
1135 break;}
1136 case 30:
1137 #line 445 "cexp.y"
1138 { skip_evaluation += !!yyvsp[-1].integer.value; ;
1139 break;}
1140 case 31:
1141 #line 447 "cexp.y"
1142 { skip_evaluation -= !!yyvsp[-3].integer.value;
1143 yyval.integer.value = (yyvsp[-3].integer.value || yyvsp[0].integer.value);
1144 yyval.integer.signedp = SIGNED; ;
1145 break;}
1146 case 32:
1147 #line 451 "cexp.y"
1148 { skip_evaluation += !yyvsp[-1].integer.value; ;
1149 break;}
1150 case 33:
1151 #line 453 "cexp.y"
1152 { skip_evaluation += !!yyvsp[-4].integer.value - !yyvsp[-4].integer.value; ;
1153 break;}
1154 case 34:
1155 #line 455 "cexp.y"
1156 { skip_evaluation -= !!yyvsp[-6].integer.value;
1157 yyval.integer.value = yyvsp[-6].integer.value ? yyvsp[-3].integer.value : yyvsp[0].integer.value;
1158 yyval.integer.signedp = yyvsp[-3].integer.signedp & yyvsp[0].integer.signedp; ;
1159 break;}
1160 case 35:
1161 #line 459 "cexp.y"
1162 { yyval.integer = yylval.integer; ;
1163 break;}
1164 case 36:
1165 #line 461 "cexp.y"
1166 { yyval.integer = yylval.integer; ;
1167 break;}
1168 case 37:
1169 #line 463 "cexp.y"
1170 { if (warn_undef && !skip_evaluation)
1171 warning ("`%.*s' is not defined",
1172 yyvsp[0].name.length, yyvsp[0].name.address);
1173 yyval.integer.value = 0;
1174 yyval.integer.signedp = SIGNED; ;
1175 break;}
1176 case 38:
1177 #line 471 "cexp.y"
1178 { yyval.keywords = 0; ;
1179 break;}
1180 case 39:
1181 #line 473 "cexp.y"
1182 { struct arglist *temp;
1183 yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
1184 yyval.keywords->next = yyvsp[-2].keywords;
1185 yyval.keywords->name = (U_CHAR *) "(";
1186 yyval.keywords->length = 1;
1187 temp = yyval.keywords;
1188 while (temp != 0 && temp->next != 0)
1189 temp = temp->next;
1190 temp->next = (struct arglist *) xmalloc (sizeof (struct arglist));
1191 temp->next->next = yyvsp[0].keywords;
1192 temp->next->name = (U_CHAR *) ")";
1193 temp->next->length = 1; ;
1194 break;}
1195 case 40:
1196 #line 486 "cexp.y"
1197 { yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
1198 yyval.keywords->name = yyvsp[-1].name.address;
1199 yyval.keywords->length = yyvsp[-1].name.length;
1200 yyval.keywords->next = yyvsp[0].keywords; ;
1201 break;}
1203 /* the action file gets copied in in place of this dollarsign */
1204 #line 487 "/usr/share/bison.simple"
1206 yyvsp -= yylen;
1207 yyssp -= yylen;
1208 #ifdef YYLSP_NEEDED
1209 yylsp -= yylen;
1210 #endif
1212 #if YYDEBUG != 0
1213 if (yydebug)
1215 short *ssp1 = yyss - 1;
1216 fprintf (stderr, "state stack now");
1217 while (ssp1 != yyssp)
1218 fprintf (stderr, " %d", *++ssp1);
1219 fprintf (stderr, "\n");
1221 #endif
1223 *++yyvsp = yyval;
1225 #ifdef YYLSP_NEEDED
1226 yylsp++;
1227 if (yylen == 0)
1229 yylsp->first_line = yylloc.first_line;
1230 yylsp->first_column = yylloc.first_column;
1231 yylsp->last_line = (yylsp-1)->last_line;
1232 yylsp->last_column = (yylsp-1)->last_column;
1233 yylsp->text = 0;
1235 else
1237 yylsp->last_line = (yylsp+yylen-1)->last_line;
1238 yylsp->last_column = (yylsp+yylen-1)->last_column;
1240 #endif
1242 /* Now "shift" the result of the reduction.
1243 Determine what state that goes to,
1244 based on the state we popped back to
1245 and the rule number reduced by. */
1247 yyn = yyr1[yyn];
1249 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1250 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1251 yystate = yytable[yystate];
1252 else
1253 yystate = yydefgoto[yyn - YYNTBASE];
1255 goto yynewstate;
1257 yyerrlab: /* here on detecting error */
1259 if (! yyerrstatus)
1260 /* If not already recovering from an error, report this error. */
1262 ++yynerrs;
1264 #ifdef YYERROR_VERBOSE
1265 yyn = yypact[yystate];
1267 if (yyn > YYFLAG && yyn < YYLAST)
1269 int size = 0;
1270 char *msg;
1271 int x, count;
1273 count = 0;
1274 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1275 for (x = (yyn < 0 ? -yyn : 0);
1276 x < (sizeof(yytname) / sizeof(char *)); x++)
1277 if (yycheck[x + yyn] == x)
1278 size += strlen(yytname[x]) + 15, count++;
1279 msg = (char *) malloc(size + 15);
1280 if (msg != 0)
1282 strcpy(msg, "parse error");
1284 if (count < 5)
1286 count = 0;
1287 for (x = (yyn < 0 ? -yyn : 0);
1288 x < (sizeof(yytname) / sizeof(char *)); x++)
1289 if (yycheck[x + yyn] == x)
1291 strcat(msg, count == 0 ? ", expecting `" : " or `");
1292 strcat(msg, yytname[x]);
1293 strcat(msg, "'");
1294 count++;
1297 yyerror(msg);
1298 free(msg);
1300 else
1301 yyerror ("parse error; also virtual memory exceeded");
1303 else
1304 #endif /* YYERROR_VERBOSE */
1305 yyerror("parse error");
1308 goto yyerrlab1;
1309 yyerrlab1: /* here on error raised explicitly by an action */
1311 if (yyerrstatus == 3)
1313 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1315 /* return failure if at end of input */
1316 if (yychar == YYEOF)
1317 YYABORT;
1319 #if YYDEBUG != 0
1320 if (yydebug)
1321 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1322 #endif
1324 yychar = YYEMPTY;
1327 /* Else will try to reuse lookahead token
1328 after shifting the error token. */
1330 yyerrstatus = 3; /* Each real token shifted decrements this */
1332 goto yyerrhandle;
1334 yyerrdefault: /* current state does not do anything special for the error token. */
1336 #if 0
1337 /* This is wrong; only states that explicitly want error tokens
1338 should shift them. */
1339 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1340 if (yyn) goto yydefault;
1341 #endif
1343 yyerrpop: /* pop the current state because it cannot handle the error token */
1345 if (yyssp == yyss) YYABORT;
1346 yyvsp--;
1347 yystate = *--yyssp;
1348 #ifdef YYLSP_NEEDED
1349 yylsp--;
1350 #endif
1352 #if YYDEBUG != 0
1353 if (yydebug)
1355 short *ssp1 = yyss - 1;
1356 fprintf (stderr, "Error: state stack now");
1357 while (ssp1 != yyssp)
1358 fprintf (stderr, " %d", *++ssp1);
1359 fprintf (stderr, "\n");
1361 #endif
1363 yyerrhandle:
1365 yyn = yypact[yystate];
1366 if (yyn == YYFLAG)
1367 goto yyerrdefault;
1369 yyn += YYTERROR;
1370 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1371 goto yyerrdefault;
1373 yyn = yytable[yyn];
1374 if (yyn < 0)
1376 if (yyn == YYFLAG)
1377 goto yyerrpop;
1378 yyn = -yyn;
1379 goto yyreduce;
1381 else if (yyn == 0)
1382 goto yyerrpop;
1384 if (yyn == YYFINAL)
1385 YYACCEPT;
1387 #if YYDEBUG != 0
1388 if (yydebug)
1389 fprintf(stderr, "Shifting error token, ");
1390 #endif
1392 *++yyvsp = yylval;
1393 #ifdef YYLSP_NEEDED
1394 *++yylsp = yylloc;
1395 #endif
1397 yystate = yyn;
1398 goto yynewstate;
1400 #line 491 "cexp.y"
1403 /* During parsing of a C expression, the pointer to the next character
1404 is in this variable. */
1406 static char *lexptr;
1408 /* Take care of parsing a number (anything that starts with a digit).
1409 Set yylval and return the token type; update lexptr.
1410 LEN is the number of characters in it. */
1412 /* maybe needs to actually deal with floating point numbers */
1414 static int
1415 parse_number (olen)
1416 int olen;
1418 register char *p = lexptr;
1419 register int c;
1420 register unsigned_HOST_WIDE_INT n = 0, nd, max_over_base;
1421 register int base = 10;
1422 register int len = olen;
1423 register int overflow = 0;
1424 register int digit, largest_digit = 0;
1425 int spec_long = 0;
1427 yylval.integer.signedp = SIGNED;
1429 if (*p == '0') {
1430 base = 8;
1431 if (len >= 3 && (p[1] == 'x' || p[1] == 'X')) {
1432 p += 2;
1433 base = 16;
1434 len -= 2;
1438 max_over_base = (unsigned_HOST_WIDE_INT) -1 / base;
1440 for (; len > 0; len--) {
1441 c = *p++;
1443 if (c >= '0' && c <= '9')
1444 digit = c - '0';
1445 else if (base == 16 && c >= 'a' && c <= 'f')
1446 digit = c - 'a' + 10;
1447 else if (base == 16 && c >= 'A' && c <= 'F')
1448 digit = c - 'A' + 10;
1449 else {
1450 /* `l' means long, and `u' means unsigned. */
1451 while (1) {
1452 if (c == 'l' || c == 'L')
1454 if (!pedantic < spec_long)
1455 yyerror ("too many `l's in integer constant");
1456 spec_long++;
1458 else if (c == 'u' || c == 'U')
1460 if (! yylval.integer.signedp)
1461 yyerror ("two `u's in integer constant");
1462 yylval.integer.signedp = UNSIGNED;
1464 else {
1465 if (c == '.' || c == 'e' || c == 'E' || c == 'p' || c == 'P')
1466 yyerror ("Floating point numbers not allowed in #if expressions");
1467 else {
1468 char *buf = (char *) alloca (p - lexptr + 40);
1469 sprintf (buf, "missing white space after number `%.*s'",
1470 (int) (p - lexptr - 1), lexptr);
1471 yyerror (buf);
1475 if (--len == 0)
1476 break;
1477 c = *p++;
1479 /* Don't look for any more digits after the suffixes. */
1480 break;
1482 if (largest_digit < digit)
1483 largest_digit = digit;
1484 nd = n * base + digit;
1485 overflow |= (max_over_base < n) | (nd < n);
1486 n = nd;
1489 if (base <= largest_digit)
1490 pedwarn ("integer constant contains digits beyond the radix");
1492 if (overflow)
1493 pedwarn ("integer constant out of range");
1495 /* If too big to be signed, consider it unsigned. */
1496 if (((HOST_WIDE_INT) n & yylval.integer.signedp) < 0)
1498 if (base == 10)
1499 warning ("integer constant is so large that it is unsigned");
1500 yylval.integer.signedp = UNSIGNED;
1503 lexptr = p;
1504 yylval.integer.value = n;
1505 return INT;
1508 struct token {
1509 char *operator;
1510 int token;
1513 static struct token tokentab2[] = {
1514 {"&&", AND},
1515 {"||", OR},
1516 {"<<", LSH},
1517 {">>", RSH},
1518 {"==", EQUAL},
1519 {"!=", NOTEQUAL},
1520 {"<=", LEQ},
1521 {">=", GEQ},
1522 {"++", ERROR},
1523 {"--", ERROR},
1524 {NULL, ERROR}
1527 /* Read one token, getting characters through lexptr. */
1529 static int
1530 yylex ()
1532 register int c;
1533 register int namelen;
1534 register unsigned char *tokstart;
1535 register struct token *toktab;
1536 int wide_flag;
1537 HOST_WIDE_INT mask;
1539 retry:
1541 tokstart = (unsigned char *) lexptr;
1542 c = *tokstart;
1543 /* See if it is a special token of length 2. */
1544 if (! keyword_parsing)
1545 for (toktab = tokentab2; toktab->operator != NULL; toktab++)
1546 if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
1547 lexptr += 2;
1548 if (toktab->token == ERROR)
1550 char *buf = (char *) alloca (40);
1551 sprintf (buf, "`%s' not allowed in operand of `#if'", toktab->operator);
1552 yyerror (buf);
1554 return toktab->token;
1557 switch (c) {
1558 case '\n':
1559 return 0;
1561 case ' ':
1562 case '\t':
1563 case '\r':
1564 lexptr++;
1565 goto retry;
1567 case 'L':
1568 /* Capital L may start a wide-string or wide-character constant. */
1569 if (lexptr[1] == '\'')
1571 lexptr++;
1572 wide_flag = 1;
1573 mask = MAX_WCHAR_TYPE_MASK;
1574 goto char_constant;
1576 if (lexptr[1] == '"')
1578 lexptr++;
1579 wide_flag = 1;
1580 mask = MAX_WCHAR_TYPE_MASK;
1581 goto string_constant;
1583 break;
1585 case '\'':
1586 wide_flag = 0;
1587 mask = MAX_CHAR_TYPE_MASK;
1588 char_constant:
1589 lexptr++;
1590 if (keyword_parsing) {
1591 char *start_ptr = lexptr - 1;
1592 while (1) {
1593 c = *lexptr++;
1594 if (c == '\\')
1595 c = parse_escape (&lexptr, mask);
1596 else if (c == '\'')
1597 break;
1599 yylval.name.address = tokstart;
1600 yylval.name.length = lexptr - start_ptr;
1601 return NAME;
1604 /* This code for reading a character constant
1605 handles multicharacter constants and wide characters.
1606 It is mostly copied from c-lex.c. */
1608 register HOST_WIDE_INT result = 0;
1609 register int num_chars = 0;
1610 unsigned width = MAX_CHAR_TYPE_SIZE;
1611 int max_chars;
1612 char *token_buffer;
1614 if (wide_flag)
1616 width = MAX_WCHAR_TYPE_SIZE;
1617 #ifdef MULTIBYTE_CHARS
1618 max_chars = MB_CUR_MAX;
1619 #else
1620 max_chars = 1;
1621 #endif
1623 else
1624 max_chars = MAX_LONG_TYPE_SIZE / width;
1626 token_buffer = (char *) alloca (max_chars + 1);
1628 while (1)
1630 c = *lexptr++;
1632 if (c == '\'' || c == EOF)
1633 break;
1635 if (c == '\\')
1637 c = parse_escape (&lexptr, mask);
1640 num_chars++;
1642 /* Merge character into result; ignore excess chars. */
1643 if (num_chars <= max_chars)
1645 if (width < HOST_BITS_PER_WIDE_INT)
1646 result = (result << width) | c;
1647 else
1648 result = c;
1649 token_buffer[num_chars - 1] = c;
1653 token_buffer[num_chars] = 0;
1655 if (c != '\'')
1656 error ("malformatted character constant");
1657 else if (num_chars == 0)
1658 error ("empty character constant");
1659 else if (num_chars > max_chars)
1661 num_chars = max_chars;
1662 error ("character constant too long");
1664 else if (num_chars != 1 && ! traditional)
1665 warning ("multi-character character constant");
1667 /* If char type is signed, sign-extend the constant. */
1668 if (! wide_flag)
1670 int num_bits = num_chars * width;
1672 if (lookup ((U_CHAR *) "__CHAR_UNSIGNED__",
1673 sizeof ("__CHAR_UNSIGNED__") - 1, -1)
1674 || ((result >> (num_bits - 1)) & 1) == 0)
1675 yylval.integer.value
1676 = result & (~ (unsigned_HOST_WIDE_INT) 0
1677 >> (HOST_BITS_PER_WIDE_INT - num_bits));
1678 else
1679 yylval.integer.value
1680 = result | ~(~ (unsigned_HOST_WIDE_INT) 0
1681 >> (HOST_BITS_PER_WIDE_INT - num_bits));
1683 else
1685 #ifdef MULTIBYTE_CHARS
1686 /* Set the initial shift state and convert the next sequence. */
1687 result = 0;
1688 /* In all locales L'\0' is zero and mbtowc will return zero,
1689 so don't use it. */
1690 if (num_chars > 1
1691 || (num_chars == 1 && token_buffer[0] != '\0'))
1693 wchar_t wc;
1694 (void) mbtowc (NULL_PTR, NULL_PTR, 0);
1695 if (mbtowc (& wc, token_buffer, num_chars) == num_chars)
1696 result = wc;
1697 else
1698 pedwarn ("Ignoring invalid multibyte character");
1700 #endif
1701 yylval.integer.value = result;
1705 /* This is always a signed type. */
1706 yylval.integer.signedp = SIGNED;
1708 return CHAR;
1710 /* some of these chars are invalid in constant expressions;
1711 maybe do something about them later */
1712 case '/':
1713 case '+':
1714 case '-':
1715 case '*':
1716 case '%':
1717 case '|':
1718 case '&':
1719 case '^':
1720 case '~':
1721 case '!':
1722 case '@':
1723 case '<':
1724 case '>':
1725 case '[':
1726 case ']':
1727 case '.':
1728 case '?':
1729 case ':':
1730 case '=':
1731 case '{':
1732 case '}':
1733 case ',':
1734 case '#':
1735 if (keyword_parsing)
1736 break;
1737 case '(':
1738 case ')':
1739 lexptr++;
1740 return c;
1742 case '"':
1743 mask = MAX_CHAR_TYPE_MASK;
1744 string_constant:
1745 if (keyword_parsing) {
1746 char *start_ptr = lexptr;
1747 lexptr++;
1748 while (1) {
1749 c = *lexptr++;
1750 if (c == '\\')
1751 c = parse_escape (&lexptr, mask);
1752 else if (c == '"')
1753 break;
1755 yylval.name.address = tokstart;
1756 yylval.name.length = lexptr - start_ptr;
1757 return NAME;
1759 yyerror ("string constants not allowed in #if expressions");
1760 return ERROR;
1763 if (c >= '0' && c <= '9' && !keyword_parsing) {
1764 /* It's a number */
1765 for (namelen = 1; ; namelen++) {
1766 int d = tokstart[namelen];
1767 if (! ((is_idchar[d] || d == '.')
1768 || ((d == '-' || d == '+')
1769 && (c == 'e' || c == 'E'
1770 || ((c == 'p' || c == 'P') && ! c89))
1771 && ! traditional)))
1772 break;
1773 c = d;
1775 return parse_number (namelen);
1778 /* It is a name. See how long it is. */
1780 if (keyword_parsing) {
1781 for (namelen = 0;; namelen++) {
1782 if (is_space[tokstart[namelen]])
1783 break;
1784 if (tokstart[namelen] == '(' || tokstart[namelen] == ')')
1785 break;
1786 if (tokstart[namelen] == '"' || tokstart[namelen] == '\'')
1787 break;
1789 } else {
1790 if (!is_idstart[c]) {
1791 yyerror ("Invalid token in expression");
1792 return ERROR;
1795 for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
1799 lexptr += namelen;
1800 yylval.name.address = tokstart;
1801 yylval.name.length = namelen;
1802 return NAME;
1806 /* Parse a C escape sequence. STRING_PTR points to a variable
1807 containing a pointer to the string to parse. That pointer
1808 is updated past the characters we use. The value of the
1809 escape sequence is returned.
1811 RESULT_MASK is used to mask out the result;
1812 an error is reported if bits are lost thereby.
1814 A negative value means the sequence \ newline was seen,
1815 which is supposed to be equivalent to nothing at all.
1817 If \ is followed by a null character, we return a negative
1818 value and leave the string pointer pointing at the null character.
1820 If \ is followed by 000, we return 0 and leave the string pointer
1821 after the zeros. A value of 0 does not mean end of string. */
1823 HOST_WIDE_INT
1824 parse_escape (string_ptr, result_mask)
1825 char **string_ptr;
1826 HOST_WIDE_INT result_mask;
1828 register int c = *(*string_ptr)++;
1829 switch (c)
1831 case 'a':
1832 return TARGET_BELL;
1833 case 'b':
1834 return TARGET_BS;
1835 case 'e':
1836 case 'E':
1837 if (pedantic)
1838 pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
1839 return 033;
1840 case 'f':
1841 return TARGET_FF;
1842 case 'n':
1843 return TARGET_NEWLINE;
1844 case 'r':
1845 return TARGET_CR;
1846 case 't':
1847 return TARGET_TAB;
1848 case 'v':
1849 return TARGET_VT;
1850 case '\n':
1851 return -2;
1852 case 0:
1853 (*string_ptr)--;
1854 return 0;
1856 case '0':
1857 case '1':
1858 case '2':
1859 case '3':
1860 case '4':
1861 case '5':
1862 case '6':
1863 case '7':
1865 register HOST_WIDE_INT i = c - '0';
1866 register int count = 0;
1867 while (++count < 3)
1869 c = *(*string_ptr)++;
1870 if (c >= '0' && c <= '7')
1871 i = (i << 3) + c - '0';
1872 else
1874 (*string_ptr)--;
1875 break;
1878 if (i != (i & result_mask))
1880 i &= result_mask;
1881 pedwarn ("octal escape sequence out of range");
1883 return i;
1885 case 'x':
1887 register unsigned_HOST_WIDE_INT i = 0, overflow = 0;
1888 register int digits_found = 0, digit;
1889 for (;;)
1891 c = *(*string_ptr)++;
1892 if (c >= '0' && c <= '9')
1893 digit = c - '0';
1894 else if (c >= 'a' && c <= 'f')
1895 digit = c - 'a' + 10;
1896 else if (c >= 'A' && c <= 'F')
1897 digit = c - 'A' + 10;
1898 else
1900 (*string_ptr)--;
1901 break;
1903 overflow |= i ^ (i << 4 >> 4);
1904 i = (i << 4) + digit;
1905 digits_found = 1;
1907 if (!digits_found)
1908 yyerror ("\\x used with no following hex digits");
1909 if (overflow | (i != (i & result_mask)))
1911 i &= result_mask;
1912 pedwarn ("hex escape sequence out of range");
1914 return i;
1916 default:
1917 return c;
1921 static void
1922 yyerror (s)
1923 char *s;
1925 error ("%s", s);
1926 skip_evaluation = 0;
1927 longjmp (parse_return_error, 1);
1930 static void
1931 integer_overflow ()
1933 if (!skip_evaluation && pedantic)
1934 pedwarn ("integer overflow in preprocessor expression");
1937 static HOST_WIDE_INT
1938 left_shift (a, b)
1939 struct constant *a;
1940 unsigned_HOST_WIDE_INT b;
1942 /* It's unclear from the C standard whether shifts can overflow.
1943 The following code ignores overflow; perhaps a C standard
1944 interpretation ruling is needed. */
1945 if (b >= HOST_BITS_PER_WIDE_INT)
1946 return 0;
1947 else
1948 return (unsigned_HOST_WIDE_INT) a->value << b;
1951 static HOST_WIDE_INT
1952 right_shift (a, b)
1953 struct constant *a;
1954 unsigned_HOST_WIDE_INT b;
1956 if (b >= HOST_BITS_PER_WIDE_INT)
1957 return a->signedp ? a->value >> (HOST_BITS_PER_WIDE_INT - 1) : 0;
1958 else if (a->signedp)
1959 return a->value >> b;
1960 else
1961 return (unsigned_HOST_WIDE_INT) a->value >> b;
1964 /* This page contains the entry point to this file. */
1966 /* Parse STRING as an expression, and complain if this fails
1967 to use up all of the contents of STRING.
1968 STRING may contain '\0' bytes; it is terminated by the first '\n'
1969 outside a string constant, so that we can diagnose '\0' properly.
1970 If WARN_UNDEFINED is nonzero, warn if undefined identifiers are evaluated.
1971 We do not support C comments. They should be removed before
1972 this function is called. */
1974 HOST_WIDE_INT
1975 parse_c_expression (string, warn_undefined)
1976 char *string;
1977 int warn_undefined;
1979 lexptr = string;
1980 warn_undef = warn_undefined;
1982 /* if there is some sort of scanning error, just return 0 and assume
1983 the parsing routine has printed an error message somewhere.
1984 there is surely a better thing to do than this. */
1985 if (setjmp (parse_return_error))
1986 return 0;
1988 if (yyparse () != 0)
1989 abort ();
1991 if (*lexptr != '\n')
1992 error ("Junk after end of expression.");
1994 return expression_value; /* set by yyparse () */
1997 #ifdef TEST_EXP_READER
1999 #if YYDEBUG
2000 extern int yydebug;
2001 #endif
2003 int pedantic;
2004 int traditional;
2006 int main PROTO((int, char **));
2007 static void initialize_random_junk PROTO((void));
2008 static void print_unsigned_host_wide_int PROTO((unsigned_HOST_WIDE_INT));
2010 /* Main program for testing purposes. */
2012 main (argc, argv)
2013 int argc;
2014 char **argv;
2016 int n, c;
2017 char buf[1024];
2018 unsigned_HOST_WIDE_INT u;
2020 pedantic = 1 < argc;
2021 traditional = 2 < argc;
2022 #if YYDEBUG
2023 yydebug = 3 < argc;
2024 #endif
2025 initialize_random_junk ();
2027 for (;;) {
2028 printf ("enter expression: ");
2029 n = 0;
2030 while ((buf[n] = c = getchar ()) != '\n' && c != EOF)
2031 n++;
2032 if (c == EOF)
2033 break;
2034 parse_c_expression (buf, 1);
2035 printf ("parser returned ");
2036 u = (unsigned_HOST_WIDE_INT) expression_value;
2037 if (expression_value < 0 && expression_signedp) {
2038 u = -u;
2039 printf ("-");
2041 if (u == 0)
2042 printf ("0");
2043 else
2044 print_unsigned_host_wide_int (u);
2045 if (! expression_signedp)
2046 printf("u");
2047 printf ("\n");
2050 return 0;
2053 static void
2054 print_unsigned_host_wide_int (u)
2055 unsigned_HOST_WIDE_INT u;
2057 if (u) {
2058 print_unsigned_host_wide_int (u / 10);
2059 putchar ('0' + (int) (u % 10));
2063 /* table to tell if char can be part of a C identifier. */
2064 unsigned char is_idchar[256];
2065 /* table to tell if char can be first char of a c identifier. */
2066 unsigned char is_idstart[256];
2067 /* table to tell if c is horizontal or vertical space. */
2068 unsigned char is_space[256];
2071 * initialize random junk in the hash table and maybe other places
2073 static void
2074 initialize_random_junk ()
2076 register int i;
2079 * Set up is_idchar and is_idstart tables. These should be
2080 * faster than saying (is_alpha (c) || c == '_'), etc.
2081 * Must do set up these things before calling any routines tthat
2082 * refer to them.
2084 for (i = 'a'; i <= 'z'; i++) {
2085 ++is_idchar[i - 'a' + 'A'];
2086 ++is_idchar[i];
2087 ++is_idstart[i - 'a' + 'A'];
2088 ++is_idstart[i];
2090 for (i = '0'; i <= '9'; i++)
2091 ++is_idchar[i];
2092 ++is_idchar['_'];
2093 ++is_idstart['_'];
2094 ++is_idchar['$'];
2095 ++is_idstart['$'];
2097 ++is_space[' '];
2098 ++is_space['\t'];
2099 ++is_space['\v'];
2100 ++is_space['\f'];
2101 ++is_space['\n'];
2102 ++is_space['\r'];
2105 void
2106 error (PRINTF_ALIST (msg))
2107 PRINTF_DCL (msg)
2109 va_list args;
2111 VA_START (args, msg);
2112 fprintf (stderr, "error: ");
2113 vfprintf (stderr, msg, args);
2114 fprintf (stderr, "\n");
2115 va_end (args);
2118 void
2119 pedwarn (PRINTF_ALIST (msg))
2120 PRINTF_DCL (msg)
2122 va_list args;
2124 VA_START (args, msg);
2125 fprintf (stderr, "pedwarn: ");
2126 vfprintf (stderr, msg, args);
2127 fprintf (stderr, "\n");
2128 va_end (args);
2131 void
2132 warning (PRINTF_ALIST (msg))
2133 PRINTF_DCL (msg)
2135 va_list args;
2137 VA_START (args, msg);
2138 fprintf (stderr, "warning: ");
2139 vfprintf (stderr, msg, args);
2140 fprintf (stderr, "\n");
2141 va_end (args);
2145 check_assertion (name, sym_length, tokens_specified, tokens)
2146 U_CHAR *name;
2147 int sym_length;
2148 int tokens_specified;
2149 struct arglist *tokens;
2151 return 0;
2154 struct hashnode *
2155 lookup (name, len, hash)
2156 U_CHAR *name;
2157 int len;
2158 int hash;
2160 return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
2163 GENERIC_PTR
2164 xmalloc (size)
2165 size_t size;
2167 return (GENERIC_PTR) malloc (size);
2169 #endif