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 - add nonstring attribute



details:   https://anonhg.NetBSD.org/src/rev/2968819f7473
branches:  trunk
changeset: 983041:2968819f7473
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 30 19:46:24 2021 +0000

description:
- add nonstring attribute
- allow attributes after labels (for unused)
XXX: split the attributes into function, variable, etc attributes
so that we don't accept all attributes in all places (only where they make
sense)

diffstat:

 usr.bin/xlint/lint1/cgram.y |  10 ++++++----
 usr.bin/xlint/lint1/lex.c   |   6 +++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (81 lines):

diff -r 9a453d2bddf0 -r 2968819f7473 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Apr 30 18:59:30 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Fri Apr 30 19:46:24 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.222 2021/04/29 17:11:30 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.223 2021/04/30 19:46:24 christos 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.222 2021/04/29 17:11:30 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.223 2021/04/30 19:46:24 christos Exp $");
 #endif
 
 #include <limits.h>
@@ -123,7 +123,7 @@
 }
 %}
 
-%expect 185
+%expect 189
 
 %union {
        val_t   *y_val;
@@ -235,6 +235,7 @@
 %token <y_type>                T_AT_MODE
 %token <y_type>                T_AT_NOINLINE
 %token <y_type>                T_AT_NONNULL
+%token <y_type>                T_AT_NONSTRING
 %token <y_type>                T_AT_NORETURN
 %token <y_type>                T_AT_NOTHROW
 %token <y_type>                T_AT_NO_INSTRUMENT_FUNCTION
@@ -563,6 +564,7 @@
        | T_AT_SENTINEL
        | T_AT_FORMAT_ARG T_LPAREN constant_expr T_RPAREN
        | T_AT_NONNULL T_LPAREN constant_expr T_RPAREN
+       | T_AT_NONSTRING
        | T_AT_MODE T_LPAREN T_NAME T_RPAREN
        | T_AT_ALIAS T_LPAREN string T_RPAREN
        | T_AT_OPTIMIZE T_LPAREN string T_RPAREN
@@ -1535,7 +1537,7 @@
        ;
 
 labeled_statement:             /* C99 6.8.1 */
-         label statement
+         label opt_type_attribute statement
        ;
 
 label:
diff -r 9a453d2bddf0 -r 2968819f7473 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Fri Apr 30 18:59:30 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Fri Apr 30 19:46:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.29 2021/04/20 21:48:39 christos Exp $ */
+/* $NetBSD: lex.c,v 1.30 2021/04/30 19:46:24 christos 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.29 2021/04/20 21:48:39 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.30 2021/04/30 19:46:24 christos Exp $");
 #endif
 
 #include <ctype.h>
@@ -189,8 +189,8 @@
        kwdef_token(    "mode",         T_AT_MODE,              0,0,1,1,5),
        kwdef_token(    "no_instrument_function",
                                T_AT_NO_INSTRUMENT_FUNCTION,    0,0,1,1,5),
-       kwdef_token(    "nonnull",      T_AT_NONNULL,           0,0,1,1,5),
        kwdef_token(    "noinline",     T_AT_NOINLINE,          0,0,1,1,5),
+       kwdef_token(    "nonstring",    T_AT_NONSTRING,         0,0,1,1,5),
        kwdef_token(    "noreturn",     T_AT_NORETURN,          0,0,1,1,5),
        kwdef_token(    "nothrow",      T_AT_NOTHROW,           0,0,1,1,5),
        kwdef_token(    "optimize",     T_AT_OPTIMIZE,          0,0,1,1,5),



Home | Main Index | Thread Index | Old Index