Module Name: src
Committed By: rillig
Date: Sat Jul 15 21:47:35 UTC 2023
Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_attribute_var.c
src/usr.bin/xlint/lint1: cgram.y
Log Message:
lint: each member declarator may have attributes, not only the last one
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
cvs rdiff -u -r1.464 -r1.465 src/usr.bin/xlint/lint1/cgram.y
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.10 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.11
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.10 Sat Jul 15 21:40:03 2023
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c Sat Jul 15 21:47:35 2023
@@ -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__(());
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.464 src/usr.bin/xlint/lint1/cgram.y:1.465
--- src/usr.bin/xlint/lint1/cgram.y:1.464 Sat Jul 15 13:51:36 2023
+++ src/usr.bin/xlint/lint1/cgram.y Sat Jul 15 21:47:35 2023
@@ -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));
}
;