diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2016-11-10 18:30:26 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2016-11-10 18:30:26 +0000 |
| commit | a5430bd5d6290d80227b08289cbb1becc81c3f0e (patch) | |
| tree | 448c9c1708a1d034dd6d9341f0be01f4e82eef58 | |
| parent | 6aa9416d0666e21640d37171688e8607e8f71307 (diff) | |
| download | bcm5719-llvm-a5430bd5d6290d80227b08289cbb1becc81c3f0e.tar.gz bcm5719-llvm-a5430bd5d6290d80227b08289cbb1becc81c3f0e.zip | |
Add -Wduplicate-protocol for existing diagnostic
Expose a warning flag for warn_duplicate_protocol_def. This allows control
over the severity of duplicate protocol definitions.
For example -Werror=duplicate-protocol or
#pragma clang diagnostic ignored "-Wduplicate-protocol".
Patch provided by Dave Lee!
Differential Revision: https://reviews.llvm.org/D26406
llvm-svn: 286487
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 4 | ||||
| -rw-r--r-- | clang/test/Misc/warning-flags.c | 3 | ||||
| -rw-r--r-- | clang/test/SemaObjC/check-dup-objc-decls-1.m | 6 |
3 files changed, 10 insertions, 3 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index db8bda5265d..2d47ea0727b 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -742,7 +742,9 @@ def err_recursive_superclass : Error< "trying to recursively use %0 as superclass of %1">; def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">; def warn_undef_interface : Warning<"cannot find interface declaration for %0">; -def warn_duplicate_protocol_def : Warning<"duplicate protocol definition of %0 is ignored">; +def warn_duplicate_protocol_def : Warning< + "duplicate protocol definition of %0 is ignored">, + InGroup<DiagGroup<"duplicate-protocol">>; def err_protocol_has_circular_dependency : Error< "protocol has circular dependency">; def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">; diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index 18222986e6a..c5294cff8ff 100644 --- a/clang/test/Misc/warning-flags.c +++ b/clang/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (83): +CHECK: Warnings without flags (82): CHECK-NEXT: ext_excess_initializers CHECK-NEXT: ext_excess_initializers_in_char_array_initializer CHECK-NEXT: ext_expected_semi_decl_list @@ -58,7 +58,6 @@ CHECK-NEXT: warn_drv_clang_unsupported CHECK-NEXT: warn_drv_objc_gc_unsupported CHECK-NEXT: warn_drv_pch_not_first_include CHECK-NEXT: warn_dup_category_def -CHECK-NEXT: warn_duplicate_protocol_def CHECK-NEXT: warn_enum_value_overflow CHECK-NEXT: warn_expected_qualified_after_typename CHECK-NEXT: warn_extraneous_char_constant diff --git a/clang/test/SemaObjC/check-dup-objc-decls-1.m b/clang/test/SemaObjC/check-dup-objc-decls-1.m index d6fa53a2f0b..7a2cd40424d 100644 --- a/clang/test/SemaObjC/check-dup-objc-decls-1.m +++ b/clang/test/SemaObjC/check-dup-objc-decls-1.m @@ -35,6 +35,12 @@ void Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symb @protocol PP<P> @end // expected-note {{previous definition is here}} @protocol PP<Q> @end // expected-warning {{duplicate protocol definition of 'PP'}} +@protocol DP<P> @end +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wduplicate-protocol" +@protocol DP<Q> @end +#pragma clang diagnostic pop + @interface A(Cat)<P> @end // expected-note {{previous definition is here}} @interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}} |

