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: each member declarator may have at...



details:   https://anonhg.NetBSD.org/src/rev/6024e75e01b7
branches:  trunk
changeset: 377529:6024e75e01b7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 15 21:47:35 2023 +0000

description:
lint: each member declarator may have attributes, not only the last one

diffstat:

 tests/usr.bin/xlint/lint1/gcc_attribute_var.c |   4 +---
 usr.bin/xlint/lint1/cgram.y                   |  12 ++++++------
 2 files changed, 7 insertions(+), 9 deletions(-)

diffs (68 lines):

diff -r f7ec2949be97 -r 6024e75e01b7 tests/usr.bin/xlint/lint1/gcc_attribute_var.c
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_var.c     Sat Jul 15 21:41:25 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute_var.c     Sat Jul 15 21:47:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gcc_attribute_var.c,v 1.10 2023/07/15 21:40:03 rillig Exp $    */
+/*     $NetBSD: gcc_attribute_var.c,v 1.11 2023/07/15 21:47:35 rillig Exp $    */
 # 3 "gcc_attribute_var.c"
 
 /*
@@ -79,8 +79,6 @@ struct attribute_in_member_declaration {
            y __attribute__(());
 
        unsigned int __attribute__(())
-/* FIXME */
-/* expect+1: error: syntax error ',' [249] */
            bit1:1 __attribute__(()),
            bit2:2 __attribute__(()),
            bit3:3 __attribute__(());
diff -r f7ec2949be97 -r 6024e75e01b7 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Sat Jul 15 21:41:25 2023 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Sat Jul 15 21:47:35 2023 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.464 2023/07/15 13:51:36 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.465 2023/07/15 21:47:35 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.464 2023/07/15 13:51:36 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.465 2023/07/15 21:47:35 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1048,13 +1048,13 @@ member_declaration:
                /* ^^ There is no check for the missing type-specifier. */
                /* too late, i know, but getsym() compensates it */
                set_symtyp(FMEMBER);
-       } notype_member_declarators type_attribute_opt T_SEMI {
+       } notype_member_declarators T_SEMI {
                set_symtyp(FVFT);
                $$ = $4;
        }
 |      begin_type_specifier_qualifier_list end_type {
                set_symtyp(FMEMBER);
-       } type_member_declarators type_attribute_opt T_SEMI {
+       } type_member_declarators T_SEMI {
                set_symtyp(FVFT);
                $$ = $4;
        }
@@ -1128,12 +1128,12 @@ notype_member_declarator:
 /* Was named struct_declarator until C11. */
 type_member_declarator:
        type_declarator
-|      type_declarator T_COLON constant_expression {
+|      type_declarator T_COLON constant_expression type_attribute_list_opt {
                $$ = set_bit_field_width($1, to_int_constant($3, true));
        }
 |      {
                set_symtyp(FVFT);
-       } T_COLON constant_expression {
+       } T_COLON constant_expression type_attribute_list_opt {
                $$ = set_bit_field_width(NULL, to_int_constant($3, true));
        }
 ;



Home | Main Index | Thread Index | Old Index