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 buffer bounded attribute



details:   https://anonhg.NetBSD.org/src/rev/37ab306925c5
branches:  trunk
changeset: 349985:37ab306925c5
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 30 19:53:08 2016 +0000

description:
- add buffer bounded attribute
- allow empty attributes

diffstat:

 usr.bin/xlint/lint1/cgram.y |  24 ++++++++++++++----------
 usr.bin/xlint/lint1/scan.l  |   5 +++--
 2 files changed, 17 insertions(+), 12 deletions(-)

diffs (96 lines):

diff -r 5785063de768 -r 37ab306925c5 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Fri Dec 30 19:45:21 2016 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Fri Dec 30 19:53:08 2016 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.90 2016/12/30 03:36:51 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.91 2016/12/30 19:53:08 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.90 2016/12/30 03:36:51 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.91 2016/12/30 19:53:08 christos Exp $");
 #endif
 
 #include <stdlib.h>
@@ -202,6 +202,7 @@
 %token <y_type>                T_AT_ALIGNED
 %token <y_type>                T_AT_ALWAYS_INLINE
 %token <y_type>                T_AT_BOUNDED
+%token <y_type>                T_AT_BUFFER
 %token <y_type>                T_AT_COLD
 %token <y_type>                T_AT_CONSTRUCTOR
 %token <y_type>                T_AT_DEPRECATED
@@ -260,7 +261,6 @@
 %type  <y_type>        struct_spec
 %type  <y_type>        enum_spec
 %type  <y_type>        type_attribute
-%type  <y_type>        type_attribute_spec
 %type  <y_sym>         struct_tag
 %type  <y_sym>         enum_tag
 %type  <y_tspec>       struct
@@ -511,13 +511,18 @@
        | T_AT_FORMAT_STRFTIME
        ;
 
+type_attribute_bounded_type:
+         T_AT_MINBYTES
+       | T_AT_STRING
+       | T_AT_BUFFER
+       ;
+
 type_attribute_spec:
-         T_AT_DEPRECATED
+         /* empty */   
+       | T_AT_DEPRECATED
        | T_AT_ALIGNED T_LPARN constant T_RPARN
-       | T_AT_BOUNDED T_LPARN T_AT_MINBYTES T_COMMA constant T_COMMA
-         constant T_RPARN
-       | T_AT_BOUNDED T_LPARN T_AT_STRING T_COMMA constant T_COMMA
-         constant T_RPARN
+       | T_AT_BOUNDED T_LPARN type_attribute_bounded_type
+         T_COMMA constant T_COMMA constant T_RPARN
        | T_AT_SENTINEL T_LPARN constant T_RPARN
        | T_AT_FORMAT_ARG T_LPARN constant T_RPARN
        | T_AT_NONNULL T_LPARN constant T_RPARN
@@ -732,8 +737,7 @@
        ;
 
 opt_type_attribute:
-         /* empty */ {
-       }
+         /* empty */
        | type_attribute
        ;
 
diff -r 5785063de768 -r 37ab306925c5 usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l        Fri Dec 30 19:45:21 2016 +0000
+++ b/usr.bin/xlint/lint1/scan.l        Fri Dec 30 19:53:08 2016 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.75 2016/12/30 02:16:36 christos Exp $ */
+/* $NetBSD: scan.l,v 1.76 2016/12/30 19:53:08 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: scan.l,v 1.75 2016/12/30 02:16:36 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.76 2016/12/30 19:53:08 christos Exp $");
 #endif
 
 #include <stdlib.h>
@@ -217,6 +217,7 @@
        { "auto",       T_SCLASS,       AUTO,   0,      0,        0,0,0,0,1 },
        { "bounded",    T_AT_BOUNDED,   0,      0,      0,        0,0,1,1,5 },
        { "break",      T_BREAK,        0,      0,      0,        0,0,0,0,1 },
+       { "buffer",     T_AT_BUFFER,    0,      0,      0,        0,0,1,1,5 },
        { "case",       T_CASE,         0,      0,      0,        0,0,0,0,1 },
        { "char",       T_TYPE,         0,      CHAR,   0,        0,0,0,0,1 },
        { "cold",       T_AT_COLD,      0,      0,      0,        0,0,1,1,5 },



Home | Main Index | Thread Index | Old Index