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]

Re: [PATCH] Fixing parse error for "pointer to a function pointer"


On Mon, Sep 19, 2011 at 8:48 PM, Abhijit Halder
<abhijit.k.halder@gmail.com> wrote:
> Today GDB complains to parse a pointer to a function pointer.
>
> GNU gdb (GDB) 7.3.50.20110916-cvs
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. ?Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> (gdb) ptype int(**)()
> A syntax error in expression, near `*)()'.
> (gdb)
>
> I am sending this patch to fix this issue. ?Please review the same.
> NB: I am working on the test-cases and will update the patch with the
> same very soon.
>
> Regards,
> Abhijit Halder
>

Hi I have made some changes to fix the PR 9837.

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]