[PATCHv2 2/4] gdb: Resolve 49 reduce/reduce conflicts in c-exp.y

Andrew Burgess
2018-12-18T22:40:29Z

This commit splits the ptr_operator rule in c-exp.y in two, resolving
49 reduce/reduce conflicts in the process. There should be no
user visible change after this commit.

There are still 42 shift/reduce and 4 reduce/reduce conflicts
remaining in c-exp.y (using GNU bison 3.0.4).

gdb/ChangeLog:

* c-exp.y (base_ptr_operator): New rule, with non-recursive
content taken from...
(ptr_operator): ...here, leaving just the recursion here.
---
gdb/ChangeLog | 6 ++++++
gdb/c-exp.y | 18 ++++++++----------
2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 447ac78eee1..d2198b1fdf7 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1136,21 +1136,19 @@ const_or_volatile_or_space_identifier:
|
;

-ptr_operator:
- ptr_operator '*'
+base_ptr_operator
+ : '*'
{ insert_type (tp_pointer); }
- const_or_volatile_or_space_identifier
- | '*'
- { insert_type (tp_pointer); }
- const_or_volatile_or_space_identifier
+ const_or_volatile_or_space_identifier
| '&'
{ insert_type (tp_reference); }
- | '&' ptr_operator
- { insert_type (tp_reference); }
| ANDAND
{ insert_type (tp_rvalue_reference); }
- | ANDAND ptr_operator
- { insert_type (tp_rvalue_reference); }
+ ;
+
+ptr_operator
+ : base_ptr_operator
+ | base_ptr_operator base_ptr_operator
;

ptr_operator_ts: ptr_operator
--
2.14.5