From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 955 invoked by alias); 17 Oct 2011 10:59:22 -0000 Received: (qmail 941 invoked by uid 22791); 17 Oct 2011 10:59:21 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_VS X-Spam-Check-By: sourceware.org Received: from mail-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Oct 2011 10:59:02 +0000 Received: by wwe32 with SMTP id 32so1940388wwe.0 for ; Mon, 17 Oct 2011 03:59:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.121.136 with SMTP id h8mr6662207wbr.74.1318849141131; Mon, 17 Oct 2011 03:59:01 -0700 (PDT) Received: by 10.180.102.165 with HTTP; Mon, 17 Oct 2011 03:59:01 -0700 (PDT) In-Reply-To: <4E8E18FC.4030705@redhat.com> References: <201109291210.01022.pedro@codesourcery.com> <4E8E18FC.4030705@redhat.com> Date: Mon, 17 Oct 2011 11:16:00 -0000 Message-ID: Subject: Re: [PATCH] [PR 9514] Fixing parse error for "pointer to a function pointer" From: Abhijit Halder To: Keith Seitz Cc: Tom Tromey , gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00459.txt.bz2 On Fri, Oct 7, 2011 at 2:39 AM, Keith Seitz wrote: > On 10/03/2011 09:45 AM, Tom Tromey wrote: >> >> Also, please look at my earlier patch for this bug. =A0I think it shows >> some cases that your patch does not address: >> >> =A0 =A0 http://sourceware.org/ml/gdb-patches/2008-08/msg00539.html >> >> Perhaps I ought to simply commit that patch. =A0I am not sure why I never >> have. =A0What do you think? > > I've looked over both of these patches. Abhijit's original patch is much > simpler, but there are still regressions using it w/CVS HEAD: > > +FAIL: gdb.base/code-expr.exp: (int ** @code) > +FAIL: gdb.base/cvexpr.exp: (int ** const) > With latest CVS code the patch has no regression: ahalder@ahalder-VirtualBox:~/Projects/gdb-enhanced/sandbox/src/gdb$ make check RUNTESTFLAGS=3Dcvexpr.exp make[1]: Entering directory `/home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite' Nothing to be done for all... rootme=3D`pwd`; export rootme; srcdir=3D. ; export srcdir ; EXPECT=3D`if [ -f ${rootme}/../../expect/expect ] ; then echo ${rootme}/../../expect/expect ; else echo expect ; fi` ; export EXPECT ; EXEEXT=3D ; export EXEEXT ; LD_LIBRARY_PATH=3D$rootme/../../expect:$rootme/../../libstdc++:$rootme/../.= ./tk/unix:$rootme/../../tcl/unix:$rootme/../../bfd:$rootme/../../opcodes:$L= D_LIBRARY_PATH; export LD_LIBRARY_PATH; if [ -f ${rootme}/../../expect/expect ] ; then TCL_LIBRARY=3D${srcdir}/../../tcl/library ; export TCL_LIBRARY ; fi ; runtest cvexpr.exp Test Run By ahalder on Mon Oct 17 14:48:12 2011 Native configuration is i686-pc-linux-gnu =3D=3D=3D gdb tests =3D=3D=3D Schedule of variations: unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for targ= et. Using ./config/unix.exp as tool-and-target-specific interface file. Running ./gdb.base/cvexpr.exp ... =3D=3D=3D gdb Summary =3D=3D=3D # of expected passes 115 /home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite/../../gdb/gdb version 7.3.50.20111017-cvs -nw -nx -data-directory /home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite/../data-direc= tory make[1]: Leaving directory `/home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite' ahalder@ahalder-VirtualBox:~/Projects/gdb-enhanced/sandbox/src/gdb$ make check RUNTESTFLAGS=3Dcode-expr.exp make[1]: Entering directory `/home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite' Nothing to be done for all... rootme=3D`pwd`; export rootme; srcdir=3D. ; export srcdir ; EXPECT=3D`if [ -f ${rootme}/../../expect/expect ] ; then echo ${rootme}/../../expect/expect ; else echo expect ; fi` ; export EXPECT ; EXEEXT=3D ; export EXEEXT ; LD_LIBRARY_PATH=3D$rootme/../../expect:$rootme/../../libstdc++:$rootme/../.= ./tk/unix:$rootme/../../tcl/unix:$rootme/../../bfd:$rootme/../../opcodes:$L= D_LIBRARY_PATH; export LD_LIBRARY_PATH; if [ -f ${rootme}/../../expect/expect ] ; then TCL_LIBRARY=3D${srcdir}/../../tcl/library ; export TCL_LIBRARY ; fi ; runtest code-expr.exp Test Run By ahalder on Mon Oct 17 14:48:19 2011 Native configuration is i686-pc-linux-gnu =3D=3D=3D gdb tests =3D=3D=3D Schedule of variations: unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for targ= et. Using ./config/unix.exp as tool-and-target-specific interface file. Running ./gdb.base/code-expr.exp ... =3D=3D=3D gdb Summary =3D=3D=3D # of expected passes 101 /home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite/../../gdb/gdb version 7.3.50.20111017-cvs -nw -nx -data-directory /home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite/../data-direc= tory make[1]: Leaving directory `/home/ahalder/Projects/gdb-enhanced/sandbox/src/gdb/testsuite' ahalder@ahalder-VirtualBox:~/Projects/gdb-enhanced/sandbox/src/gdb$ ---------------------------------------------------------------------------= --------------------------------------- ahalder@ahalder-VirtualBox:~/Projects/gdb-enhanced/sandbox/src/gdb$ cvsdiff c-exp.y Index: c-exp.y =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/c-exp.y,v retrieving revision 1.84 diff -a -p -u -r1.84 c-exp.y --- c-exp.y 11 Oct 2011 15:24:10 -0000 1.84 +++ c-exp.y 17 Oct 2011 10:58:06 -0000 @@ -942,6 +942,8 @@ const_or_volatile_or_space_identifier: abs_decl: '*' { push_type (tp_pointer); $$ =3D 0; } + | abs_decl '*' + { push_type (tp_pointer); $$ =3D $1; } | '*' abs_decl { push_type (tp_pointer); $$ =3D $2; } | '&' > I think Tom's approach is more generic, however more (marginally) > complicated, but it, too, suffers from some problems. Most specifically, = the > ptr_operator production conflicts with the conversion operator production. > Consider "ptype &foo::operator char* (void)" from cplusfuncs.exp. > > We end up in the "OPERATOR ptype" production, but because of the new > ptr_operator rules, this is parsed as OPERATOR, nonempty_typelist, func_m= od > instead of OPERATOR, nonempty_typelist, '(', nonempty_typelist, ')' > > So we end up with "operator char (*" with Tom's patch. I keep thinking th= ere > must be a way to force the parser through the OPERATOR ptype production a= nd > then the TYPE_INSTANCE production, but I have not been successful. More > savvy bison-ers might be able to do it, though. Or maybe I'll dedicate so= me > time to this and figure it out. > > Maybe some crafty massaging of these three productions will yield a > "simpler" answer. > > Keith >