[PATCH] D154251: Add a flag to disable "duplicate definition of category" warnings

2023-07-03 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcff99b76ac4f: Add a flag to disable duplicate 
definition of category warnings (authored by ahatanak).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154251/new/

https://reviews.llvm.org/D154251

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/test/Misc/warning-flags.c
  clang/test/SemaObjC/check-dup-objc-decls-1.m


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ 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 @@
 @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;
Index: clang/test/Misc/warning-flags.c
===
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 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_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
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // 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
 


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ 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 @@
 @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;
Index: clang/test/Misc/warning-flags.c
===
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 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_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
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // Sema && Serialization
 def warn_dup_category_def : Warning<
-  "duplicate definition of category %1 on interface %0">;
+  "duplicate definition of category %1 

[PATCH] D154251: Add a flag to disable "duplicate definition of category" warnings

2023-06-30 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai accepted this revision.
vsapsai added a comment.
This revision is now accepted and ready to land.

As long as there are no other failing tests, looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154251/new/

https://reviews.llvm.org/D154251

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D154251: Add a flag to disable "duplicate definition of category" warnings

2023-06-30 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 536479.
ahatanak added a comment.

Fix clang/test/Misc/warning-flags.c


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154251/new/

https://reviews.llvm.org/D154251

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/test/Misc/warning-flags.c
  clang/test/SemaObjC/check-dup-objc-decls-1.m


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ 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 @@
 @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;
Index: clang/test/Misc/warning-flags.c
===
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 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_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
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // 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
 


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ 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 @@
 @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;
Index: clang/test/Misc/warning-flags.c
===
--- clang/test/Misc/warning-flags.c
+++ clang/test/Misc/warning-flags.c
@@ -18,7 +18,7 @@
 
 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_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
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // 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
 
___
cfe-commits mailing list

[PATCH] D154251: Add a flag to disable "duplicate definition of category" warnings

2023-06-30 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision.
ahatanak added reviewers: Bigcheese, vsapsai.
ahatanak added a project: clang.
Herald added a project: All.
ahatanak requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154251

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/test/SemaObjC/check-dup-objc-decls-1.m


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ 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 @@
 @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;
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // 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
 


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ 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 @@
 @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;
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // 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
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits