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: resolve conflicts in begin_type_sp...
details: https://anonhg.NetBSD.org/src/rev/c0c843b98922
branches: trunk
changeset: 984854:c0c843b98922
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 25 19:27:26 2021 +0000
description:
lint: resolve conflicts in begin_type_specifier_qualifier_list
The 9 shift/reduce conflicts were all internal to the grammar rule
begin_type_specifier_qualifier_list. Previously, there were two
possible ways to parse '__attribute__(()) const int':
1. '__attribute__(())' 'const int'
2. '__attribute__(()) const' 'int'
Both ways would produce the same result since __attribute__ has almost
no observable effects on the resulting type.
No functional change.
diffstat:
usr.bin/xlint/lint1/cgram.y | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diffs (58 lines):
diff -r d3bab5013792 -r c0c843b98922 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y Sun Jul 25 19:22:08 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y Sun Jul 25 19:27:26 2021 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.343 2021/07/25 19:05:27 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.344 2021/07/25 19:27:26 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.343 2021/07/25 19:05:27 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.344 2021/07/25 19:27:26 rillig Exp $");
#endif
#include <limits.h>
@@ -124,7 +124,7 @@
%}
-%expect 159
+%expect 150
%union {
val_t *y_val;
@@ -778,21 +778,24 @@
;
begin_type_specifier_qualifier_list: /* see C11 6.7.2.1 */
+ begin_type_specifier_qualifier_list_postfix
+ | type_attribute_list begin_type_specifier_qualifier_list_postfix
+ ;
+
+begin_type_specifier_qualifier_list_postfix:
begin_type_typespec {
add_type($1);
}
- /* TODO: shift/reduce conflict for type_attribute */
- | type_attribute begin_type_specifier_qualifier_list
| begin_type_qualifier_list type_specifier {
add_type($2);
}
- | begin_type_specifier_qualifier_list T_QUAL {
+ | begin_type_specifier_qualifier_list_postfix T_QUAL {
add_qualifier($2);
}
- | begin_type_specifier_qualifier_list notype_type_specifier {
+ | begin_type_specifier_qualifier_list_postfix notype_type_specifier {
add_type($2);
}
- | begin_type_specifier_qualifier_list type_attribute
+ | begin_type_specifier_qualifier_list_postfix type_attribute
;
begin_type_typespec:
Home |
Main Index |
Thread Index |
Old Index