This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Silence class vs. struct warnings (opt_pass, ipa_opt_pass_d)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]