lint: support __attribute__((hot)) The corresponding attribute 'cold' was already added in cgram.y 1.84 from 2016-12-29.diff -r1.1084 -r1.1085 src/distrib/sets/lists/tests/mi
(rillig)
--- src/distrib/sets/lists/tests/mi 2021/07/11 18:58:13 1.1084
+++ src/distrib/sets/lists/tests/mi 2021/07/11 19:24:41 1.1085
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: mi,v 1.1084 2021/07/11 18:58:13 rillig Exp $ | 1 | # $NetBSD: mi,v 1.1085 2021/07/11 19:24:41 rillig Exp $ | |
2 | # | 2 | # | |
3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | 3 | # Note: don't delete entries from here - mark them as "obsolete" instead. | |
4 | # | 4 | # | |
5 | ./etc/mtree/set.tests tests-sys-root | 5 | ./etc/mtree/set.tests tests-sys-root | |
6 | ./usr/libdata/debug/usr/tests tests-base-debug compattestdir | 6 | ./usr/libdata/debug/usr/tests tests-base-debug compattestdir | |
7 | ./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf | 7 | ./usr/libdata/debug/usr/tests/atf tests-atf-debug compattestfile,atf | |
8 | ./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf | 8 | ./usr/libdata/debug/usr/tests/atf/atf-c tests-atf-debug compattestfile,atf | |
9 | ./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf | 9 | ./usr/libdata/debug/usr/tests/atf/atf-c++ tests-atf-debug compattestfile,atf | |
10 | ./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf | 10 | ./usr/libdata/debug/usr/tests/atf/atf-c++/detail tests-atf-debug compattestfile,atf | |
11 | ./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf | 11 | ./usr/libdata/debug/usr/tests/atf/atf-c/detail tests-atf-debug compattestfile,atf | |
12 | ./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete | 12 | ./usr/libdata/debug/usr/tests/atf/atf-compile tests-obsolete obsolete | |
13 | ./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete | 13 | ./usr/libdata/debug/usr/tests/atf/atf-report tests-obsolete obsolete | |
14 | ./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete | 14 | ./usr/libdata/debug/usr/tests/atf/atf-run tests-obsolete obsolete | |
@@ -6223,27 +6223,27 @@ | @@ -6223,27 +6223,27 @@ | |||
6223 | ./usr/tests/usr.bin/xlint/lint1/expr_range.c tests-usr.bin-tests compattestfile,atf | 6223 | ./usr/tests/usr.bin/xlint/lint1/expr_range.c tests-usr.bin-tests compattestfile,atf | |
6224 | ./usr/tests/usr.bin/xlint/lint1/expr_range.exp tests-usr.bin-tests compattestfile,atf | 6224 | ./usr/tests/usr.bin/xlint/lint1/expr_range.exp tests-usr.bin-tests compattestfile,atf | |
6225 | ./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.c tests-usr.bin-tests compattestfile,atf | 6225 | ./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.c tests-usr.bin-tests compattestfile,atf | |
6226 | ./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.exp tests-usr.bin-tests compattestfile,atf | 6226 | ./usr/tests/usr.bin/xlint/lint1/feat_stacktrace.exp tests-usr.bin-tests compattestfile,atf | |
6227 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute.c tests-usr.bin-tests compattestfile,atf | 6227 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute.c tests-usr.bin-tests compattestfile,atf | |
6228 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute.exp tests-usr.bin-tests compattestfile,atf | 6228 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute.exp tests-usr.bin-tests compattestfile,atf | |
6229 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c tests-usr.bin-tests compattestfile,atf | 6229 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c tests-usr.bin-tests compattestfile,atf | |
6230 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.exp tests-usr.bin-tests compattestfile,atf | 6230 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.exp tests-usr.bin-tests compattestfile,atf | |
6231 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c tests-usr.bin-tests compattestfile,atf | 6231 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c tests-usr.bin-tests compattestfile,atf | |
6232 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp tests-usr.bin-tests compattestfile,atf | 6232 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp tests-usr.bin-tests compattestfile,atf | |
6233 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_func.c tests-usr.bin-tests compattestfile,atf | 6233 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_func.c tests-usr.bin-tests compattestfile,atf | |
6234 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_func.exp tests-usr.bin-tests compattestfile,atf | 6234 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_func.exp tests-usr.bin-tests compattestfile,atf | |
6235 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.c tests-usr.bin-tests compattestfile,atf | 6235 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.c tests-usr.bin-tests compattestfile,atf | |
6236 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.exp tests-usr.bin-tests compattestfile,atf | 6236 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.exp tests-obsolete obsolete | |
6237 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_stmt.c tests-usr.bin-tests compattestfile,atf | 6237 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_stmt.c tests-usr.bin-tests compattestfile,atf | |
6238 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_stmt.exp tests-usr.bin-tests compattestfile,atf | 6238 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_stmt.exp tests-usr.bin-tests compattestfile,atf | |
6239 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_type.c tests-usr.bin-tests compattestfile,atf | 6239 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_type.c tests-usr.bin-tests compattestfile,atf | |
6240 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp tests-usr.bin-tests compattestfile,atf | 6240 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp tests-usr.bin-tests compattestfile,atf | |
6241 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_var.c tests-usr.bin-tests compattestfile,atf | 6241 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_var.c tests-usr.bin-tests compattestfile,atf | |
6242 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp tests-usr.bin-tests compattestfile,atf | 6242 | ./usr/tests/usr.bin/xlint/lint1/gcc_attribute_var.exp tests-usr.bin-tests compattestfile,atf | |
6243 | ./usr/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c tests-usr.bin-tests compattestfile,atf | 6243 | ./usr/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c tests-usr.bin-tests compattestfile,atf | |
6244 | ./usr/tests/usr.bin/xlint/lint1/gcc_bit_field_types.exp tests-usr.bin-tests compattestfile,atf | 6244 | ./usr/tests/usr.bin/xlint/lint1/gcc_bit_field_types.exp tests-usr.bin-tests compattestfile,atf | |
6245 | ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.c tests-usr.bin-tests compattestfile,atf | 6245 | ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.c tests-usr.bin-tests compattestfile,atf | |
6246 | ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.exp tests-usr.bin-tests compattestfile,atf | 6246 | ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.exp tests-usr.bin-tests compattestfile,atf | |
6247 | ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.c tests-usr.bin-tests compattestfile,atf | 6247 | ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.c tests-usr.bin-tests compattestfile,atf | |
6248 | ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.exp tests-usr.bin-tests compattestfile,atf | 6248 | ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.exp tests-usr.bin-tests compattestfile,atf | |
6249 | ./usr/tests/usr.bin/xlint/lint1/init.c tests-usr.bin-tests compattestfile,atf | 6249 | ./usr/tests/usr.bin/xlint/lint1/init.c tests-usr.bin-tests compattestfile,atf |
--- src/tests/usr.bin/xlint/lint1/Makefile 2021/07/11 18:58:13 1.85
+++ src/tests/usr.bin/xlint/lint1/Makefile 2021/07/11 19:24:42 1.86
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: Makefile,v 1.85 2021/07/11 18:58:13 rillig Exp $ | 1 | # $NetBSD: Makefile,v 1.86 2021/07/11 19:24:42 rillig Exp $ | |
2 | 2 | |||
3 | NOMAN= # defined | 3 | NOMAN= # defined | |
4 | MAX_MESSAGE= 345 # see lint1/err.c | 4 | MAX_MESSAGE= 345 # see lint1/err.c | |
5 | 5 | |||
6 | .include <bsd.own.mk> | 6 | .include <bsd.own.mk> | |
7 | 7 | |||
8 | TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1 | 8 | TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1 | |
9 | 9 | |||
10 | TESTS_SH= t_integration | 10 | TESTS_SH= t_integration | |
11 | 11 | |||
12 | FILESDIR= ${TESTSDIR} | 12 | FILESDIR= ${TESTSDIR} | |
13 | FILES+= c11_generic_expression.c | 13 | FILES+= c11_generic_expression.c | |
14 | FILES+= c11_generic_expression.exp | 14 | FILES+= c11_generic_expression.exp | |
@@ -120,27 +120,26 @@ FILES+= emit.exp-ln | @@ -120,27 +120,26 @@ FILES+= emit.exp-ln | |||
120 | FILES+= expr_range.c | 120 | FILES+= expr_range.c | |
121 | FILES+= expr_range.exp | 121 | FILES+= expr_range.exp | |
122 | FILES+= feat_stacktrace.c | 122 | FILES+= feat_stacktrace.c | |
123 | FILES+= feat_stacktrace.exp | 123 | FILES+= feat_stacktrace.exp | |
124 | FILES+= gcc_attribute.c | 124 | FILES+= gcc_attribute.c | |
125 | FILES+= gcc_attribute.exp | 125 | FILES+= gcc_attribute.exp | |
126 | FILES+= gcc_attribute_aligned.c | 126 | FILES+= gcc_attribute_aligned.c | |
127 | FILES+= gcc_attribute_aligned.exp | 127 | FILES+= gcc_attribute_aligned.exp | |
128 | FILES+= gcc_attribute_enum.c | 128 | FILES+= gcc_attribute_enum.c | |
129 | FILES+= gcc_attribute_enum.exp | 129 | FILES+= gcc_attribute_enum.exp | |
130 | FILES+= gcc_attribute_func.c | 130 | FILES+= gcc_attribute_func.c | |
131 | FILES+= gcc_attribute_func.exp | 131 | FILES+= gcc_attribute_func.exp | |
132 | FILES+= gcc_attribute_label.c | 132 | FILES+= gcc_attribute_label.c | |
133 | FILES+= gcc_attribute_label.exp | |||
134 | FILES+= gcc_attribute_stmt.c | 133 | FILES+= gcc_attribute_stmt.c | |
135 | FILES+= gcc_attribute_stmt.exp | 134 | FILES+= gcc_attribute_stmt.exp | |
136 | FILES+= gcc_attribute_type.c | 135 | FILES+= gcc_attribute_type.c | |
137 | FILES+= gcc_attribute_type.exp | 136 | FILES+= gcc_attribute_type.exp | |
138 | FILES+= gcc_attribute_var.c | 137 | FILES+= gcc_attribute_var.c | |
139 | FILES+= gcc_attribute_var.exp | 138 | FILES+= gcc_attribute_var.exp | |
140 | FILES+= gcc_bit_field_types.c | 139 | FILES+= gcc_bit_field_types.c | |
141 | FILES+= gcc_bit_field_types.exp | 140 | FILES+= gcc_bit_field_types.exp | |
142 | FILES+= gcc_init_compound_literal.c | 141 | FILES+= gcc_init_compound_literal.c | |
143 | FILES+= gcc_init_compound_literal.exp | 142 | FILES+= gcc_init_compound_literal.exp | |
144 | FILES+= gcc_typeof_after_statement.c | 143 | FILES+= gcc_typeof_after_statement.c | |
145 | FILES+= gcc_typeof_after_statement.exp | 144 | FILES+= gcc_typeof_after_statement.exp | |
146 | FILES+= init.c | 145 | FILES+= init.c |
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_label.c 2021/07/06 17:33:07 1.1
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_label.c 2021/07/11 19:24:42 1.2
@@ -1,31 +1,25 @@ | @@ -1,31 +1,25 @@ | |||
1 | /* $NetBSD: gcc_attribute_label.c,v 1.1 2021/07/06 17:33:07 rillig Exp $ */ | 1 | /* $NetBSD: gcc_attribute_label.c,v 1.2 2021/07/11 19:24:42 rillig Exp $ */ | |
2 | # 3 "gcc_attribute_label.c" | 2 | # 3 "gcc_attribute_label.c" | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Tests for the GCC __attribute__ for labels. | 5 | * Tests for the GCC __attribute__ for labels. | |
6 | * | 6 | * | |
7 | * https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html | 7 | * https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html | |
8 | */ | 8 | */ | |
9 | 9 | |||
10 | void dead(void); | 10 | void dead(void); | |
11 | 11 | |||
12 | void | 12 | void | |
13 | test(int i) | 13 | test(int i) | |
14 | { | 14 | { | |
15 | if (i < 1000) | 15 | if (i < 1000) | |
16 | goto hot; | 16 | goto hot; | |
17 | /* TODO: add quotes to message 232 */ | |||
18 | /*FIXME*//* expect+1: warning: label error unused in function test [232] */ | |||
19 | error: | 17 | error: | |
20 | __attribute__((__cold__)); | 18 | __attribute__((__cold__)); | |
21 | dead(); | 19 | dead(); | |
22 | 20 | |||
23 | hot: | 21 | hot: | |
24 | /* expect+1: error: syntax error '__hot__' [249] */ | |||
25 | __attribute__((__hot__)); | 22 | __attribute__((__hot__)); | |
26 | /*FIXME*//* expect+1: error: 'i' undefined [99] */ | |||
27 | if (i < 0) | 23 | if (i < 0) | |
28 | /* TODO: add quotes to message 23 */ | |||
29 | /* expect+1: warning: undefined label error [23] */ | |||
30 | goto error; | 24 | goto error; | |
31 | } | 25 | } |
--- src/tests/usr.bin/xlint/lint1/msg_023.c 2021/02/21 09:07:58 1.2
+++ src/tests/usr.bin/xlint/lint1/msg_023.c 2021/07/11 19:24:42 1.3
@@ -1,7 +1,14 @@ | @@ -1,7 +1,14 @@ | |||
1 | /* $NetBSD: msg_023.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ | 1 | /* $NetBSD: msg_023.c,v 1.3 2021/07/11 19:24:42 rillig Exp $ */ | |
2 | # 3 "msg_023.c" | 2 | # 3 "msg_023.c" | |
3 | 3 | |||
4 | // Test for message: undefined label %s [23] | 4 | // Test for message: undefined label %s [23] | |
5 | 5 | |||
6 | TODO: "Add example code that triggers the above message." /* expect: 249 */ | 6 | void | |
7 | TODO: "Add example code that almost triggers the above message." | 7 | test(void) | |
8 | { | |||
9 | goto defined_label; | |||
10 | defined_label: | |||
11 | /* TODO: add quotes around '%s' */ | |||
12 | /* expect+1: warning: undefined label undefined_label [23] */ | |||
13 | goto undefined_label; | |||
14 | } |
--- src/tests/usr.bin/xlint/lint1/Attic/msg_023.exp 2021/03/21 20:44:59 1.2
+++ src/tests/usr.bin/xlint/lint1/Attic/msg_023.exp 2021/07/11 19:24:42 1.3
--- src/tests/usr.bin/xlint/lint1/msg_232.c 2021/01/31 11:12:07 1.3
+++ src/tests/usr.bin/xlint/lint1/msg_232.c 2021/07/11 19:24:42 1.4
@@ -1,14 +1,16 @@ | @@ -1,14 +1,16 @@ | |||
1 | /* $NetBSD: msg_232.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ | 1 | /* $NetBSD: msg_232.c,v 1.4 2021/07/11 19:24:42 rillig Exp $ */ | |
2 | # 3 "msg_232.c" | 2 | # 3 "msg_232.c" | |
3 | 3 | |||
4 | // Test for message: label %s unused in function %s [232] | 4 | // Test for message: label %s unused in function %s [232] | |
5 | 5 | |||
6 | void | 6 | void | |
7 | example(void) | 7 | example(void) | |
8 | { | 8 | { | |
9 | goto used_label; | 9 | goto used_label; | |
10 | unused_label: /* expect: 232 */ | 10 | unused_label: /* expect: 232 */ | |
11 | return; | 11 | return; | |
12 | used_label: | 12 | used_label: | |
13 | return; | 13 | return; | |
14 | } | 14 | } | |
15 | ||||
16 | /* TODO: add quotes around '%s' */ |
--- src/usr.bin/xlint/lint1/cgram.y 2021/07/11 19:01:37 1.312
+++ src/usr.bin/xlint/lint1/cgram.y 2021/07/11 19:24:41 1.313
@@ -1,15 +1,15 @@ | @@ -1,15 +1,15 @@ | |||
1 | %{ | 1 | %{ | |
2 | /* $NetBSD: cgram.y,v 1.312 2021/07/11 19:01:37 rillig Exp $ */ | 2 | /* $NetBSD: cgram.y,v 1.313 2021/07/11 19:24:41 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.312 2021/07/11 19:01:37 rillig Exp $"); | 38 | __RCSID("$NetBSD: cgram.y,v 1.313 2021/07/11 19:24:41 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. | |
@@ -221,26 +221,27 @@ anonymize(sym_t *s) | @@ -221,26 +221,27 @@ anonymize(sym_t *s) | |||
221 | %token T_AT_CONSTRUCTOR | 221 | %token T_AT_CONSTRUCTOR | |
222 | %token T_AT_DEPRECATED | 222 | %token T_AT_DEPRECATED | |
223 | %token T_AT_DESTRUCTOR | 223 | %token T_AT_DESTRUCTOR | |
224 | %token T_AT_FALLTHROUGH | 224 | %token T_AT_FALLTHROUGH | |
225 | %token T_AT_FORMAT | 225 | %token T_AT_FORMAT | |
226 | %token T_AT_FORMAT_ARG | 226 | %token T_AT_FORMAT_ARG | |
227 | %token T_AT_FORMAT_GNU_PRINTF | 227 | %token T_AT_FORMAT_GNU_PRINTF | |
228 | %token T_AT_FORMAT_PRINTF | 228 | %token T_AT_FORMAT_PRINTF | |
229 | %token T_AT_FORMAT_SCANF | 229 | %token T_AT_FORMAT_SCANF | |
230 | %token T_AT_FORMAT_STRFMON | 230 | %token T_AT_FORMAT_STRFMON | |
231 | %token T_AT_FORMAT_STRFTIME | 231 | %token T_AT_FORMAT_STRFTIME | |
232 | %token T_AT_FORMAT_SYSLOG | 232 | %token T_AT_FORMAT_SYSLOG | |
233 | %token T_AT_GNU_INLINE | 233 | %token T_AT_GNU_INLINE | |
234 | %token T_AT_HOT | |||
234 | %token T_AT_MALLOC | 235 | %token T_AT_MALLOC | |
235 | %token T_AT_MAY_ALIAS | 236 | %token T_AT_MAY_ALIAS | |
236 | %token T_AT_MINBYTES | 237 | %token T_AT_MINBYTES | |
237 | %token T_AT_MODE | 238 | %token T_AT_MODE | |
238 | %token T_AT_NOINLINE | 239 | %token T_AT_NOINLINE | |
239 | %token T_AT_NONNULL | 240 | %token T_AT_NONNULL | |
240 | %token T_AT_NONSTRING | 241 | %token T_AT_NONSTRING | |
241 | %token T_AT_NORETURN | 242 | %token T_AT_NORETURN | |
242 | %token T_AT_NOTHROW | 243 | %token T_AT_NOTHROW | |
243 | %token T_AT_NO_INSTRUMENT_FUNCTION | 244 | %token T_AT_NO_INSTRUMENT_FUNCTION | |
244 | %token T_AT_OPTIMIZE | 245 | %token T_AT_OPTIMIZE | |
245 | %token T_AT_PACKED | 246 | %token T_AT_PACKED | |
246 | %token T_AT_PCS | 247 | %token T_AT_PCS | |
@@ -2018,26 +2019,27 @@ gcc_attribute_spec: | @@ -2018,26 +2019,27 @@ gcc_attribute_spec: | |||
2018 | | T_AT_CONSTRUCTOR T_LPAREN constant_expr T_RPAREN | 2019 | | T_AT_CONSTRUCTOR T_LPAREN constant_expr T_RPAREN | |
2019 | | T_AT_CONSTRUCTOR | 2020 | | T_AT_CONSTRUCTOR | |
2020 | | T_AT_DEPRECATED T_LPAREN string T_RPAREN | 2021 | | T_AT_DEPRECATED T_LPAREN string T_RPAREN | |
2021 | | T_AT_DEPRECATED | 2022 | | T_AT_DEPRECATED | |
2022 | | T_AT_DESTRUCTOR T_LPAREN constant_expr T_RPAREN | 2023 | | T_AT_DESTRUCTOR T_LPAREN constant_expr T_RPAREN | |
2023 | | T_AT_DESTRUCTOR | 2024 | | T_AT_DESTRUCTOR | |
2024 | | T_AT_FALLTHROUGH { | 2025 | | T_AT_FALLTHROUGH { | |
2025 | fallthru(1); | 2026 | fallthru(1); | |
2026 | } | 2027 | } | |
2027 | | T_AT_FORMAT T_LPAREN gcc_attribute_format T_COMMA | 2028 | | T_AT_FORMAT T_LPAREN gcc_attribute_format T_COMMA | |
2028 | constant_expr T_COMMA constant_expr T_RPAREN | 2029 | constant_expr T_COMMA constant_expr T_RPAREN | |
2029 | | T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN | 2030 | | T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN | |
2030 | | T_AT_GNU_INLINE | 2031 | | T_AT_GNU_INLINE | |
2032 | | T_AT_HOT | |||
2031 | | T_AT_MALLOC | 2033 | | T_AT_MALLOC | |
2032 | | T_AT_MAY_ALIAS | 2034 | | T_AT_MAY_ALIAS | |
2033 | | T_AT_MODE T_LPAREN T_NAME T_RPAREN | 2035 | | T_AT_MODE T_LPAREN T_NAME T_RPAREN | |
2034 | | T_AT_NOINLINE | 2036 | | T_AT_NOINLINE | |
2035 | | T_AT_NONNULL T_LPAREN constant_expr_list_opt T_RPAREN | 2037 | | T_AT_NONNULL T_LPAREN constant_expr_list_opt T_RPAREN | |
2036 | | T_AT_NONNULL | 2038 | | T_AT_NONNULL | |
2037 | | T_AT_NONSTRING | 2039 | | T_AT_NONSTRING | |
2038 | | T_AT_NORETURN | 2040 | | T_AT_NORETURN | |
2039 | | T_AT_NOTHROW | 2041 | | T_AT_NOTHROW | |
2040 | | T_AT_NO_INSTRUMENT_FUNCTION | 2042 | | T_AT_NO_INSTRUMENT_FUNCTION | |
2041 | | T_AT_OPTIMIZE T_LPAREN string T_RPAREN | 2043 | | T_AT_OPTIMIZE T_LPAREN string T_RPAREN | |
2042 | | T_AT_PACKED { | 2044 | | T_AT_PACKED { | |
2043 | addpacked(); | 2045 | addpacked(); |
--- src/usr.bin/xlint/lint1/lex.c 2021/07/10 17:46:55 1.54
+++ src/usr.bin/xlint/lint1/lex.c 2021/07/11 19:24:41 1.55
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lex.c,v 1.54 2021/07/10 17:46:55 rillig Exp $ */ | 1 | /* $NetBSD: lex.c,v 1.55 2021/07/11 19:24:41 rillig Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. | |
5 | * Copyright (c) 1994, 1995 Jochen Pohl | 5 | * Copyright (c) 1994, 1995 Jochen Pohl | |
6 | * All Rights Reserved. | 6 | * All Rights Reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -28,27 +28,27 @@ | @@ -28,27 +28,27 @@ | |||
28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #if HAVE_NBTOOL_CONFIG_H | 35 | #if HAVE_NBTOOL_CONFIG_H | |
36 | #include "nbtool_config.h" | 36 | #include "nbtool_config.h" | |
37 | #endif | 37 | #endif | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | #if defined(__RCSID) && !defined(lint) | 40 | #if defined(__RCSID) && !defined(lint) | |
41 | __RCSID("$NetBSD: lex.c,v 1.54 2021/07/10 17:46:55 rillig Exp $"); | 41 | __RCSID("$NetBSD: lex.c,v 1.55 2021/07/11 19:24:41 rillig Exp $"); | |
42 | #endif | 42 | #endif | |
43 | 43 | |||
44 | #include <ctype.h> | 44 | #include <ctype.h> | |
45 | #include <errno.h> | 45 | #include <errno.h> | |
46 | #include <float.h> | 46 | #include <float.h> | |
47 | #include <limits.h> | 47 | #include <limits.h> | |
48 | #include <math.h> | 48 | #include <math.h> | |
49 | #include <stdlib.h> | 49 | #include <stdlib.h> | |
50 | #include <string.h> | 50 | #include <string.h> | |
51 | 51 | |||
52 | #include "lint1.h" | 52 | #include "lint1.h" | |
53 | #include "cgram.h" | 53 | #include "cgram.h" | |
54 | 54 | |||
@@ -172,26 +172,27 @@ static struct kwtab { | @@ -172,26 +172,27 @@ static struct kwtab { | |||
172 | kwdef_type( "double", DOUBLE, 0,0,0,0,1), | 172 | kwdef_type( "double", DOUBLE, 0,0,0,0,1), | |
173 | kwdef_keyword( "else", T_ELSE), | 173 | kwdef_keyword( "else", T_ELSE), | |
174 | kwdef_keyword( "enum", T_ENUM), | 174 | kwdef_keyword( "enum", T_ENUM), | |
175 | kwdef_token( "extension", T_EXTENSION, 0,0,1,0,4), | 175 | kwdef_token( "extension", T_EXTENSION, 0,0,1,0,4), | |
176 | kwdef_sclass( "extern", EXTERN, 0,0,0,0,1), | 176 | kwdef_sclass( "extern", EXTERN, 0,0,0,0,1), | |
177 | kwdef_gcc_attr( "fallthrough", T_AT_FALLTHROUGH), | 177 | kwdef_gcc_attr( "fallthrough", T_AT_FALLTHROUGH), | |
178 | kwdef_type( "float", FLOAT, 0,0,0,0,1), | 178 | kwdef_type( "float", FLOAT, 0,0,0,0,1), | |
179 | kwdef_keyword( "for", T_FOR), | 179 | kwdef_keyword( "for", T_FOR), | |
180 | kwdef_gcc_attr( "format", T_AT_FORMAT), | 180 | kwdef_gcc_attr( "format", T_AT_FORMAT), | |
181 | kwdef_gcc_attr( "format_arg", T_AT_FORMAT_ARG), | 181 | kwdef_gcc_attr( "format_arg", T_AT_FORMAT_ARG), | |
182 | kwdef_gcc_attr( "gnu_inline", T_AT_GNU_INLINE), | 182 | kwdef_gcc_attr( "gnu_inline", T_AT_GNU_INLINE), | |
183 | kwdef_gcc_attr( "gnu_printf", T_AT_FORMAT_GNU_PRINTF), | 183 | kwdef_gcc_attr( "gnu_printf", T_AT_FORMAT_GNU_PRINTF), | |
184 | kwdef_keyword( "goto", T_GOTO), | 184 | kwdef_keyword( "goto", T_GOTO), | |
185 | kwdef_gcc_attr( "hot", T_AT_HOT), | |||
185 | kwdef_keyword( "if", T_IF), | 186 | kwdef_keyword( "if", T_IF), | |
186 | kwdef_token( "imag", T_IMAG, 0,0,1,0,4), | 187 | kwdef_token( "imag", T_IMAG, 0,0,1,0,4), | |
187 | kwdef_sclass( "inline", INLINE, 0,1,0,0,7), | 188 | kwdef_sclass( "inline", INLINE, 0,1,0,0,7), | |
188 | kwdef_type( "int", INT, 0,0,0,0,1), | 189 | kwdef_type( "int", INT, 0,0,0,0,1), | |
189 | kwdef_type( "long", LONG, 0,0,0,0,1), | 190 | kwdef_type( "long", LONG, 0,0,0,0,1), | |
190 | kwdef_gcc_attr( "malloc", T_AT_MALLOC), | 191 | kwdef_gcc_attr( "malloc", T_AT_MALLOC), | |
191 | kwdef_gcc_attr( "may_alias", T_AT_MAY_ALIAS), | 192 | kwdef_gcc_attr( "may_alias", T_AT_MAY_ALIAS), | |
192 | kwdef_gcc_attr( "minbytes", T_AT_MINBYTES), | 193 | kwdef_gcc_attr( "minbytes", T_AT_MINBYTES), | |
193 | kwdef_gcc_attr( "mode", T_AT_MODE), | 194 | kwdef_gcc_attr( "mode", T_AT_MODE), | |
194 | kwdef_gcc_attr("no_instrument_function", | 195 | kwdef_gcc_attr("no_instrument_function", | |
195 | T_AT_NO_INSTRUMENT_FUNCTION), | 196 | T_AT_NO_INSTRUMENT_FUNCTION), | |
196 | kwdef_gcc_attr( "noinline", T_AT_NOINLINE), | 197 | kwdef_gcc_attr( "noinline", T_AT_NOINLINE), | |
197 | kwdef_gcc_attr( "nonnull", T_AT_NONNULL), | 198 | kwdef_gcc_attr( "nonnull", T_AT_NONNULL), |