Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 lint: support __attribute__((hot))
details: https://anonhg.NetBSD.org/src/rev/b9952b9f1eba
branches: trunk
changeset: 1022292:b9952b9f1eba
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 11 19:24:41 2021 +0000
description:
lint: support __attribute__((hot))
The corresponding attribute 'cold' was already added in cgram.y 1.84
from 2016-12-29.
diffstat:
distrib/sets/lists/tests/mi | 4 ++--
tests/usr.bin/xlint/lint1/Makefile | 3 +--
tests/usr.bin/xlint/lint1/gcc_attribute_label.c | 8 +-------
tests/usr.bin/xlint/lint1/gcc_attribute_label.exp | 4 ----
tests/usr.bin/xlint/lint1/msg_023.c | 13 ++++++++++---
tests/usr.bin/xlint/lint1/msg_023.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_232.c | 4 +++-
usr.bin/xlint/lint1/cgram.y | 6 ++++--
usr.bin/xlint/lint1/lex.c | 5 +++--
9 files changed, 25 insertions(+), 24 deletions(-)
diffs (174 lines):
diff -r ee573d397891 -r b9952b9f1eba distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Jul 11 19:01:37 2021 +0000
+++ b/distrib/sets/lists/tests/mi Sun Jul 11 19:24:41 2021 +0000
@@ -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
diff -r ee573d397891 -r b9952b9f1eba tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile Sun Jul 11 19:01:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile Sun Jul 11 19:24:41 2021 +0000
@@ -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
diff -r ee573d397891 -r b9952b9f1eba tests/usr.bin/xlint/lint1/gcc_attribute_label.c
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_label.c Sun Jul 11 19:01:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute_label.c Sun Jul 11 19:24:41 2021 +0000
@@ -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;
}
diff -r ee573d397891 -r b9952b9f1eba tests/usr.bin/xlint/lint1/gcc_attribute_label.exp
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_label.exp Sun Jul 11 19:01:37 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-gcc_attribute_label.c(25): error: syntax error '__hot__' [249]
-gcc_attribute_label.c(27): error: 'i' undefined [99]
-gcc_attribute_label.c(19): warning: label error unused in function test [232]
-gcc_attribute_label.c(30): warning: undefined label error [23]
diff -r ee573d397891 -r b9952b9f1eba tests/usr.bin/xlint/lint1/msg_023.c
--- a/tests/usr.bin/xlint/lint1/msg_023.c Sun Jul 11 19:01:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_023.c Sun Jul 11 19:24:41 2021 +0000
@@ -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 */
-TODO: "Add example code that almost triggers the above message."
+void
+test(void)
+{
+ goto defined_label;
+defined_label:
+ /* TODO: add quotes around '%s' */
+ /* expect+1: warning: undefined label undefined_label [23] */
+ goto undefined_label;
+}
diff -r ee573d397891 -r b9952b9f1eba tests/usr.bin/xlint/lint1/msg_023.exp
--- a/tests/usr.bin/xlint/lint1/msg_023.exp Sun Jul 11 19:01:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_023.exp Sun Jul 11 19:24:41 2021 +0000
@@ -1,1 +1,1 @@
-msg_023.c(6): error: syntax error ':' [249]
+msg_023.c(13): warning: undefined label undefined_label [23]
diff -r ee573d397891 -r b9952b9f1eba tests/usr.bin/xlint/lint1/msg_232.c
--- a/tests/usr.bin/xlint/lint1/msg_232.c Sun Jul 11 19:01:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_232.c Sun Jul 11 19:24:41 2021 +0000
@@ -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' */
diff -r ee573d397891 -r b9952b9f1eba usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Sun Jul 11 19:01:37 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Sun Jul 11 19:24:41 2021 +0000
@@ -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
diff -r ee573d397891 -r b9952b9f1eba usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Jul 11 19:01:37 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Jul 11 19:24:41 2021 +0000
@@ -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),
Home |
Main Index |
Thread Index |
Old Index