From: Abhijit Halder <abhijit.k.halder@gmail.com>
To: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: PING: [PATCH] Fixing parse errors in c-exp.y
Date: Sat, 24 Sep 2011 10:37:00 -0000 [thread overview]
Message-ID: <CAOhZP9yJmAhfHU_A_UR4xiVkijzbYKUb3tjbdNYnsYTZQHsk+g@mail.gmail.com> (raw)
[-- 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;
next reply other threads:[~2011-09-24 9:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-24 10:37 Abhijit Halder [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOhZP9yJmAhfHU_A_UR4xiVkijzbYKUb3tjbdNYnsYTZQHsk+g@mail.gmail.com \
--to=abhijit.k.halder@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox