[lld] r241004 - Silence MSVC "not all control paths return a value" warning.
David Blaikie
dblaikie at gmail.com
Mon Jun 29 14:53:57 PDT 2015
On Mon, Jun 29, 2015 at 2:46 PM, Rui Ueyama <ruiu at google.com> wrote:
> Author: ruiu
> Date: Mon Jun 29 16:46:46 2015
> New Revision: 241004
>
> URL: http://llvm.org/viewvc/llvm-project?rev=241004&view=rev
> Log:
> Silence MSVC "not all control paths return a value" warning.
>
> Modified:
> lld/trunk/COFF/Symbols.cpp
>
> Modified: lld/trunk/COFF/Symbols.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.cpp?rev=241004&r1=241003&r2=241004&view=diff
>
> ==============================================================================
> --- lld/trunk/COFF/Symbols.cpp (original)
> +++ lld/trunk/COFF/Symbols.cpp Mon Jun 29 16:46:46 2015
> @@ -129,6 +129,8 @@ int SymbolBody::compare(SymbolBody *Othe
> case DefinedAbsoluteKind:
> // These all simply tie.
> return 0;
> + default:
> + llvm_unreachable("unknown symbol kind");
>
This may cause a -Wswitch-covered-default in Clang (if that's a switch over
an enum, and there's a case for every enumerator). The usual fix is to put
the unreachable after the switch rather than introducing a default.
Same potential issue with the next one too.
> }
> }
>
> @@ -161,6 +163,8 @@ uint64_t Defined::getRVA() {
> case LazyKind:
> case UndefinedKind:
> llvm_unreachable("Cannot get the address for an undefined symbol.");
> + default:
> + llvm_unreachable("unknown symbol kind");
> }
> }
>
> @@ -184,6 +188,8 @@ uint64_t Defined::getFileOff() {
> case LazyKind:
> case UndefinedKind:
> llvm_unreachable("Cannot get a file offset for an undefined symbol.");
> + default:
> + llvm_unreachable("unknown symbol kind");
> }
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150629/420f3dc0/attachment.html>
More information about the llvm-commits
mailing list