Sun Jul 11 19:24:42 2021 UTC ()
lint: support __attribute__((hot))

The corresponding attribute 'cold' was already added in cgram.y 1.84
from 2016-12-29.


(rillig)
diff -r1.1084 -r1.1085 src/distrib/sets/lists/tests/mi
diff -r1.85 -r1.86 src/tests/usr.bin/xlint/lint1/Makefile
diff -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_label.c
diff -r1.1 -r0 src/tests/usr.bin/xlint/lint1/gcc_attribute_label.exp
diff -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_023.c
diff -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_023.exp
diff -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_232.c
diff -r1.312 -r1.313 src/usr.bin/xlint/lint1/cgram.y
diff -r1.54 -r1.55 src/usr.bin/xlint/lint1/lex.c

cvs diff -r1.1084 -r1.1085 src/distrib/sets/lists/tests/mi (expand / switch to unified diff)

--- 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

cvs diff -r1.85 -r1.86 src/tests/usr.bin/xlint/lint1/Makefile (expand / switch to unified diff)

--- 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
3NOMAN= # defined 3NOMAN= # defined
4MAX_MESSAGE= 345 # see lint1/err.c 4MAX_MESSAGE= 345 # see lint1/err.c
5 5
6.include <bsd.own.mk> 6.include <bsd.own.mk>
7 7
8TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1 8TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1
9 9
10TESTS_SH= t_integration 10TESTS_SH= t_integration
11 11
12FILESDIR= ${TESTSDIR} 12FILESDIR= ${TESTSDIR}
13FILES+= c11_generic_expression.c 13FILES+= c11_generic_expression.c
14FILES+= c11_generic_expression.exp 14FILES+= c11_generic_expression.exp
@@ -120,27 +120,26 @@ FILES+= emit.exp-ln @@ -120,27 +120,26 @@ FILES+= emit.exp-ln
120FILES+= expr_range.c 120FILES+= expr_range.c
121FILES+= expr_range.exp 121FILES+= expr_range.exp
122FILES+= feat_stacktrace.c 122FILES+= feat_stacktrace.c
123FILES+= feat_stacktrace.exp 123FILES+= feat_stacktrace.exp
124FILES+= gcc_attribute.c 124FILES+= gcc_attribute.c
125FILES+= gcc_attribute.exp 125FILES+= gcc_attribute.exp
126FILES+= gcc_attribute_aligned.c 126FILES+= gcc_attribute_aligned.c
127FILES+= gcc_attribute_aligned.exp 127FILES+= gcc_attribute_aligned.exp
128FILES+= gcc_attribute_enum.c 128FILES+= gcc_attribute_enum.c
129FILES+= gcc_attribute_enum.exp 129FILES+= gcc_attribute_enum.exp
130FILES+= gcc_attribute_func.c 130FILES+= gcc_attribute_func.c
131FILES+= gcc_attribute_func.exp 131FILES+= gcc_attribute_func.exp
132FILES+= gcc_attribute_label.c 132FILES+= gcc_attribute_label.c
133FILES+= gcc_attribute_label.exp 
134FILES+= gcc_attribute_stmt.c 133FILES+= gcc_attribute_stmt.c
135FILES+= gcc_attribute_stmt.exp 134FILES+= gcc_attribute_stmt.exp
136FILES+= gcc_attribute_type.c 135FILES+= gcc_attribute_type.c
137FILES+= gcc_attribute_type.exp 136FILES+= gcc_attribute_type.exp
138FILES+= gcc_attribute_var.c 137FILES+= gcc_attribute_var.c
139FILES+= gcc_attribute_var.exp 138FILES+= gcc_attribute_var.exp
140FILES+= gcc_bit_field_types.c 139FILES+= gcc_bit_field_types.c
141FILES+= gcc_bit_field_types.exp 140FILES+= gcc_bit_field_types.exp
142FILES+= gcc_init_compound_literal.c 141FILES+= gcc_init_compound_literal.c
143FILES+= gcc_init_compound_literal.exp 142FILES+= gcc_init_compound_literal.exp
144FILES+= gcc_typeof_after_statement.c 143FILES+= gcc_typeof_after_statement.c
145FILES+= gcc_typeof_after_statement.exp 144FILES+= gcc_typeof_after_statement.exp
146FILES+= init.c 145FILES+= init.c

cvs diff -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_label.c (expand / switch to unified diff)

--- 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
10void dead(void); 10void dead(void);
11 11
12void 12void
13test(int i) 13test(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] */ 
19error: 17error:
20 __attribute__((__cold__)); 18 __attribute__((__cold__));
21 dead(); 19 dead();
22 20
23hot: 21hot:
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}

File Deleted: src/tests/usr.bin/xlint/lint1/Attic/gcc_attribute_label.exp

cvs diff -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_023.c (expand / switch to unified diff)

--- 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
6TODO: "Add example code that triggers the above message." /* expect: 249 */ 6void
7TODO: "Add example code that almost triggers the above message." 7test(void)
 8{
 9 goto defined_label;
 10defined_label:
 11 /* TODO: add quotes around '%s' */
 12 /* expect+1: warning: undefined label undefined_label [23] */
 13 goto undefined_label;
 14}

cvs diff -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/Attic/msg_023.exp (expand / switch to unified diff)

--- 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

cvs diff -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_232.c (expand / switch to unified diff)

--- 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
6void 6void
7example(void) 7example(void)
8{ 8{
9 goto used_label; 9 goto used_label;
10unused_label: /* expect: 232 */ 10unused_label: /* expect: 232 */
11 return; 11 return;
12used_label: 12used_label:
13 return; 13 return;
14} 14}
 15
 16/* TODO: add quotes around '%s' */

cvs diff -r1.312 -r1.313 src/usr.bin/xlint/lint1/cgram.y (expand / switch to unified diff)

--- 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
47extern char *yytext; 47extern 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();

cvs diff -r1.54 -r1.55 src/usr.bin/xlint/lint1/lex.c (expand / switch to unified diff)

--- 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),