r210804 - Basic: fix warnings from GCC

Saleem Abdulrasool compnerd at compnerd.org
Thu Jun 12 10:43:37 PDT 2014


Author: compnerd
Date: Thu Jun 12 12:43:37 2014
New Revision: 210804

URL: http://llvm.org/viewvc/llvm-project?rev=210804&view=rev
Log:
Basic: fix warnings from GCC

tools/clang/lib/Basic/DiagnosticIDs.cpp: In function ‘clang::DiagnosticIDs::Level toLevel(clang::diag::Severity)’:
tools/clang/lib/Basic/DiagnosticIDs.cpp:382:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/clang/lib/Format/Format.cpp: In member function ‘virtual std::string clang::format::ParseErrorCategory::message(int) const’:
tools/clang/lib/Format/Format.cpp:282:1: warning: control reaches end of non-void function [-Wreturn-type]

Add a default cases that asserts that we handle the severity, parse error.

Modified:
    cfe/trunk/lib/Basic/DiagnosticIDs.cpp
    cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=210804&r1=210803&r2=210804&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Thu Jun 12 12:43:37 2014
@@ -368,6 +368,7 @@ StringRef DiagnosticIDs::getDescription(
 
 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:

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=210804&r1=210803&r2=210804&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Jun 12 12:43:37 2014
@@ -272,6 +272,7 @@ const char *ParseErrorCategory::name() c
 
 std::string ParseErrorCategory::message(int EV) const {
   switch (static_cast<ParseError>(EV)) {
+  default: llvm_unreachable("unexpected parse error");
   case ParseError::Success:
     return "Success";
   case ParseError::Error:





More information about the cfe-commits mailing list