This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH 1/3] Fix mismatched struct vs class tags.


On Thursday, November 24, 2016 05:02:07 PM Pedro Alves wrote:
> On 11/23/2016 11:00 PM, John Baldwin wrote:
> > On Wednesday, November 23, 2016 03:58:11 PM Simon Marchi wrote:
> >> On 2016-11-23 15:06, John Baldwin wrote:
> >>> The 'collection_list' and 'number_or_range_parser' types were converted
> >>> from structs to classes, but some code still used 'struct'.  Fix all
> >>> references to use 'class' which fixes -Wmismatched-tags warnings issued
> >>> by clang.
> >>
> >> Whjen using the type in a parameter or variable declaration, should we 
> >> simply drop the keyword?
> >>
> >> For example:
> >>
> >> -  struct collection_list *collect;
> >> +  collection_list *collect;
> >>
> >> That's the approach I took in my upcoming C++ patches, so I hope it's ok 
> >> :).  I have also dropped the "enum" keyword when possible.
> > 
> > Hmm.  I don't see anything about this in the GCC C++ language conventions,
> > so I will have to defer to others as far as what is the desired style here?
> > (And we should document whatever style is chosen)
> 
> I wouldn't say it's a matter of style to drop the "struct" or now.
> It's just that we'll have legacy code using the explicit "struct"
> style due to C heritage.  Dropping it is fine.  You can't drop it
> in forward declarations, though.
> 
> I think I'd prefer a patch to add "-Wno-mismatched-tags" to the warning set.
> This warning is useless for us.  Forward declaring with "struct"
> and defining with "class" is perfectly valid.  That's useful as "struct"
> vs "class" is just an implementation detail.  IIRC, that clang
> warning only exists because struct/class somehow makes a
> difference with Microsoft's compilers (maybe it mangles
> those differently, not sure), even though that's non conforming.  But, 
> we don't support building with that.

Ok.  At the moment we don't have a clang-specific warning set, but if we
add one we can add this to that.

-- 
John Baldwin


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