Silence class vs. struct warnings (opt_pass, ipa_opt_pass_d)

Richard Biener richard.guenther@gmail.com
Thu Dec 5 13:56:00 GMT 2013


On Thu, Dec 5, 2013 at 12:41 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> On Thu, 2013-12-05 at 12:21 +0100, Richard Biener wrote:
>> On Thu, Dec 5, 2013 at 11:12 AM, Oleg Endo <oleg.endo@t-online.de> wrote:
>> > On Thu, 2013-12-05 at 01:00 -0800, pinskia@gmail.com wrote:
>> >>
>> >>
>> >> No I don't think we want this at all. C++ is clear here. In fact we
>> >> don't turn on werror for stage 1 for this exact reason.  Rather it
>> >> might be better to check if that flag to turn off the warning and use
>> >> that.   Also this warning is a bad warning for standard c++ code; clang
>> >> is wrong to enable by default.
>> >
>> > Yes, warnings have to be disabled when compiling GCC, since clang
>> > complains about many more things.
>> > Anyway, these issues aside ...
>> >
>> >> No I don't think we want this at all
>> >
>> > ... why is that?  What's the purpose/benefit in C++ of repeatedly
>> > writing "struct X*" if X is already a known type?
>>
>> There is none, dropping those is fine (but please also look at the
>> no longer necessary typedefs
>
> There are a few typedefs:
>
> function.h:
> -struct ipa_opt_pass_d;
> -typedef struct ipa_opt_pass_d *ipa_opt_pass;
> +class ipa_opt_pass_d;
> +typedef ipa_opt_pass_d *ipa_opt_pass;
>
> cgraph.h:
> -typedef struct varpool_node *varpool_node_ptr;
> +class varpool_node;
> +typedef varpool_node *varpool_node_ptr;
>
> but they are used somewhere else.  I could replace the uses of those
> typedefs in a follow up patch, but for now I wanted to keep the changes
> minimal.

I didn't mean those cerating typedefs for the pointer type.

>>  and rename structs accordingly).
>
> Sorry, I don't get it.  Do you have an example in mind?

grep for 'typedef struct.*{' in headers.  The typedef name is usually
the desired one and is used without 'struct'.  So it's an orthogonal
issue.

Richard.

> Cheers,
> Oleg
>



More information about the Gcc-patches mailing list