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
--- 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,4 +1,4 @@
-# $NetBSD: mi,v 1.1084 2021/07/11 18:58:13 rillig Exp $
+# $NetBSD: mi,v 1.1085 2021/07/11 19:24:41 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -6233,7 +6233,7 @@
./usr/tests/usr.bin/xlint/lint1/gcc_attribute_func.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/gcc_attribute_func.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.c tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/gcc_attribute_label.exp tests-obsolete obsolete
./usr/tests/usr.bin/xlint/lint1/gcc_attribute_stmt.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/gcc_attribute_stmt.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/gcc_attribute_type.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,4 +1,4 @@
-# $NetBSD: Makefile,v 1.85 2021/07/11 18:58:13 rillig Exp $
+# $NetBSD: Makefile,v 1.86 2021/07/11 19:24:42 rillig Exp $
NOMAN= # defined
MAX_MESSAGE= 345 # see lint1/err.c
@@ -130,7 +130,6 @@
FILES+= gcc_attribute_func.c
FILES+= gcc_attribute_func.exp
FILES+= gcc_attribute_label.c
-FILES+= gcc_attribute_label.exp
FILES+= gcc_attribute_stmt.c
FILES+= gcc_attribute_stmt.exp
FILES+= gcc_attribute_type.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,4 +1,4 @@
-/* $NetBSD: gcc_attribute_label.c,v 1.1 2021/07/06 17:33:07 rillig Exp $ */
+/* $NetBSD: gcc_attribute_label.c,v 1.2 2021/07/11 19:24:42 rillig Exp $ */
# 3 "gcc_attribute_label.c"
/*
@@ -14,18 +14,12 @@
{
if (i < 1000)
goto hot;
- /* TODO: add quotes to message 232 */
- /*FIXME*//* expect+1: warning: label error unused in function test [232] */
error:
__attribute__((__cold__));
dead();
hot:
- /* expect+1: error: syntax error '__hot__' [249] */
__attribute__((__hot__));
- /*FIXME*//* expect+1: error: 'i' undefined [99] */
if (i < 0)
- /* TODO: add quotes to message 23 */
- /* expect+1: warning: undefined label error [23] */
goto error;
}
--- 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 @@
-/* $NetBSD: msg_023.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_023.c,v 1.3 2021/07/11 19:24:42 rillig Exp $ */
# 3 "msg_023.c"
// Test for message: undefined label %s [23]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
+void
-TODO: "Add example code that almost triggers the above message."
+test(void)
+{
+ goto defined_label;
+defined_label:
+ /* TODO: add quotes around '%s' */
+ /* expect+1: warning: undefined label undefined_label [23] */
+ goto undefined_label;
+}
--- 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
@@ -1 +1 @@
-msg_023.c(6): error: syntax error ':' [249]
+msg_023.c(13): warning: undefined label undefined_label [23]
--- 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,4 +1,4 @@
-/* $NetBSD: msg_232.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */
+/* $NetBSD: msg_232.c,v 1.4 2021/07/11 19:24:42 rillig Exp $ */
# 3 "msg_232.c"
// Test for message: label %s unused in function %s [232]
@@ -12,3 +12,5 @@
used_label:
return;
}
+
+/* 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,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.312 2021/07/11 19:01:37 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.313 2021/07/11 19:24:41 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.312 2021/07/11 19:01:37 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.313 2021/07/11 19:24:41 rillig Exp $");
#endif
#include <limits.h>
@@ -231,6 +231,7 @@
%token T_AT_FORMAT_STRFTIME
%token T_AT_FORMAT_SYSLOG
%token T_AT_GNU_INLINE
+%token T_AT_HOT
%token T_AT_MALLOC
%token T_AT_MAY_ALIAS
%token T_AT_MINBYTES
@@ -2028,6 +2029,7 @@
constant_expr T_COMMA constant_expr T_RPAREN
| T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN
| T_AT_GNU_INLINE
+ | T_AT_HOT
| T_AT_MALLOC
| T_AT_MAY_ALIAS
| T_AT_MODE T_LPAREN T_NAME T_RPAREN
--- 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,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.54 2021/07/10 17:46:55 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.55 2021/07/11 19:24:41 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.54 2021/07/10 17:46:55 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.55 2021/07/11 19:24:41 rillig Exp $");
#endif
#include <ctype.h>
@@ -182,6 +182,7 @@
kwdef_gcc_attr( "gnu_inline", T_AT_GNU_INLINE),
kwdef_gcc_attr( "gnu_printf", T_AT_FORMAT_GNU_PRINTF),
kwdef_keyword( "goto", T_GOTO),
+ kwdef_gcc_attr( "hot", T_AT_HOT),
kwdef_keyword( "if", T_IF),
kwdef_token( "imag", T_IMAG, 0,0,1,0,4),
kwdef_sclass( "inline", INLINE, 0,1,0,0,7),