Module Name: src
Committed By: christos
Date: Fri Dec 30 19:53:08 UTC 2016
Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l
Log Message:
- add buffer bounded attribute
- allow empty attributes
To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/xlint/lint1/scan.l
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.90 src/usr.bin/xlint/lint1/cgram.y:1.91
--- src/usr.bin/xlint/lint1/cgram.y:1.90 Thu Dec 29 22:36:51 2016
+++ src/usr.bin/xlint/lint1/cgram.y Fri Dec 30 14:53:08 2016
@@ -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 @@ anonymize(sym_t *s)
%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 @@ anonymize(sym_t *s)
%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 @@ type_attribute_format_type:
| 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 @@ member_declaration_list_with_rbrace:
;
opt_type_attribute:
- /* empty */ {
- }
+ /* empty */
| type_attribute
;
Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.75 src/usr.bin/xlint/lint1/scan.l:1.76
--- src/usr.bin/xlint/lint1/scan.l:1.75 Thu Dec 29 21:16:36 2016
+++ src/usr.bin/xlint/lint1/scan.l Fri Dec 30 14:53:08 2016
@@ -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 @@ static struct kwtab {
{ "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 },