On Tue, Nov 11, 2014 at 03:24:48AM +0530, Prathamesh Kulkarni wrote: > * gcc/c/c-decl.c > (warn_cxx_compat_finish_struct): Add new parameter of type location_t. > Warn for empty struct. > (finish_struct): Pass loc to warn_cxx_compat_finish_struct. > > * gcc/testsuite/gcc.dg/Wcxx-compat-22.c: New test-case.
No gcc/c/ and gcc/testsuite/ prefixes. > Index: gcc/c/c-decl.c > =================================================================== > --- gcc/c/c-decl.c (revision 217287) > +++ gcc/c/c-decl.c (working copy) > @@ -7506,12 +7506,15 @@ > /* Finish up struct info used by -Wc++-compat. */ > > static void > -warn_cxx_compat_finish_struct (tree fieldlist) > +warn_cxx_compat_finish_struct (tree fieldlist, location_t record_loc) > { > unsigned int ix; > tree x; > struct c_binding *b; > > + if (fieldlist == NULL_TREE) > + warning_at (record_loc, OPT_Wc___compat, "empty struct has size 0 in C, > 1 in C++"); This line is too long. The patch doesn't seem to handle empty unions. Marek