Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PING: [PATCH] Fixing parse errors in c-exp.y
@ 2011-09-24 10:37 Abhijit Halder
  2011-09-24 10:44 ` Abhijit Halder
  2011-09-26 19:12 ` Keith Seitz
  0 siblings, 2 replies; 5+ messages in thread
From: Abhijit Halder @ 2011-09-24 10:37 UTC (permalink / raw)
  To: gdb-patches@sourceware.org ml

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

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 #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 268 bytes --]

2011-09-13  Abhijit Halder  <abhijit.k.halder@gmail.com>

	PR wrong parse/9837:
	* c-exp.y (nonempty_typelist): Use typebase instead of type.  Add rule
	to resolve pointers in function arguments.
	(abs_decl): Add new rule to resolve pointer(s) to a
	function pointer.

[-- Attachment #3: gdb-parse-error.patch --]
[-- Type: text/x-patch, Size: 976 bytes --]

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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-27  6:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-24 10:37 PING: [PATCH] Fixing parse errors in c-exp.y Abhijit Halder
2011-09-24 10:44 ` Abhijit Halder
2011-09-25  8:51   ` Abhijit Halder
2011-09-26 19:12 ` Keith Seitz
2011-09-27 10:44   ` Abhijit Halder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox