On Wed, Jun 03, 2015 at 02:55:50AM +0530, Prathamesh Kulkarni wrote:
> Sorry I had forgotten about this.
> The attached patch adds warning for empty struct.
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> OK for trunk ?
Ok if testing passed.
Marek
On Sat, Nov 15, 2014 at 3:56 AM, Prathamesh Kulkarni
wrote:
> On Sat, Nov 15, 2014 at 3:06 AM, Joseph Myers wrote:
>> On Wed, 12 Nov 2014, Prathamesh Kulkarni wrote:
>>
>>> Is this version okay ?
>>> [gcc/c]
>>> * c-decl.c (warn_cxx_compat_finish_struct): New parameters code,
>>> record_loc.
>
On Sat, Nov 15, 2014 at 3:06 AM, Joseph Myers wrote:
> On Wed, 12 Nov 2014, Prathamesh Kulkarni wrote:
>
>> Is this version okay ?
>> [gcc/c]
>> * c-decl.c (warn_cxx_compat_finish_struct): New parameters code,
>> record_loc.
>> Warn for empty struct.
>> (finish_struct): Pass TREE_CO
On Wed, 12 Nov 2014, Prathamesh Kulkarni wrote:
> Is this version okay ?
> [gcc/c]
> * c-decl.c (warn_cxx_compat_finish_struct): New parameters code, record_loc.
> Warn for empty struct.
> (finish_struct): Pass TREE_CODE (t) and loc to
> warn_cxx_compat_finish_struct.
>
> [gcc/tests
On Wed, Nov 12, 2014 at 02:08:03AM +0530, Prathamesh Kulkarni wrote:
> Is this version okay ?
I have no further comments on this patch, so deferring to Joseph.
Thanks,
Marek
On Wed, Nov 12, 2014 at 1:28 AM, Marek Polacek wrote:
> On Tue, Nov 11, 2014 at 11:27:21PM +0530, Prathamesh Kulkarni wrote:
>> I tried the following:
>> struct A { struct B {}; int x; } /* { dg-warning "empty struct has
>> size 0 in C" } */
>>/* { dg-bo
On Tue, Nov 11, 2014 at 11:27:21PM +0530, Prathamesh Kulkarni wrote:
> I tried the following:
> struct A { struct B {}; int x; } /* { dg-warning "empty struct has
> size 0 in C" } */
>/* { dg-bogus "delcaration
> does not declare anything" } */
> but it f
On Tue, Nov 11, 2014 at 4:30 PM, Marek Polacek wrote:
> On Tue, Nov 11, 2014 at 04:45:46AM +0530, Prathamesh Kulkarni wrote:
>> Index: gcc/c/c-decl.c
>> ===
>> --- gcc/c/c-decl.c(revision 217287)
>> +++ gcc/c/c-decl.c(working
On Tue, 11 Nov 2014, Marek Polacek wrote:
> > >>+ if (fieldlist == NULL_TREE)
> > >>+{
> > >>+ warning_at (record_loc, OPT_Wc___compat,
> > >>+ "empty %s has size 0 in C, 1 in C++",
> > >>+ (struct_parse_info->code == RECORD_TYPE) ? "struct" :
> > >>"union");
> > >>+
On Tue, Nov 11, 2014 at 12:13:32PM +0100, Marc Glisse wrote:
> On Tue, 11 Nov 2014, Marek Polacek wrote:
>
> >>@@ -7506,12 +7509,19 @@
> >> /* Finish up struct info used by -Wc++-compat. */
> >>
> >> static void
> >>-warn_cxx_compat_finish_struct (tree fieldlist)
> >>+warn_cxx_compat_finish_struc
On Tue, 11 Nov 2014, Marek Polacek wrote:
@@ -7506,12 +7509,19 @@
/* 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
On Tue, Nov 11, 2014 at 04:45:46AM +0530, Prathamesh Kulkarni wrote:
> Index: gcc/c/c-decl.c
> ===
> --- gcc/c/c-decl.c(revision 217287)
> +++ gcc/c/c-decl.c(working copy)
> @@ -606,6 +606,8 @@
>/* If warn_cxx_compat, a lis
On Tue, Nov 11, 2014 at 3:35 AM, Marek Polacek wrote:
> 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_comp
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.
Hi,
For the following test-case:
struct A {};
clang -fsyntax-only -Wc++-compat gives following warning and gcc does not:
empty-struct.c:1:1: warning: empty struct has size 0 in C, size 1 in
C++ [-Wc++-compat]
struct F {};
This patch adds the above warning to the C FE.
Bootstrapped on x86_64-unkn
15 matches
Mail list logo