From: Saleem Abdulrasool Date: Thu, 12 Jun 2014 19:33:26 +0000 (+0000) Subject: Permit -Wswitch coverage for enumerations. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbfbaf6a931918f7a648758b0a709d52b30ed71b;p=platform%2Fupstream%2Fllvm.git Permit -Wswitch coverage for enumerations. Thanks to David Blakie and Richard Smith for pointing out that we can retain the -Wswitch coverage while avoiding the warning from GCC by pushing the unreachable outside of the switch! llvm-svn: 210812 --- diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index 0b3627e..6bc230a 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -368,7 +368,6 @@ StringRef DiagnosticIDs::getDescription(unsigned DiagID) const { static DiagnosticIDs::Level toLevel(diag::Severity SV) { switch (SV) { - default: llvm_unreachable("unexpected severity"); case diag::Severity::Ignored: return DiagnosticIDs::Ignored; case diag::Severity::Remark: @@ -380,6 +379,7 @@ static DiagnosticIDs::Level toLevel(diag::Severity SV) { case diag::Severity::Fatal: return DiagnosticIDs::Fatal; } + llvm_unreachable("unexpected severity"); } /// getDiagnosticLevel - Based on the way the client configured the diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index e1ec251..913c622 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -272,7 +272,6 @@ const char *ParseErrorCategory::name() const LLVM_NOEXCEPT { std::string ParseErrorCategory::message(int EV) const { switch (static_cast(EV)) { - default: llvm_unreachable("unexpected parse error"); case ParseError::Success: return "Success"; case ParseError::Error: @@ -280,6 +279,7 @@ std::string ParseErrorCategory::message(int EV) const { case ParseError::Unsuitable: return "Unsuitable"; } + llvm_unreachable("unexpected parse error"); } FormatStyle getLLVMStyle() {