diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-12-04 02:45:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-12-04 02:45:28 +0000 |
commit | 1a0f6a2ab41ee8b0b5a5e957208dfe5cd46a9a92 (patch) | |
tree | 32aba09ef3a82d6ea70e93081f83672f73f801db /include/clang/Basic/DiagnosticSemaKinds.td | |
parent | 2e8d7182c2c18e961dfb34dcb84c70baf98e2549 (diff) |
Fix -Wmismatched-tags to not warn on redeclarations of structs in system
headers.
Previously, we would only check whether the new declaration is in a
system header, but that requires the user to be able to correctly guess
whether a declaration in a system header is declared as a struct or a
class when specializing standard library traits templates.
We now entirely ignore declarations for which the warning was disabled
when determining whether to warn on a tag mismatch.
Also extend the diagnostic message to clarify that
a) code containing such a tag mismatch is in fact valid and correct,
and
b) the (non-coding-style) reason to emit such a warning is that the
Microsoft C++ ABI is broken and includes the tag kind in decorated
names,
as it seems a lot of users are confused by our diagnostic here (either
not understanding why we produce it, or believing that it represents an
actual language rule).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/DiagnosticSemaKinds.td')
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index c725da9752..1a6d0d035b 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -4806,16 +4806,18 @@ def err_nested_redefinition : Error<"nested redefinition of %0">; def err_use_with_wrong_tag : Error< "use of %0 with tag type that does not match previous declaration">; def warn_struct_class_tag_mismatch : Warning< - "%select{struct|interface|class}0%select{| template}1 %2 was previously " - "declared as a %select{struct|interface|class}3%select{| template}1">, - InGroup<MismatchedTags>, DefaultIgnore; + "%select{struct|interface|class}0%select{| template}1 %2 was previously " + "declared as a %select{struct|interface|class}3%select{| template}1; " + "this is valid, but may result in linker errors under the Microsoft C++ ABI">, + InGroup<MismatchedTags>, DefaultIgnore; def warn_struct_class_previous_tag_mismatch : Warning< - "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 " - "here but previously declared as " - "%select{a struct|an interface|a class}3%select{| template}1">, - InGroup<MismatchedTags>, DefaultIgnore; + "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 " + "here but previously declared as " + "%select{a struct|an interface|a class}3%select{| template}1; " + "this is valid, but may result in linker errors under the Microsoft C++ ABI">, + InGroup<MismatchedTags>, DefaultIgnore; def note_struct_class_suggestion : Note< - "did you mean %select{struct|interface|class}0 here?">; + "did you mean %select{struct|interface|class}0 here?">; def ext_forward_ref_enum : Extension< "ISO C forbids forward references to 'enum' types">; def err_forward_ref_enum : Error< |