From 57d782aed7ee50e4b2be173b84a284a317251bc5 Mon Sep 17 00:00:00 2001 From: David Bolvansky Date: Tue, 1 Oct 2019 15:44:38 +0000 Subject: [PATCH] [Diagnostics] Move warning into the subgroup (-Wenum-compare-conditional) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373345 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticGroups.td | 3 ++- include/clang/Basic/DiagnosticSemaKinds.td | 2 +- test/Sema/warn-conditional-emum-types-mismatch.c | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 4c7ea3d4ea..16de6a2d07 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -563,8 +563,9 @@ def CoveredSwitchDefault : DiagGroup<"covered-switch-default">; def SwitchBool : DiagGroup<"switch-bool">; def SwitchEnum : DiagGroup<"switch-enum">; def Switch : DiagGroup<"switch">; +def EnumCompareConditional : DiagGroup<"enum-compare-conditional">; def EnumCompareSwitch : DiagGroup<"enum-compare-switch">; -def EnumCompare : DiagGroup<"enum-compare", [EnumCompareSwitch]>; +def EnumCompare : DiagGroup<"enum-compare", [EnumCompareConditional, EnumCompareSwitch]>; def ImplicitFallthroughPerFunction : DiagGroup<"implicit-fallthrough-per-function">; def ImplicitFallthrough : DiagGroup<"implicit-fallthrough", diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index d1b9aea029..dffaf5592f 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -6172,7 +6172,7 @@ def warn_comparison_of_mixed_enum_types : Warning< def warn_conditional_mixed_enum_types : Warning< "enumeration type mismatch in conditional expression" "%diff{ ($ and $)|}0,1">, - InGroup; + InGroup; def warn_comparison_of_mixed_enum_types_switch : Warning< "comparison of two values with different enumeration types in switch statement" "%diff{ ($ and $)|}0,1">, diff --git a/test/Sema/warn-conditional-emum-types-mismatch.c b/test/Sema/warn-conditional-emum-types-mismatch.c index 4325bb0c41..ec7f1b37ff 100644 --- a/test/Sema/warn-conditional-emum-types-mismatch.c +++ b/test/Sema/warn-conditional-emum-types-mismatch.c @@ -1,5 +1,7 @@ +// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wenum-compare-conditional %s // RUN: %clang_cc1 -x c -fsyntax-only -verify -Wenum-compare %s // RUN: %clang_cc1 -x c -fsyntax-only -verify %s +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wenum-compare-conditional %s // RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wenum-compare %s // RUN: %clang_cc1 -x c++ -fsyntax-only -verify %s -- 2.40.0