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: align grammar rules for enum-speci...
details: https://anonhg.NetBSD.org/src/rev/639e48b8ef83
branches: trunk
changeset: 984422:639e48b8ef83
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Jul 06 17:52:04 2021 +0000
description:
lint: align grammar rules for enum-specifier with C99
No functional change.
diffstat:
usr.bin/xlint/lint1/cgram.y | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
diffs (84 lines):
diff -r 2951101c32c7 -r 639e48b8ef83 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Tue Jul 06 17:33:07 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Tue Jul 06 17:52:04 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.258 2021/07/06 16:02:44 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.259 2021/07/06 17:52:04 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.258 2021/07/06 16:02:44 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.259 2021/07/06 17:52:04 rillig Exp $");
#endif
#include <limits.h>
@@ -300,8 +300,7 @@
%type <y_tnode> constant_expr
%type <y_tnode> array_size
%type <y_sym> enum_declaration
-%type <y_sym> enums_with_opt_comma
-%type <y_sym> enums
+%type <y_sym> enumerator_list
%type <y_sym> enumerator
%type <y_sym> enumeration_constant
%type <y_sym> notype_direct_decl
@@ -964,7 +963,7 @@
;
enum_declaration:
- enum_decl_lbrace enums_with_opt_comma T_RBRACE {
+ enum_decl_lbrace enumerator_list enumerator_list_comma_opt T_RBRACE {
$$ = $2;
}
;
@@ -976,9 +975,19 @@
}
;
-enums_with_opt_comma:
- enums
- | enums T_COMMA {
+enumerator_list: /* C99 6.7.2.2 */
+ enumerator
+ | enumerator_list T_COMMA enumerator {
+ $$ = lnklst($1, $3);
+ }
+ | error {
+ $$ = NULL;
+ }
+ ;
+
+enumerator_list_comma_opt:
+ /* empty */
+ | T_COMMA {
if (sflag) {
/* trailing ',' prohibited in enum declaration */
error(54);
@@ -986,21 +995,10 @@
/* trailing ',' prohibited in enum declaration */
c99ism(54);
}
- $$ = $1;
}
;
-enums:
- enumerator
- | enums T_COMMA enumerator {
- $$ = lnklst($1, $3);
- }
- | error {
- $$ = NULL;
- }
- ;
-
-enumerator:
+enumerator: /* C99 6.7.2.2 */
enumeration_constant {
$$ = enumeration_constant($1, enumval, true);
}
Home |
Main Index |
Thread Index |
Old Index