Re: [PATCH 0/5] Remove a few hurdles of compiling with clang

Pedro Alves
2017-06-12T16:45:50Z

On 06/12/2017 05:37 PM, Andrew Pinski wrote:
> On Mon, Jun 12, 2017 at 9:35 AM, Pedro Alves <palves@redhat.com> wrote:
>> On 06/12/2017 05:23 PM, Andrew Pinski wrote:
>>> On Mon, Jun 12, 2017 at 8:54 AM, Simon Marchi <simon.marchi@polymtl.ca> wrote:
>>
>>>> - gdb: Add -Wno-mismatched-tags: We already have a system that tests which
>>>> warning flags are supported by the current compiler, so this flag will not
>>>> be included in the builds with GCC. So it's neutral for GCC, and improves
>>>> the situation for Clang with almost no effort.
>>>
>>> This warning is a bug in clang and really should not be warned about
>>> in either -Wall or -Wextra. I have been complaining about this since
>>> clang added this option.
>>
>> IIRC, the reason this warning exists is because Microsoft's compilers
>> mangle "struct" and "class" differently, so for projects that
>> want to be portable to that compiler, it's a helpful warning.
>> (Whether that should ever be part of -Wall is a separate matter...)
>>
>> I don't think we'd want to bend backwards to support MSVC
>> though. It's so non-conforming that it's scary. Disabling
>> that warning is the right thing to do, IMO.
>
> Why not have clang disable this warning by default instead?

You'll have to ask clang developers.

> I am sorry but people who write C++ should understand that they are the same.

We know the standard says so, and I know that that's true on the ABIs
we care about. But in practice, what compilers (a project
cares about) matters more than what the standard says. After all,
if the standard says the language does X, but no gcc behaves that
way, we wouldn't ever want code to depend on X, would we?

Thanks,
Pedro Alves