From: Akira Hatanaka Date: Mon, 3 Jul 2023 23:25:21 +0000 (-0700) Subject: Add a flag to disable "duplicate definition of category" warnings X-Git-Tag: upstream/17.0.6~3040 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cff99b76ac4f502ceba897a62db658667f1237f3;p=platform%2Fupstream%2Fllvm.git Add a flag to disable "duplicate definition of category" warnings Differential Revision: https://reviews.llvm.org/D154251 --- diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index 3ccdaad..ee994e7 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -305,7 +305,8 @@ def warn_slh_does_not_support_asm_goto : Warning< // Sema && Serialization def warn_dup_category_def : Warning< - "duplicate definition of category %1 on interface %0">; + "duplicate definition of category %1 on interface %0">, + InGroup>; // Targets diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index ac9a1f9..c587337 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 (66): +CHECK: Warnings without flags (65): CHECK-NEXT: ext_expected_semi_decl_list CHECK-NEXT: ext_explicit_specialization_storage_class @@ -46,7 +46,6 @@ CHECK-NEXT: warn_double_const_requires_fp64 CHECK-NEXT: warn_drv_assuming_mfloat_abi_is CHECK-NEXT: warn_drv_clang_unsupported CHECK-NEXT: warn_drv_pch_not_first_include -CHECK-NEXT: warn_dup_category_def CHECK-NEXT: warn_enum_value_overflow CHECK-NEXT: warn_expected_qualified_after_typename CHECK-NEXT: warn_fe_backend_unsupported diff --git a/clang/test/SemaObjC/check-dup-objc-decls-1.m b/clang/test/SemaObjC/check-dup-objc-decls-1.m index 8867afe..94b33d5 100644 --- a/clang/test/SemaObjC/check-dup-objc-decls-1.m +++ b/clang/test/SemaObjC/check-dup-objc-decls-1.m @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -Wno-objc-duplicate-category-definition -DIGNORE_DUP_CAT %s @interface Foo // expected-note {{previous definition is here}} @end @@ -41,8 +42,13 @@ void Gorf(void) // expected-error {{redefinition of 'Gorf' as different kind of @protocol DP @end #pragma clang diagnostic pop -@interface A(Cat)

@end // expected-note {{previous definition is here}} -@interface A(Cat) @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}} +@interface A(Cat)

@end +@interface A(Cat) @end + +#ifndef IGNORE_DUP_CAT +// expected-note@-4 {{previous definition is here}} +// expected-warning@-4 {{duplicate definition of category 'Cat' on interface 'A'}} +#endif // rdar 7626768 @class NSString;