Skip to content

Commit cb96a4a

Browse files
authored
Merge pull request #7162 from apple/disable-duplicate-definition
Add a flag to disable "duplicate definition of category" warnings
2 parents f09783f + 9943b1a commit cb96a4a

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def warn_slh_does_not_support_asm_goto : Warning<
293293

294294
// Sema && Serialization
295295
def warn_dup_category_def : Warning<
296-
"duplicate definition of category %1 on interface %0">;
296+
"duplicate definition of category %1 on interface %0">,
297+
InGroup<DiagGroup<"objc-duplicate-category-definition">>;
297298

298299
// Targets
299300

clang/test/Misc/warning-flags.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This test serves two purposes:
1818

1919
The list of warnings below should NEVER grow. It should gradually shrink to 0.
2020

21-
CHECK: Warnings without flags (66):
21+
CHECK: Warnings without flags (65):
2222

2323
CHECK-NEXT: ext_expected_semi_decl_list
2424
CHECK-NEXT: ext_explicit_specialization_storage_class
@@ -46,7 +46,6 @@ CHECK-NEXT: warn_double_const_requires_fp64
4646
CHECK-NEXT: warn_drv_assuming_mfloat_abi_is
4747
CHECK-NEXT: warn_drv_clang_unsupported
4848
CHECK-NEXT: warn_drv_pch_not_first_include
49-
CHECK-NEXT: warn_dup_category_def
5049
CHECK-NEXT: warn_enum_value_overflow
5150
CHECK-NEXT: warn_expected_qualified_after_typename
5251
CHECK-NEXT: warn_fe_backend_unsupported

clang/test/SemaObjC/check-dup-objc-decls-1.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2+
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -Wno-objc-duplicate-category-definition -DIGNORE_DUP_CAT %s
23

34
@interface Foo // expected-note {{previous definition is here}}
45
@end
@@ -41,8 +42,13 @@ @protocol DP<P> @end
4142
@protocol DP<Q> @end
4243
#pragma clang diagnostic pop
4344

44-
@interface A(Cat)<P> @end // expected-note {{previous definition is here}}
45-
@interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}}
45+
@interface A(Cat)<P> @end
46+
@interface A(Cat)<Q> @end
47+
48+
#ifndef IGNORE_DUP_CAT
49+
// expected-note@-4 {{previous definition is here}}
50+
// expected-warning@-4 {{duplicate definition of category 'Cat' on interface 'A'}}
51+
#endif
4652

4753
// rdar 7626768
4854
@class NSString;

0 commit comments

Comments
 (0)