From: John Baldwin <jhb@freebsd.org>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] Fix mismatched struct vs class tags.
Date: Thu, 24 Nov 2016 17:47:00 -0000 [thread overview]
Message-ID: <5282476.671uSJnE6M@ralph.baldwin.cx> (raw)
In-Reply-To: <f18831ff-42d4-d62b-46e9-2ba140cd8e6e@redhat.com>
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
next prev parent reply other threads:[~2016-11-24 17:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 20:07 [PATCH 0/3] Fix various C++ related clang warnings John Baldwin
2016-11-23 20:08 ` [PATCH 1/3] Fix mismatched struct vs class tags John Baldwin
2016-11-23 20:58 ` Simon Marchi
2016-11-23 23:23 ` John Baldwin
2016-11-24 17:02 ` Pedro Alves
2016-11-24 17:47 ` John Baldwin [this message]
2016-11-24 18:50 ` Pedro Alves
2016-11-24 19:15 ` John Baldwin
2016-11-30 11:39 ` Pedro Alves
2016-11-30 16:23 ` John Baldwin
2016-11-30 16:38 ` Pedro Alves
2016-11-30 16:52 ` Simon Marchi
2016-11-30 16:51 ` Simon Marchi
2016-11-30 17:08 ` Pedro Alves
2016-11-30 17:54 ` Simon Marchi
2016-11-30 17:59 ` Eli Zaretskii
2016-11-23 20:08 ` [PATCH 3/3] Do not use std::move when assigning an anonymous object to a unique_ptr John Baldwin
2016-11-23 21:19 ` Simon Marchi
2016-11-23 23:31 ` John Baldwin
2016-11-24 0:08 ` Simon Marchi
2016-11-24 16:52 ` Pedro Alves
2016-11-23 20:08 ` [PATCH 2/3] Add noexcept to custom non-throwing new operators John Baldwin
2016-11-24 17:03 ` Pedro Alves
2016-11-23 22:18 ` [PATCH 0/3] Fix various C++ related clang warnings Simon Marchi
2016-11-23 23:23 ` John Baldwin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5282476.671uSJnE6M@ralph.baldwin.cx \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox