| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | %{ | | 1 | %{ |
2 | /* $NetBSD: cgram.y,v 1.152 2021/01/18 17:54:50 rillig Exp $ */ | | 2 | /* $NetBSD: cgram.y,v 1.153 2021/01/18 17:59: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.152 2021/01/18 17:54:50 rillig Exp $"); | | 38 | __RCSID("$NetBSD: cgram.y,v 1.153 2021/01/18 17:59: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. |
| @@ -175,50 +175,48 @@ anonymize(sym_t *s) | | | @@ -175,50 +175,48 @@ anonymize(sym_t *s) |
175 | | | 175 | |
176 | /* | | 176 | /* |
177 | * predefined type keywords (char, int, short, long, unsigned, signed, | | 177 | * predefined type keywords (char, int, short, long, unsigned, signed, |
178 | * float, double, void); see T_TYPENAME | | 178 | * float, double, void); see T_TYPENAME |
179 | */ | | 179 | */ |
180 | %token <y_tspec> T_TYPE | | 180 | %token <y_tspec> T_TYPE |
181 | | | 181 | |
182 | /* qualifiers (const, volatile, restrict, _Thread_local) */ | | 182 | /* qualifiers (const, volatile, restrict, _Thread_local) */ |
183 | %token <y_tqual> T_QUAL | | 183 | %token <y_tqual> T_QUAL |
184 | | | 184 | |
185 | /* struct or union */ | | 185 | /* struct or union */ |
186 | %token <y_tspec> T_STRUCT_OR_UNION | | 186 | %token <y_tspec> T_STRUCT_OR_UNION |
187 | | | 187 | |
188 | /* enum */ | | | |
189 | %token T_ENUM | | | |
190 | | | | |
191 | /* remaining keywords */ | | 188 | /* remaining keywords */ |
| | | 189 | %token T_ASM |
| | | 190 | %token T_BREAK |
192 | %token T_CASE | | 191 | %token T_CASE |
| | | 192 | %token T_CONTINUE |
193 | %token T_DEFAULT | | 193 | %token T_DEFAULT |
194 | %token T_IF | | | |
195 | %token T_ELSE | | | |
196 | %token T_SWITCH | | | |
197 | %token T_DO | | 194 | %token T_DO |
198 | %token T_WHILE | | 195 | %token T_ELSE |
| | | 196 | %token T_ENUM |
199 | %token T_FOR | | 197 | %token T_FOR |
200 | %token T_GOTO | | 198 | %token T_GOTO |
201 | %token T_CONTINUE | | 199 | %token T_IF |
202 | %token T_BREAK | | 200 | %token T_PACKED |
203 | %token T_RETURN | | 201 | %token T_RETURN |
204 | %token T_ASM | | 202 | %token T_SWITCH |
205 | %token T_SYMBOLRENAME | | 203 | %token T_SYMBOLRENAME |
206 | %token T_PACKED | | 204 | %token T_WHILE |
207 | /* Type Attributes */ | | 205 | /* Type Attributes */ |
208 | %token <y_type> T_ATTRIBUTE | | 206 | %token <y_type> T_ATTRIBUTE |
209 | %token <y_type> T_AT_ALIAS | | 207 | %token <y_type> T_AT_ALIAS |
210 | %token <y_type> T_AT_ALLOC_SIZE | | | |
211 | %token <y_type> T_AT_ALIGNED | | 208 | %token <y_type> T_AT_ALIGNED |
| | | 209 | %token <y_type> T_AT_ALLOC_SIZE |
212 | %token <y_type> T_AT_ALWAYS_INLINE | | 210 | %token <y_type> T_AT_ALWAYS_INLINE |
213 | %token <y_type> T_AT_BOUNDED | | 211 | %token <y_type> T_AT_BOUNDED |
214 | %token <y_type> T_AT_BUFFER | | 212 | %token <y_type> T_AT_BUFFER |
215 | %token <y_type> T_AT_COLD | | 213 | %token <y_type> T_AT_COLD |
216 | %token <y_type> T_AT_CONSTRUCTOR | | 214 | %token <y_type> T_AT_CONSTRUCTOR |
217 | %token <y_type> T_AT_DEPRECATED | | 215 | %token <y_type> T_AT_DEPRECATED |
218 | %token <y_type> T_AT_DESTRUCTOR | | 216 | %token <y_type> T_AT_DESTRUCTOR |
219 | %token <y_type> T_AT_FORMAT | | 217 | %token <y_type> T_AT_FORMAT |
220 | %token <y_type> T_AT_FORMAT_ARG | | 218 | %token <y_type> T_AT_FORMAT_ARG |
221 | %token <y_type> T_AT_FORMAT_GNU_PRINTF | | 219 | %token <y_type> T_AT_FORMAT_GNU_PRINTF |
222 | %token <y_type> T_AT_FORMAT_PRINTF | | 220 | %token <y_type> T_AT_FORMAT_PRINTF |
223 | %token <y_type> T_AT_FORMAT_SCANF | | 221 | %token <y_type> T_AT_FORMAT_SCANF |
224 | %token <y_type> T_AT_FORMAT_STRFMON | | 222 | %token <y_type> T_AT_FORMAT_STRFMON |