This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Silence class vs. struct warnings (opt_pass, ipa_opt_pass_d)
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 05 Dec 2013 12:41:54 +0100
- Subject: Re: Silence class vs. struct warnings (opt_pass, ipa_opt_pass_d)
- Authentication-results: sourceware.org; auth=none
- References: <1386233288 dot 14008 dot 9 dot camel at yam-132-YW-E178-FTW> <3B985852-FCA6-44C3-9FEC-D18E3CEFAB68 at gmail dot com> <1386238371 dot 14008 dot 30 dot camel at yam-132-YW-E178-FTW> <CAFiYyc2ewWrBMR1OysL9zJrLpQbWLp+v15QeQxuhXQtmeEQXTg at mail dot gmail dot com>
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.
> and rename structs accordingly).
Sorry, I don't get it. Do you have an example in mind?
Cheers,
Oleg