[PATCH 1/5] Remove useless types from parser

Tom Tromey tromey@redhat.com
Fri Jul 6 14:37:00 GMT 2012


This removes some useless yacc type declarations from the parser.
We'll add types back to a couple of these later, but this approach
makes the series more obviously correct.

	* c-exp.y (func_mod, direct_abs_decl, abs_decl, ptr_operator):
	Remove %type.
---
 gdb/c-exp.y |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 7afce77..f86f76f 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -172,7 +172,6 @@ static struct stoken operator_stoken (const char *);
 /* %type <bval> block */
 
 /* Fancy type parsing.  */
-%type <voidval> func_mod direct_abs_decl abs_decl ptr_operator
 %type <tval> ptype
 %type <lval> array_mod
 %type <tval> conversion_type_id
@@ -955,15 +954,13 @@ ptr_operator:
 		ptr_operator '*'
 			{ insert_type (tp_pointer); }
 		const_or_volatile_or_space_identifier
-			{ $$ = 0; }
 	|	'*' 
 			{ insert_type (tp_pointer); }
 		const_or_volatile_or_space_identifier
-			{ $$ = 0; }
 	|	'&'
-			{ insert_type (tp_reference); $$ = 0; }
+			{ insert_type (tp_reference); }
 	|	'&' ptr_operator
-			{ insert_type (tp_reference); $$ = 0; }
+			{ insert_type (tp_reference); }
 	;
 
 abs_decl:	ptr_operator direct_abs_decl
@@ -972,7 +969,6 @@ abs_decl:	ptr_operator direct_abs_decl
 	;
 
 direct_abs_decl: '(' abs_decl ')'
-			{ $$ = $2; }
 	|	direct_abs_decl array_mod
 			{
 			  push_type_int ($2);
@@ -982,7 +978,6 @@ direct_abs_decl: '(' abs_decl ')'
 			{
 			  push_type_int ($1);
 			  push_type (tp_array);
-			  $$ = 0;
 			}
 
 	| 	direct_abs_decl func_mod
@@ -998,9 +993,8 @@ array_mod:	'[' ']'
 	;
 
 func_mod:	'(' ')'
-			{ $$ = 0; }
 	|	'(' nonempty_typelist ')'
-			{ free ($2); $$ = 0; }
+			{ free ($2); }
 	;
 
 /* We used to try to recognize pointer to member types here, but
-- 
1.7.7.6



More information about the Gdb-patches mailing list