r286487 - Add -Wduplicate-protocol for existing diagnostic
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 10 10:30:26 PST 2016
Author: arphaman
Date: Thu Nov 10 12:30:26 2016
New Revision: 286487
URL: http://llvm.org/viewvc/llvm-project?rev=286487&view=rev
Log:
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
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Misc/warning-flags.c
cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=286487&r1=286486&r2=286487&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 10 12:30:26 2016
@@ -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">;
Modified: cfe/trunk/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=286487&r1=286486&r2=286487&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Thu Nov 10 12:30:26 2016
@@ -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
Modified: cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m?rev=286487&r1=286486&r2=286487&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m (original)
+++ cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m Thu Nov 10 12:30:26 2016
@@ -35,6 +35,12 @@ void Gorf() // expected-error {{redefini
@protocol PP<P> @end // expected-note {{previous definition is here}}
@protocol PP<Q> @end // expected-warning {{duplicate protocol definition of 'PP'}}
+ at protocol DP<P> @end
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wduplicate-protocol"
+ at 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'}}
More information about the cfe-commits
mailing list