<p dir="ltr"><br>
On 12 Jun 2014 10:57, "Saleem Abdulrasool" <<a href="mailto:compnerd@compnerd.org">compnerd@compnerd.org</a>> wrote:<br>
><br>
> Author: compnerd<br>
> Date: Thu Jun 12 12:43:37 2014<br>
> New Revision: 210804<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=210804&view=rev">http://llvm.org/viewvc/llvm-project?rev=210804&view=rev</a><br>
> Log:<br>
> Basic: fix warnings from GCC<br>
><br>
> tools/clang/lib/Basic/DiagnosticIDs.cpp: In function ‘clang::DiagnosticIDs::Level toLevel(clang::diag::Severity)’:<br>
> tools/clang/lib/Basic/DiagnosticIDs.cpp:382:1: warning: control reaches end of non-void function [-Wreturn-type]<br>
><br>
> tools/clang/lib/Format/Format.cpp: In member function ‘virtual std::string clang::format::ParseErrorCategory::message(int) const’:<br>
> tools/clang/lib/Format/Format.cpp:282:1: warning: control reaches end of non-void function [-Wreturn-type]<br>
><br>
> Add a default cases that asserts that we handle the severity, parse error.<br>
><br>
> Modified:<br>
>     cfe/trunk/lib/Basic/DiagnosticIDs.cpp<br>
>     cfe/trunk/lib/Format/Format.cpp<br>
><br>
> Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=210804&r1=210803&r2=210804&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=210804&r1=210803&r2=210804&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)<br>
> +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Thu Jun 12 12:43:37 2014<br>
> @@ -368,6 +368,7 @@ StringRef DiagnosticIDs::getDescription(<br>
><br>
>  static DiagnosticIDs::Level toLevel(diag::Severity SV) {<br>
>    switch (SV) {<br>
> +  default: llvm_unreachable("unexpected severity");</p>
<p dir="ltr">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.</p>

<p dir="ltr">>    case diag::Severity::Ignored:<br>
>      return DiagnosticIDs::Ignored;<br>
>    case diag::Severity::Remark:<br>
><br>
> Modified: cfe/trunk/lib/Format/Format.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=210804&r1=210803&r2=210804&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=210804&r1=210803&r2=210804&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Format/Format.cpp (original)<br>
> +++ cfe/trunk/lib/Format/Format.cpp Thu Jun 12 12:43:37 2014<br>
> @@ -272,6 +272,7 @@ const char *ParseErrorCategory::name() c<br>
><br>
>  std::string ParseErrorCategory::message(int EV) const {<br>
>    switch (static_cast<ParseError>(EV)) {<br>
> +  default: llvm_unreachable("unexpected parse error");<br>
>    case ParseError::Success:<br>
>      return "Success";<br>
>    case ParseError::Error:<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</p>