This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Better error reporting for missing semicolons after a struct definition


On 11/05/2010 07:04 PM, Joseph S. Myers wrote:
Consider the following testcase.

struct s { struct { int a; } };
int *f(struct s *p) { return &p->a; }

The attached patch (mostly untested) fixes this testcase. This will also pedwarn:


struct t { int };

like this:

 f.c:3:16: warning: declaration does not declare anything [enabled by default]
 f.c:3:16: warning: no semicolon at end of struct or union [enabled by default]

while GCC 4.5 gives

 f.c:3:16: error: expected identifier or ‘(’ before ‘}’ token
 f.c:3:16: error: expected specifier-qualifier-list at end of input

Paolo

Attachment: c-parser-corner-case.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]