[patch/rfc] Test struct0

Andrew Cagney cagney@gnu.org
Wed Feb 4 15:52:00 GMT 2004


> On Tue, Feb 03, 2004 at 07:06:47PM -0500, Andrew Cagney wrote:
> 
>> Hello,
>> 
>> This adds a test for:
>> 
>> 	struct foo0 { };
>> 
>> to the structs.exp testcase (I'm assuming that this is legal ISO-C), it 
> 
> 
> Nope.

I guess I misunderstood Jim's comments.
http://sources.redhat.com/ml/gdb-patches/2004-01/msg00717.html

>       struct-or-union-specifier:
>            struct-or-union identifier-opt { struct-declaration-list }
>            struct-or-union identifier
> 
>       struct-or-union:
>            struct
>            union
> 
>       struct-declaration-list:
>            struct-declaration
>            struct-declaration-list struct-declaration
> 
>       struct-declaration:
>            specifier-qualifier-list struct-declarator-list ;
> 
> So there must be a minimum of one declarator and trailing semicolon
> inside the braces.  GCC will warn about this if you ask it to - it's
> probably -ansi, or -std=c89 -ansi -pedantic.

> While it's not legal C, I believe that it is legal C++.

But are you sure?  :-)  If it's legal C++ then it, along with some other 
wierd-o edge cases should probably be added to a gdb.cp/struct0 test 
(someone with less rusty C++ than me can probably come up with a list).

Trying to include it in structs.exp would just be too messy.

Andrew




More information about the Gdb-patches mailing list