On 12 Jun 2014 10:57, "Saleem Abdulrasool" <[email protected]> wrote: > > 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");
The 'unreachable' call for a covered switch (in which every case returns) should go after the switch, not in a default: case, so we get a diagnostic if a new enumerator is added but isn't handled here. > 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: > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
