This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] PR43651: add warning for duplicate qualifier
- From: Martin Sebor <msebor at gmail dot com>
- To: Mikhail Maltsev <maltsevm at gmail dot com>, gcc-patches <gcc-patches at gnu dot org>, Joseph Myers <joseph at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>, David Malcolm <dmalcolm at redhat dot com>
- Date: Sun, 10 Apr 2016 14:12:12 -0600
- Subject: Re: [C PATCH] PR43651: add warning for duplicate qualifier
- Authentication-results: sourceware.org; auth=none
- References: <570241F0 dot 3070705 at gmail dot com> <5707F068 dot 3050601 at gmail dot com> <5708F58A dot 7090701 at gmail dot com>
On 04/09/2016 06:28 AM, Mikhail Maltsev wrote:
On 04/08/2016 08:54 PM, Martin Sebor wrote:
The name for new option "-Wduplicate-decl-specifier" and wording was
chosen to match the same option in Clang.
My version of Clang also warns in C++ mode but if I'm reading
the patch right, GCC would warn only C mode. I would find it
surprising if GCC provided the same option as Clang but didn't
make it available in the same languages. Do you have some
reason for leaving it out that I'm not thinking of?
It is an error in C++ mode. Do we want to change this behavior?
You're right, G++ does give an error. I missed it in my testing.
Unlike C11, C++ requires a diagnostic for duplicated cv-qualifiers
so by issuing a warning Clang is more permissive. My personal
inclination would be to treat this consistently between C and C++
but whether or not to change it is something Jason would need to
weigh in on.
Also, in C11 mode, Clang issues the warning for duplicated
_Atomic qualifiers but it doesn't look like GCC would with
the patch. Here again, unless there's some reason not to,
I would expect GCC to issue the same warning as Clang for
the same code.
Fixed.
Great, thank you.
Martin