]> granicus.if.org Git - clang/commitdiff
Basic: Add -Wswitch-bool to control warn_bool_switch_condition
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 11 Mar 2014 00:26:28 +0000 (00:26 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 11 Mar 2014 00:26:28 +0000 (00:26 +0000)
This warning was missing a flag, add one.

test/Misc/warning-flags.c has one fewer entry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203522 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/Misc/warning-flags.c

index ca12e4b73feb4e9bb3b4a1c23626493b173b13b8..97f0b3ed619ceebe028af7804622584e5db0083b 100644 (file)
@@ -326,6 +326,7 @@ def : DiagGroup<"strict-prototypes">;
 def StrictSelector : DiagGroup<"strict-selector-match">;
 def MethodDuplicate : DiagGroup<"duplicate-method-match">;
 def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
+def SwitchBool     : DiagGroup<"switch-bool">;
 def SwitchEnum     : DiagGroup<"switch-enum">;
 def Switch         : DiagGroup<"switch">;
 def ImplicitFallthroughPerFunction :
@@ -541,7 +542,7 @@ def Consumed       : DiagGroup<"consumed">;
 // Note that putting warnings in -Wall will not disable them by default. If a
 // warning should be active _only_ when -Wall is passed in, mark it as
 // DefaultIgnore in addition to putting it here.
-def : DiagGroup<"all", [Most, Parentheses, Switch]>;
+def : DiagGroup<"all", [Most, Parentheses, Switch, SwitchBool]>;
 
 // Warnings enabled by -pedantic.  This is magically filled in by TableGen.
 def Pedantic : DiagGroup<"pedantic">;
index e2f7e3c1b9a824d19f282e3782625b50da64480f..7f2abe645245c8a68da0e0c5d595f824ee20cf3e 100644 (file)
@@ -6425,7 +6425,7 @@ def err_default_not_in_switch : Error<
   "'default' statement not in switch statement">;
 def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
 def warn_bool_switch_condition : Warning<
-  "switch condition has boolean value">;
+  "switch condition has boolean value">, InGroup<SwitchBool>;
 def warn_case_value_overflow : Warning<
   "overflow converting case value to switch condition type (%0 to %1)">,
   InGroup<Switch>;
index 7044a7828b611a2adf294948a3b38cd5452c1aff..d1653b4c053dab6cb4e57c282e0258ab4bb1acd7 100644 (file)
@@ -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 (109):
+CHECK: Warnings without flags (108):
 CHECK-NEXT:   ext_delete_void_ptr_operand
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
@@ -49,7 +49,6 @@ CHECK-NEXT:   warn_accessor_property_type_mismatch
 CHECK-NEXT:   warn_anon_bitfield_width_exceeds_type_size
 CHECK-NEXT:   warn_asm_label_on_auto_decl
 CHECK-NEXT:   warn_bitfield_width_exceeds_type_size
-CHECK-NEXT:   warn_bool_switch_condition
 CHECK-NEXT:   warn_braces_around_scalar_init
 CHECK-NEXT:   warn_c_kext
 CHECK-NEXT:   warn_call_to_pure_virtual_member_function_from_ctor_dtor