| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | %{ | | 1 | %{ |
2 | /* $NetBSD: cgram.y,v 1.303 2021/07/10 21:08:16 rillig Exp $ */ | | 2 | /* $NetBSD: cgram.y,v 1.304 2021/07/10 21:44:51 rillig Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. | | 5 | * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. |
6 | * Copyright (c) 1994, 1995 Jochen Pohl | | 6 | * Copyright (c) 1994, 1995 Jochen Pohl |
7 | * All Rights Reserved. | | 7 | * All Rights Reserved. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
15 | * notice, this list of conditions and the following disclaimer in the | | 15 | * notice, this list of conditions and the following disclaimer in the |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 25 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
27 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 27 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
29 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 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 | | 30 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 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 | | 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. | | 33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | #if defined(__RCSID) && !defined(lint) | | 37 | #if defined(__RCSID) && !defined(lint) |
38 | __RCSID("$NetBSD: cgram.y,v 1.303 2021/07/10 21:08:16 rillig Exp $"); | | 38 | __RCSID("$NetBSD: cgram.y,v 1.304 2021/07/10 21:44:51 rillig Exp $"); |
39 | #endif | | 39 | #endif |
40 | | | 40 | |
41 | #include <limits.h> | | 41 | #include <limits.h> |
42 | #include <stdlib.h> | | 42 | #include <stdlib.h> |
43 | #include <string.h> | | 43 | #include <string.h> |
44 | | | 44 | |
45 | #include "lint1.h" | | 45 | #include "lint1.h" |
46 | | | 46 | |
47 | extern char *yytext; | | 47 | extern char *yytext; |
48 | | | 48 | |
49 | /* | | 49 | /* |
50 | * Contains the level of current declaration, used for symbol table entries. | | 50 | * Contains the level of current declaration, used for symbol table entries. |
51 | * 0 is the top-level, > 0 is inside a function body. | | 51 | * 0 is the top-level, > 0 is inside a function body. |
| @@ -525,43 +525,42 @@ begin_type: | | | @@ -525,43 +525,42 @@ begin_type: |
525 | } | | 525 | } |
526 | ; | | 526 | ; |
527 | | | 527 | |
528 | end_type: | | 528 | end_type: |
529 | /* empty */ { | | 529 | /* empty */ { |
530 | end_type(); | | 530 | end_type(); |
531 | } | | 531 | } |
532 | ; | | 532 | ; |
533 | | | 533 | |
534 | declaration_specifiers: /* C99 6.7 */ | | 534 | declaration_specifiers: /* C99 6.7 */ |
535 | add_type_specifier | | 535 | add_type_specifier |
536 | | declmods add_type_specifier | | 536 | | declmods add_type_specifier |
537 | | type_attribute declaration_specifiers | | 537 | | type_attribute declaration_specifiers |
538 | | declaration_specifiers declmod | | 538 | | declaration_specifiers add_storage_class |
539 | | declaration_specifiers add_notype_type_specifier | | 539 | | declaration_specifiers add_notype_type_specifier |
| | | 540 | | declaration_specifiers add_type_qualifier |
| | | 541 | | declaration_specifiers type_attribute |
540 | ; | | 542 | ; |
541 | | | 543 | |
542 | declmods: | | 544 | declmods: |
543 | qualifier_or_storage_class | | 545 | add_storage_class |
544 | | declmods declmod | | 546 | | add_type_qualifier |
| | | 547 | | declmods add_storage_class |
| | | 548 | | declmods add_type_qualifier |
| | | 549 | | declmods type_attribute |
545 | ; | | 550 | ; |
546 | | | 551 | |
547 | declmod: | | 552 | add_storage_class: |
548 | qualifier_or_storage_class | | 553 | T_SCLASS { |
549 | | type_attribute | | | |
550 | ; | | | |
551 | | | | |
552 | qualifier_or_storage_class: | | | |
553 | add_type_qualifier | | | |
554 | | T_SCLASS { | | | |
555 | add_storage_class($1); | | 554 | add_storage_class($1); |
556 | } | | 555 | } |
557 | ; | | 556 | ; |
558 | | | 557 | |
559 | add_type_specifier: | | 558 | add_type_specifier: |
560 | type_specifier { | | 559 | type_specifier { |
561 | add_type($1); | | 560 | add_type($1); |
562 | } | | 561 | } |
563 | ; | | 562 | ; |
564 | | | 563 | |
565 | type_attribute_list_opt: | | 564 | type_attribute_list_opt: |
566 | /* empty */ | | 565 | /* empty */ |
567 | | type_attribute_list | | 566 | | type_attribute_list |