Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-20 Thread Marek Polacek
On Wed, Jan 20, 2016 at 06:52:48PM +0530, Prathamesh Kulkarni wrote: > Thanks for the review, I have done the suggested changes in this > version of the patch. > Ok for trunk ? Given that Joseph already approved substance of the patch, this is ok (but you might want to correct a typo below),

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-20 Thread Prathamesh Kulkarni
On 19 January 2016 at 16:49, Marek Polacek wrote: > Sorry for speaking up late, but I think we could do better with formatting > in this patch: > > On Sat, Jan 16, 2016 at 03:45:22PM +0530, Prathamesh Kulkarni wrote: >> diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c >> index

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-19 Thread Marek Polacek
Sorry for speaking up late, but I think we could do better with formatting in this patch: On Sat, Jan 16, 2016 at 03:45:22PM +0530, Prathamesh Kulkarni wrote: > diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c > index 915376d..d36fc67 100644 > --- a/gcc/c/c-decl.c > +++ b/gcc/c/c-decl.c > @@ -4791,6

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-18 Thread Joseph Myers
On Sat, 16 Jan 2016, Prathamesh Kulkarni wrote: > > There's a GNU C extension allowing forward declarations of enums, and it > > seems that > > > > static enum e x; > > > > doesn't get diagnosed either with -fsyntax-only. Thus I think you should > > cover that case as well. > Done in the

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-16 Thread Prathamesh Kulkarni
On 16 January 2016 at 02:56, Joseph Myers wrote: > On Fri, 15 Jan 2016, Prathamesh Kulkarni wrote: > >> On 15 January 2016 at 03:27, Joseph Myers wrote: >> > On Thu, 14 Jan 2016, Prathamesh Kulkarni wrote: >> > >> >> Hi, >> >> For test-case

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-15 Thread Prathamesh Kulkarni
On 15 January 2016 at 03:27, Joseph Myers wrote: > On Thu, 14 Jan 2016, Prathamesh Kulkarni wrote: > >> Hi, >> For test-case containing only the following declaration: >> static struct undefined_struct object; >> gcc rejects it at -O0 in assemble_variable() with error

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-15 Thread Joseph Myers
On Fri, 15 Jan 2016, Prathamesh Kulkarni wrote: > On 15 January 2016 at 03:27, Joseph Myers wrote: > > On Thu, 14 Jan 2016, Prathamesh Kulkarni wrote: > > > >> Hi, > >> For test-case containing only the following declaration: > >> static struct undefined_struct object; >

reject decl with incomplete struct/union type in check_global_declaration()

2016-01-14 Thread Prathamesh Kulkarni
Hi, For test-case containing only the following declaration: static struct undefined_struct object; gcc rejects it at -O0 in assemble_variable() with error "storage size of is unknown", however no error is reported when compiled with -O2. AFAIU that happens because at -O2, analyze_function()

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-14 Thread Joseph Myers
On Thu, 14 Jan 2016, Prathamesh Kulkarni wrote: > Hi, > For test-case containing only the following declaration: > static struct undefined_struct object; > gcc rejects it at -O0 in assemble_variable() with error "storage size > of is unknown", > however no error is reported when compiled with

Re: reject decl with incomplete struct/union type in check_global_declaration()

2016-01-14 Thread Nathan Sidwell
On 01/14/16 16:57, Joseph Myers wrote: On Thu, 14 Jan 2016, Prathamesh Kulkarni wrote: g++ rejects it during parsing. I tried similarly in C FE by adding a check for decl with incomplete struct/union type in finish_decl(), however that fails to compile the following case: typedef struct foo