]> granicus.if.org Git - clang/commitdiff
Reword/rename -Wswitch-unreachable-default.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 24 Jan 2012 05:34:08 +0000 (05:34 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 24 Jan 2012 05:34:08 +0000 (05:34 +0000)
Rewording the diagnostic to be more precise/correct: "default label in switch
which covers all enumeration values" and changed the switch to
-Wcovered-switch-default

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

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/Sema/switch.c
test/Sema/warn-unreachable.c
test/SemaCXX/gnu-case-ranges.cpp
test/SemaCXX/return-noreturn.cpp

index 82167951ce01f58c9a3c7dea9c7fa92b226e2864..b609b40fe3d2f0e55a7f47744a7c246565ead003 100644 (file)
@@ -184,8 +184,8 @@ def : DiagGroup<"strict-prototypes">;
 def StrictSelector : DiagGroup<"strict-selector-match">;
 def MethodDuplicate : DiagGroup<"duplicate-method-match">;
 def SwitchEnum     : DiagGroup<"switch-enum">;
-def SwitchRedundantDefault : DiagGroup<"switch-redundant-default">;
-def Switch         : DiagGroup<"switch", [SwitchRedundantDefault]>;
+def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
+def Switch         : DiagGroup<"switch", [CoveredSwitchDefault]>;
 def Trigraphs      : DiagGroup<"trigraphs">;
 
 def : DiagGroup<"type-limits">;
index 853f7666b3279ae0094984da7d5da0071bdf6bee..6c2c4ef5589507e9864861b8f242ab5954072938 100644 (file)
@@ -4987,8 +4987,8 @@ def warn_missing_cases : Warning<
   InGroup<Switch>;
 
 def warn_unreachable_default : Warning<
-  "default is unreachable as all enumeration values are accounted for">,
-  InGroup<SwitchRedundantDefault>;
+  "default label in switch which covers all enumeration values">,
+  InGroup<CoveredSwitchDefault>;
 def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
   InGroup<Switch>; 
 def err_typecheck_statement_requires_scalar : Error<
index 012c5ecee7d5f96560b556a9f641a85b910c5e99..2dc965f4a0bc91e1802eb02b2351472abac9ff6b 100644 (file)
@@ -295,6 +295,6 @@ int test18() {
   case A: return 0;
   case B: return 1;
   case 7: return 1; // expected-warning {{case value not in enumerated type}}
-  default: return 2; // expected-warning {{default is unreachable as all enumeration values are accounted for}}
+  default: return 2; // expected-warning {{default label in switch which covers all enumeration values}}
   }
 }
index 49275a5a9b9ca59e34ce0d3c31a697128bcfd21d..636513f62c70ccfc769bbf10a625d006e2acb486 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code -Wno-unused-value -Wno-switch-redundant-default
+// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code -Wno-unused-value -Wno-covered-switch-default
 
 int halt() __attribute__((noreturn));
 int live();
index cda8b734cfed558b129a159f548c8d1d14589dcc..b082e3a6c1c0649ecf9cd486d6b662be4411ef6c 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -Wno-switch-redundant-default %s
+// RUN: %clang_cc1 -verify -Wno-covered-switch-default %s
 
 enum E {
     one,
index ce819337384ed5afb47db290150d607bb5099758..617de0089585d3d35e6b6bbf4e25d84809b349eb 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-switch-redundant-default
-// RUN: %clang_cc1 %s -fsyntax-only -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-switch-redundant-default
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
+// RUN: %clang_cc1 %s -fsyntax-only -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
 
 // A destructor may be marked noreturn and should still influence the CFG.
 void pr6884_abort() __attribute__((noreturn));