[RFA] Fix C++ typedefs parsing errors

Doug Evans dje@google.com
Tue Sep 15 22:11:00 GMT 2009


On Mon, Sep 14, 2009 at 3:24 PM, Keith Seitz <keiths@redhat.com> wrote:
> Hi,
>
> The attached patch simply adds two calls to CHECK_TYPEDEF so that the parser
> does not prematurely dismiss typedef'd names of templates and classes as
> errors. It also includes several new tests to check for this.
>
> NOTE: This will add a new failure to classes.exp trying to print the value
> of a ctor via a typedef (e.g., "print Foo::foo"). When CVS HEAD gdb attempts
> to lookup the *method* "foo", it incorrectly gets the *class* "foo". This is
> a known problem (to me, at least). This does not occur with my archer
> expr-cumulative branch, so when that is all finally approved and checked-in,
> this test will just magically pass. :-)
>
> Keith
>
> ChangeLog
> 2009-09-14  Keith Seitz  <keiths@redhat.com>
>
>        * c-exp.y (qualified_name): Call CHECK_TYPEDEF before deciding
>        that a type is not an aggregate type.
>
>
> testsuite/ChangeLog
>
> 2009-09-14  Keith Seitz  <keiths@redhat.com>
>
>        * gdb.cp/classes.exp (do_tests): Add tests to print a constructor
>        and destructor using typedef name of class.
>        * gdb.cp/classes.cc (class Base1): Add a destructor.
>        (base1): New typedef.
>        (use_methods): Instanitate an object of type base1.
>        * gdb.cp/templates.exp (test_template_typedef): New procedure.
>        (do_tests): Call test_template_typedef.
>        * gdb.cp/templates.cc (Baz::~Baz): New method.
>        (intBazOne): New typedef.
>        (main): Instantiate intBazOne.
>

[nothing ventured, nothing gained]

Hi.

It looks fine to me, with one proviso.
Do we want the typedef-stripped type passed to write_exp_elt_type?
It kinda feels like we don't, but I don't honestly know.



More information about the Gdb-patches mailing list