This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PING: [PATCH] Fixing parse errors in c-exp.y


Hi all,

This patch is about fixing parse error coming when gdb tries to parse
a pointer to a function pointer. e.g. (int)(**)(int) and the
associated problem, defined in PR 9837, which says wrong parsing when
pointers appear in function argument e.g.  (int)(*)(int*)

Please review this.

Thanks,
Abhijit Halder

Attachment: ChangeLog.txt
Description: Text document

Index: gdb/c-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/c-exp.y,v
retrieving revision 1.82
diff -a -p -u -r1.82 c-exp.y
--- gdb/c-exp.y	6 May 2011 14:12:17 -0000	1.82
+++ gdb/c-exp.y	21 Sep 2011 05:53:28 -0000
@@ -926,6 +926,8 @@ const_or_volatile_or_space_identifier: 
 
 abs_decl:	'*'
 			{ push_type (tp_pointer); $$ = 0; }
+	|	abs_decl '*'
+			{ push_type (tp_pointer); $$ = $1; }
 	|	'*' abs_decl
 			{ push_type (tp_pointer); $$ = $2; }
 	|	'&'
@@ -1162,12 +1164,13 @@ typename:	TYPENAME
 	;
 
 nonempty_typelist
-	:	type
+	:	typebase
 		{ $$ = (struct type **) malloc (sizeof (struct type *) * 2);
 		  $<ivec>$[0] = 1;	/* Number of types in vector */
 		  $$[1] = $1;
 		}
-	|	nonempty_typelist ',' type
+	|	nonempty_typelist '*'
+	|	nonempty_typelist ',' typebase
 		{ int len = sizeof (struct type *) * (++($<ivec>1[0]) + 1);
 		  $$ = (struct type **) realloc ((char *) $1, len);
 		  $$[$<ivec>$[0]] = $3;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]