Module Name: src
Committed By: rillig
Date: Thu Jul 8 03:35:07 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: cgram.y
Log Message:
lint: clean up grammar for member declarations
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 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/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.268 src/usr.bin/xlint/lint1/cgram.y:1.269
--- src/usr.bin/xlint/lint1/cgram.y:1.268 Thu Jul 8 03:22:47 2021
+++ src/usr.bin/xlint/lint1/cgram.y Thu Jul 8 03:35:07 2021
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.268 2021/07/08 03:22:47 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.269 2021/07/08 03:35:07 rillig 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.268 2021/07/08 03:22:47 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.269 2021/07/08 03:35:07 rillig Exp $");
#endif
#include <limits.h>
@@ -290,7 +290,7 @@ anonymize(sym_t *s)
%type <y_tspec> struct
%type <y_sym> struct_declaration
%type <y_sb> identifier
-%type <y_sym> member_declaration_list_with_rbrace
+%type <y_sym> member_declaration_list_semi
%type <y_sym> member_declaration_list
%type <y_sym> member_declaration
%type <y_sym> notype_member_decls
@@ -662,20 +662,19 @@ struct_tag:
;
struct_declaration:
- struct_decl_lbrace member_declaration_list_with_rbrace {
- $$ = $2;
- }
- ;
-
-struct_decl_lbrace:
T_LBRACE {
symtyp = FVFT;
+ } member_declaration_list_semi T_RBRACE {
+ $$ = $3;
}
;
-member_declaration_list_with_rbrace:
- member_declaration_list T_SEMI T_RBRACE
- | member_declaration_list T_RBRACE {
+member_declaration_list_semi:
+ /* empty */ {
+ $$ = NULL;
+ }
+ | member_declaration_list T_SEMI
+ | member_declaration_list {
if (sflag) {
/* syntax req. ';' after last struct/union member */
error(66);
@@ -685,9 +684,6 @@ member_declaration_list_with_rbrace:
}
$$ = $1;
}
- | T_RBRACE {
- $$ = NULL;
- }
;
member_declaration_list: