2 /* $NetBSD: cgram.y,v 1.23 2002/01/31 19:36:53 tv Exp $ */
5 * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
6 * Copyright (c) 1994, 1995 Jochen Pohl
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Jochen Pohl for
21 * 4. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <sys/cdefs.h>
37 #if defined(__RCSID) && !defined(lint)
38 __RCSID("$NetBSD: cgram.y,v 1.23 2002/01/31 19:36:53 tv Exp $");
40 __FBSDID("$FreeBSD$");
49 * Contains the level of current declaration. 0 is extern.
50 * Used for symbol table entries.
55 * level for memory allocation. Normaly the same as blklev.
56 * An exeption is the declaration of arguments in prototypes. Memory
57 * for these can't be freed after the declaration, but symbols must
58 * be removed from the symbol table after the declaration.
63 * Save the no-warns state and restore it to avoid the problem where
64 * if (expr) { stmt } / * NOLINT * / stmt;
66 static int onowarn = -1;
68 static int toicon(tnode_t *);
69 static void idecl(sym_t *, int, sbuf_t *);
70 static void ignuptorp(void);
73 static __inline void CLRWFLGS(void);
74 static __inline void CLRWFLGS(void)
76 printf("%s, %d: clear flags %s %d\n", curr_pos.p_file,
77 curr_pos.p_line, __FILE__, __LINE__);
82 static __inline void SAVE(void);
83 static __inline void SAVE(void)
87 printf("%s, %d: save flags %s %d = %d\n", curr_pos.p_file,
88 curr_pos.p_line, __FILE__, __LINE__, nowarn);
92 static __inline void RESTORE(void);
93 static __inline void RESTORE(void)
97 printf("%s, %d: restore flags %s %d = %d\n", curr_pos.p_file,
98 curr_pos.p_line, __FILE__, __LINE__, nowarn);
104 #define CLRWFLGS() clrwflgs(), onowarn = -1
105 #define SAVE() onowarn = nowarn
106 #define RESTORE() (void)(onowarn == -1 ? (clrwflgs(), 0) : (nowarn = onowarn))
125 %token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPARN T_RPARN
126 %token <y_op> T_STROP
128 %token <y_op> T_INCDEC
131 %token <y_op> T_DIVOP
132 %token <y_op> T_ADDOP
133 %token <y_op> T_SHFTOP
134 %token <y_op> T_RELOP
139 %token <y_op> T_LOGAND
140 %token <y_op> T_LOGOR
143 %token <y_op> T_ASSIGN
144 %token <y_op> T_OPASS
149 /* storage classes (extern, static, auto, register and typedef) */
150 %token <y_scl> T_SCLASS
152 /* types (char, int, short, long, unsigned, signed, float, double, void) */
153 %token <y_tspec> T_TYPE
155 /* qualifiers (const, volatile) */
156 %token <y_tqual> T_QUAL
158 /* struct or union */
159 %token <y_tspec> T_SOU
164 /* remaining keywords */
178 %token T_SYMBOLRENAME
181 %right T_ASSIGN T_OPASS
182 %right T_QUEST T_COLON
193 %right T_UNOP T_INCDEC T_SIZEOF
194 %left T_LPARN T_LBRACK T_STROP
197 %token <y_sb> T_TYPENAME
199 %token <y_strg> T_STRING
201 %type <y_sym> func_decl
202 %type <y_sym> notype_decl
203 %type <y_sym> type_decl
204 %type <y_type> typespec
205 %type <y_type> clrtyp_typespec
206 %type <y_type> notype_typespec
207 %type <y_type> struct_spec
208 %type <y_type> enum_spec
209 %type <y_sym> struct_tag
210 %type <y_sym> enum_tag
211 %type <y_tspec> struct
212 %type <y_sym> struct_declaration
213 %type <y_sb> identifier
214 %type <y_sym> member_declaration_list_with_rbrace
215 %type <y_sym> member_declaration_list
216 %type <y_sym> member_declaration
217 %type <y_sym> notype_member_decls
218 %type <y_sym> type_member_decls
219 %type <y_sym> notype_member_decl
220 %type <y_sym> type_member_decl
221 %type <y_tnode> constant
222 %type <y_sym> enum_declaration
223 %type <y_sym> enums_with_opt_comma
225 %type <y_sym> enumerator
227 %type <y_sym> notype_direct_decl
228 %type <y_sym> type_direct_decl
229 %type <y_pqinf> pointer
230 %type <y_pqinf> asterisk
231 %type <y_sym> param_decl
232 %type <y_sym> param_list
233 %type <y_sym> abs_decl_param_list
234 %type <y_sym> direct_param_decl
235 %type <y_sym> notype_param_decl
236 %type <y_sym> direct_notype_param_decl
237 %type <y_pqinf> type_qualifier_list
238 %type <y_pqinf> type_qualifier
239 %type <y_sym> identifier_list
240 %type <y_sym> abs_decl
241 %type <y_sym> direct_abs_decl
242 %type <y_sym> vararg_parameter_type_list
243 %type <y_sym> parameter_type_list
244 %type <y_sym> parameter_declaration
247 %type <y_tnode> func_arg_list
248 %type <y_op> point_or_arrow
249 %type <y_type> type_name
250 %type <y_sym> abstract_declaration
251 %type <y_tnode> do_while_expr
252 %type <y_tnode> opt_expr
253 %type <y_strg> string
254 %type <y_strg> string2
255 %type <y_sb> opt_asm_or_symbolrename
263 /* empty translation unit */
266 /* empty translation unit */
275 | translation_unit ext_decl
293 /* syntax error: empty declaration */
296 /* syntax error: empty declaration */
300 | clrtyp deftyp notype_init_decls T_SEMI {
302 /* old style declaration; add "int" */
305 /* old style declaration; add "int" */
309 | declmods deftyp T_SEMI {
310 if (dcs->d_scl == TYPEDEF) {
311 /* typedef declares no type name */
314 /* empty declaration */
318 | declmods deftyp notype_init_decls T_SEMI
319 | declspecs deftyp T_SEMI {
320 if (dcs->d_scl == TYPEDEF) {
321 /* typedef declares no type name */
323 } else if (!dcs->d_nedecl) {
324 /* empty declaration */
328 | declspecs deftyp type_init_decls T_SEMI
339 if ($1->s_type->t_tspec != FUNC) {
344 if ($1->s_type->t_typedef) {
345 /* ()-less function definition */
352 } opt_arg_declaration_list {
364 clrtyp deftyp notype_decl {
367 | declmods deftyp notype_decl {
370 | declspecs deftyp type_decl {
375 opt_arg_declaration_list:
377 | arg_declaration_list
380 arg_declaration_list:
382 | arg_declaration_list arg_declaration
383 /* XXX or better "arg_declaration error" ? */
388 * "arg_declaration" is separated from "declaration" because it
389 * needs other error handling.
393 declmods deftyp T_SEMI {
394 /* empty declaration */
397 | declmods deftyp notype_init_decls T_SEMI
398 | declspecs deftyp T_SEMI {
399 if (!dcs->d_nedecl) {
400 /* empty declaration */
403 tspec_t ts = dcs->d_type->t_tspec;
404 /* %s declared in argument declaration list */
405 warning(3, ts == STRUCT ? "struct" :
406 (ts == UNION ? "union" : "enum"));
409 | declspecs deftyp type_init_decls T_SEMI {
411 tspec_t ts = dcs->d_type->t_tspec;
412 /* %s declared in argument declaration list */
413 warning(3, ts == STRUCT ? "struct" :
414 (ts == UNION ? "union" : "enum"));
422 declmods deftyp T_SEMI {
423 if (dcs->d_scl == TYPEDEF) {
424 /* typedef declares no type name */
427 /* empty declaration */
431 | declmods deftyp notype_init_decls T_SEMI
432 | declspecs deftyp T_SEMI {
433 if (dcs->d_scl == TYPEDEF) {
434 /* typedef declares no type name */
436 } else if (!dcs->d_nedecl) {
437 /* empty declaration */
441 | declspecs deftyp type_init_decls T_SEMI
461 | declmods typespec {
465 | declspecs notype_typespec {
490 clrtyp notype_typespec {
493 | T_TYPENAME clrtyp {
494 $$ = getsym($1)->s_type;
503 $$ = getsym($1)->s_type;
524 * STDC requires that "struct a;" always introduces
525 * a new tag if "a" is not declared at current level
527 * yychar is valid because otherwise the parser would
528 * not been able to deceide if he must shift or reduce
530 $$ = mktag($2, $1, 0, yychar == T_SEMI);
532 | struct struct_tag {
533 dcs->d_tagtyp = mktag($2, $1, 1, 0);
534 } struct_declaration {
535 $$ = compltag(dcs->d_tagtyp, $4);
538 dcs->d_tagtyp = mktag(NULL, $1, 1, 0);
539 } struct_declaration {
540 $$ = compltag(dcs->d_tagtyp, $3);
551 pushdecl($1 == STRUCT ? MOS : MOU);
553 dcs->d_stralign = CHAR_BIT;
565 struct_decl_lbrace member_declaration_list_with_rbrace {
576 member_declaration_list_with_rbrace:
577 member_declaration_list T_SEMI T_RBRACE {
580 | member_declaration_list T_RBRACE {
582 /* syntax req. ";" after last struct/union member */
585 /* syntax req. ";" after last struct/union member */
595 member_declaration_list:
599 | member_declaration_list T_SEMI member_declaration {
605 noclass_declmods deftyp {
606 /* too late, i know, but getsym() compensates it */
608 } notype_member_decls {
612 | noclass_declspecs deftyp {
614 } type_member_decls {
618 | noclass_declmods deftyp {
619 /* struct or union member must be named */
623 | noclass_declspecs deftyp {
624 /* struct or union member must be named */
638 | noclass_declmods typespec {
641 | noclass_declspecs T_QUAL {
644 | noclass_declspecs notype_typespec {
653 | noclass_declmods T_QUAL {
662 | notype_member_decls {
664 } T_COMMA type_member_decl {
665 $$ = lnklst($1, decl1str($4));
673 | type_member_decls {
675 } T_COMMA type_member_decl {
676 $$ = lnklst($1, decl1str($4));
684 | notype_decl T_COLON constant {
685 $$ = bitfield($1, toicon($3));
690 $$ = bitfield(NULL, toicon($3));
698 | type_decl T_COLON constant {
699 $$ = bitfield($1, toicon($3));
704 $$ = bitfield(NULL, toicon($3));
710 $$ = mktag($2, ENUM, 0, 0);
713 dcs->d_tagtyp = mktag($2, ENUM, 1, 0);
715 $$ = compltag(dcs->d_tagtyp, $4);
718 dcs->d_tagtyp = mktag(NULL, ENUM, 1, 0);
720 $$ = compltag(dcs->d_tagtyp, $3);
742 enum_decl_lbrace enums_with_opt_comma T_RBRACE {
754 enums_with_opt_comma:
760 /* trailing "," prohibited in enum declaration */
763 /* trailing "," prohibited in enum declaration */
774 | enums T_COMMA enumerator {
784 $$ = ename($1, enumval, 1);
786 | ename T_ASSIGN constant {
787 $$ = ename($1, toicon($3), 0);
800 | notype_init_decls T_COMMA type_init_decl
805 | type_init_decls T_COMMA type_init_decl
809 notype_decl opt_asm_or_symbolrename {
813 | notype_decl opt_asm_or_symbolrename {
815 } T_ASSIGN initializer {
821 type_decl opt_asm_or_symbolrename {
825 | type_decl opt_asm_or_symbolrename {
827 } T_ASSIGN initializer {
836 | pointer notype_direct_decl {
843 $$ = dname(getsym($1));
845 | T_LPARN type_decl T_RPARN {
848 | notype_direct_decl T_LBRACK T_RBRACK {
849 $$ = addarray($1, 0, 0);
851 | notype_direct_decl T_LBRACK constant T_RBRACK {
852 $$ = addarray($1, 1, toicon($3));
854 | notype_direct_decl param_list {
855 $$ = addfunc($1, $2);
865 | pointer type_direct_decl {
872 $$ = dname(getsym($1));
874 | T_LPARN type_decl T_RPARN {
877 | type_direct_decl T_LBRACK T_RBRACK {
878 $$ = addarray($1, 0, 0);
880 | type_direct_decl T_LBRACK constant T_RBRACK {
881 $$ = addarray($1, 1, toicon($3));
883 | type_direct_decl param_list {
884 $$ = addfunc($1, $2);
891 * param_decl and notype_param_decl exist to avoid a conflict in
892 * argument lists. A typename enclosed in parens should always be
893 * treated as a typename, not an argument.
894 * "typedef int a; f(int (a));" is "typedef int a; f(int foo(a));"
895 * not "typedef int a; f(int a);"
901 | pointer direct_param_decl {
908 $$ = dname(getsym($1));
910 | T_LPARN notype_param_decl T_RPARN {
913 | direct_param_decl T_LBRACK T_RBRACK {
914 $$ = addarray($1, 0, 0);
916 | direct_param_decl T_LBRACK constant T_RBRACK {
917 $$ = addarray($1, 1, toicon($3));
919 | direct_param_decl param_list {
920 $$ = addfunc($1, $2);
927 direct_notype_param_decl {
930 | pointer direct_notype_param_decl {
935 direct_notype_param_decl:
937 $$ = dname(getsym($1));
939 | T_LPARN notype_param_decl T_RPARN {
942 | direct_notype_param_decl T_LBRACK T_RBRACK {
943 $$ = addarray($1, 0, 0);
945 | direct_notype_param_decl T_LBRACK constant T_RBRACK {
946 $$ = addarray($1, 1, toicon($3));
948 | direct_notype_param_decl param_list {
949 $$ = addfunc($1, $2);
959 | asterisk type_qualifier_list {
960 $$ = mergepq($1, $2);
963 $$ = mergepq($1, $2);
965 | asterisk type_qualifier_list pointer {
966 $$ = mergepq(mergepq($1, $2), $3);
972 $$ = xcalloc(1, sizeof (pqinf_t));
981 | type_qualifier_list type_qualifier {
982 $$ = mergepq($1, $2);
988 $$ = xcalloc(1, sizeof (pqinf_t));
998 id_list_lparn identifier_list T_RPARN {
1001 | abs_decl_param_list {
1015 $$ = iname(getsym($1));
1017 | identifier_list T_COMMA T_NAME {
1018 $$ = lnklst($1, iname(getsym($3)));
1020 | identifier_list error {
1025 abs_decl_param_list:
1026 abs_decl_lparn T_RPARN {
1029 | abs_decl_lparn vararg_parameter_type_list T_RPARN {
1033 | abs_decl_lparn error T_RPARN {
1045 vararg_parameter_type_list:
1046 parameter_type_list {
1049 | parameter_type_list T_COMMA T_ELLIPSE {
1055 /* ANSI C requires formal parameter before "..." */
1057 } else if (!tflag) {
1058 /* ANSI C requires formal parameter before "..." */
1066 parameter_type_list:
1067 parameter_declaration {
1070 | parameter_type_list T_COMMA parameter_declaration {
1071 $$ = lnklst($1, $3);
1075 parameter_declaration:
1077 $$ = decl1arg(aname(), 0);
1079 | declspecs deftyp {
1080 $$ = decl1arg(aname(), 0);
1082 | declmods deftyp notype_param_decl {
1083 $$ = decl1arg($3, 0);
1086 * param_decl is needed because of following conflict:
1087 * "typedef int a; f(int (a));" could be parsed as
1088 * "function with argument a of type int", or
1089 * "function with an abstract argument of type function".
1090 * This grammar realizes the second case.
1092 | declspecs deftyp param_decl {
1093 $$ = decl1arg($3, 0);
1095 | declmods deftyp abs_decl {
1096 $$ = decl1arg($3, 0);
1098 | declspecs deftyp abs_decl {
1099 $$ = decl1arg($3, 0);
1103 opt_asm_or_symbolrename: /* expect only one */
1107 | T_ASM T_LPARN T_STRING T_RPARN {
1108 freeyyv(&$3, T_STRING);
1111 | T_SYMBOLRENAME T_LPARN T_NAME T_RPARN {
1121 expr %prec T_COMMA {
1124 | init_lbrace init_expr_list init_rbrace
1125 | init_lbrace init_expr_list T_COMMA init_rbrace
1130 init_expr %prec T_COMMA
1131 | init_expr_list T_COMMA init_expr
1149 } abstract_declaration {
1155 abstract_declaration:
1156 noclass_declmods deftyp {
1157 $$ = decl1abs(aname());
1159 | noclass_declspecs deftyp {
1160 $$ = decl1abs(aname());
1162 | noclass_declmods deftyp abs_decl {
1165 | noclass_declspecs deftyp abs_decl {
1172 $$ = addptr(aname(), $1);
1177 | pointer direct_abs_decl {
1178 $$ = addptr($2, $1);
1183 T_LPARN abs_decl T_RPARN {
1186 | T_LBRACK T_RBRACK {
1187 $$ = addarray(aname(), 0, 0);
1189 | T_LBRACK constant T_RBRACK {
1190 $$ = addarray(aname(), 1, toicon($2));
1192 | direct_abs_decl T_LBRACK T_RBRACK {
1193 $$ = addarray($1, 0, 0);
1195 | direct_abs_decl T_LBRACK constant T_RBRACK {
1196 $$ = addarray($1, 1, toicon($3));
1198 | abs_decl_param_list {
1199 $$ = addfunc(aname(), $1);
1203 | direct_abs_decl abs_decl_param_list {
1204 $$ = addfunc($1, $2);
1227 identifier T_COLON {
1229 label(T_NAME, getsym($1), NULL);
1231 | T_CASE constant T_COLON {
1232 label(T_CASE, NULL, $2);
1235 | T_DEFAULT T_COLON {
1236 label(T_DEFAULT, NULL, NULL);
1242 compstmnt_lbrace declaration_list opt_stmnt_list compstmnt_rbrace
1243 | compstmnt_lbrace opt_stmnt_list compstmnt_rbrace
1271 | stmnt_list stmnt {
1274 | stmnt_list error T_SEMI
1293 | if_without_else T_ELSE {
1300 | if_without_else T_ELSE error {
1304 | switch_expr stmnt {
1308 | switch_expr error {
1320 T_IF T_LPARN expr T_RPARN {
1327 T_SWITCH T_LPARN expr T_RPARN {
1344 | while_expr error {
1348 | do_stmnt do_while_expr {
1367 T_WHILE T_LPARN expr T_RPARN {
1380 T_WHILE T_LPARN expr T_RPARN T_SEMI {
1386 T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN {
1402 goto identifier T_SEMI {
1405 | goto error T_SEMI {
1408 | T_CONTINUE T_SEMI {
1417 | T_RETURN expr T_SEMI {
1429 T_ASM T_LPARN read_until_rparn T_SEMI {
1432 | T_ASM T_QUAL T_LPARN read_until_rparn T_SEMI {
1448 | declaration_list declaration {
1454 expr %prec T_COMMA {
1461 $$ = build(MULT, $1, $3);
1463 | expr T_DIVOP expr {
1464 $$ = build($2, $1, $3);
1466 | expr T_ADDOP expr {
1467 $$ = build($2, $1, $3);
1469 | expr T_SHFTOP expr {
1470 $$ = build($2, $1, $3);
1472 | expr T_RELOP expr {
1473 $$ = build($2, $1, $3);
1475 | expr T_EQOP expr {
1476 $$ = build($2, $1, $3);
1479 $$ = build(AND, $1, $3);
1482 $$ = build(XOR, $1, $3);
1485 $$ = build(OR, $1, $3);
1487 | expr T_LOGAND expr {
1488 $$ = build(LOGAND, $1, $3);
1490 | expr T_LOGOR expr {
1491 $$ = build(LOGOR, $1, $3);
1493 | expr T_QUEST expr T_COLON expr {
1494 $$ = build(QUEST, $1, build(COLON, $3, $5));
1496 | expr T_ASSIGN expr {
1497 $$ = build(ASSIGN, $1, $3);
1499 | expr T_OPASS expr {
1500 $$ = build($2, $1, $3);
1502 | expr T_COMMA expr {
1503 $$ = build(COMMA, $1, $3);
1512 /* XXX really necessary? */
1515 $$ = getnnode(getsym($1), yychar);
1521 $$ = getcnode(gettyp($1->v_tspec), $1);
1523 | T_LPARN expr T_RPARN {
1529 $$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL);
1532 $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL);
1535 $$ = build(STAR, $2, NULL);
1538 $$ = build(AMPER, $2, NULL);
1541 $$ = build($1, $2, NULL);
1544 if (tflag && $1 == PLUS) {
1545 /* unary + is illegal in traditional C */
1548 $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL);
1550 | term T_LBRACK expr T_RBRACK {
1551 $$ = build(STAR, build(PLUS, $1, $3), NULL);
1553 | term T_LPARN T_RPARN {
1554 $$ = funccall($1, NULL);
1556 | term T_LPARN func_arg_list T_RPARN {
1557 $$ = funccall($1, $3);
1559 | term point_or_arrow T_NAME {
1562 /* XXX strmemb should be integrated in build() */
1564 /* must to this before strmemb is called */
1567 msym = strmemb($1, $2, getsym($3));
1568 $$ = build($2, $1, getnnode(msym, 0));
1573 | T_SIZEOF term %prec T_SIZEOF {
1574 if (($$ = $2 == NULL ? NULL : bldszof($2->tn_type)) != NULL)
1575 chkmisc($2, 0, 0, 0, 0, 0, 1);
1577 | T_SIZEOF T_LPARN type_name T_RPARN %prec T_SIZEOF {
1580 | T_LPARN type_name T_RPARN term %prec T_UNOP {
1589 | T_STRING string2 {
1590 $$ = catstrg($1, $2);
1597 /* concatenated strings are illegal in traditional C */
1602 | string2 T_STRING {
1603 $$ = catstrg($1, $2);
1608 expr %prec T_COMMA {
1609 $$ = funcarg(NULL, $1);
1611 | func_arg_list T_COMMA expr {
1612 $$ = funcarg($1, $3);
1645 static __inline int uq_gt(uint64_t, uint64_t);
1647 uq_gt(uint64_t a, uint64_t b)
1653 static __inline int q_gt(int64_t, int64_t);
1655 q_gt(int64_t a, int64_t b)
1661 #define q_lt(a, b) q_gt(b, a)
1664 * Gets a node for a constant and returns the value of this constant
1666 * Is the node not constant or too large for int or of type float,
1667 * a warning will be printed.
1669 * toicon() should be used only inside declarations. If it is used in
1670 * expressions, it frees the memory used for the expression.
1682 * Abstract declarations are used inside expression. To free
1683 * the memory would be a fatal error.
1685 if (dcs->d_ctx != ABSTRACT)
1688 if ((t = v->v_tspec) == FLOAT || t == DOUBLE || t == LDOUBLE) {
1690 /* integral constant expression expected */
1695 if (uq_gt((uint64_t)v->v_quad,
1696 (uint64_t)INT_MAX)) {
1697 /* integral constant too large */
1701 if (q_gt(v->v_quad, (int64_t)INT_MAX) ||
1702 q_lt(v->v_quad, (int64_t)INT_MIN)) {
1703 /* integral constant too large */
1713 idecl(sym_t *decl, int initflg, sbuf_t *rename)
1720 switch (dcs->d_ctx) {
1722 if (rename != NULL) {
1723 if (decl->s_rename != NULL)
1724 lerror("idecl() 1");
1726 s = getlblk(1, rename->sb_len + 1);
1727 (void)memcpy(s, rename->sb_name, rename->sb_len + 1);
1729 freeyyv(&rename, T_NAME);
1731 decl1ext(decl, initflg);
1734 if (rename != NULL) {
1735 /* symbol renaming can't be used on function arguments */
1737 freeyyv(&rename, T_NAME);
1740 (void)decl1arg(decl, initflg);
1743 if (rename != NULL) {
1744 /* symbol renaming can't be used on automatic variables */
1746 freeyyv(&rename, T_NAME);
1749 decl1loc(decl, initflg);
1752 lerror("idecl() 2");
1755 if (initflg && !initerr)
1760 * Discard all input tokens up to and including the next
1761 * unmatched right paren
1770 freeyyv(&yylval, yychar);
1773 while (yychar != T_RPARN || --level > 0) {
1774 if (yychar == T_LPARN) {
1776 } else if (yychar <= 0) {
1779 freeyyv(&yylval, yychar = yylex());