[lld] r179590 - Moved llvm_unreachable out of switch blocks to avoid the "control reaches end of non-void function" warning.
Nick Kledzik
kledzik at apple.com
Tue Apr 16 09:34:30 PDT 2013
What compiler is issuing the warning? llvm_unreachable() is designed to look like a no-return function, so that compilers will not issue that warning.
-Nick
On Apr 16, 2013, at 4:52 AM, Andy Gibbs wrote:
> Author: andyg
> Date: Tue Apr 16 06:52:34 2013
> New Revision: 179590
>
> URL: http://llvm.org/viewvc/llvm-project?rev=179590&view=rev
> Log:
> Moved llvm_unreachable out of switch blocks to avoid the "control reaches end of non-void function" warning.
>
> Modified:
> lld/trunk/lib/Driver/UniversalDriver.cpp
> lld/trunk/lib/ReaderWriter/MachO/MachOTargetInfo.cpp
>
> Modified: lld/trunk/lib/Driver/UniversalDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/UniversalDriver.cpp?rev=179590&r1=179589&r2=179590&view=diff
> ==============================================================================
> --- lld/trunk/lib/Driver/UniversalDriver.cpp (original)
> +++ lld/trunk/lib/Driver/UniversalDriver.cpp Tue Apr 16 06:52:34 2013
> @@ -125,9 +125,10 @@ bool UniversalDriver::link(int argc, con
> case Flavor::core:
> return CoreDriver::link(args.size(), args.data(), diagnostics);
> case Flavor::win_link:
> - llvm_unreachable("Unsupported flavor");
> + break;
> case Flavor::invalid:
> return true;
> }
> + llvm_unreachable("Unsupported flavor");
> }
> } // end namespace lld
>
> Modified: lld/trunk/lib/ReaderWriter/MachO/MachOTargetInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOTargetInfo.cpp?rev=179590&r1=179589&r2=179590&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/MachO/MachOTargetInfo.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/MachO/MachOTargetInfo.cpp Tue Apr 16 06:52:34 2013
> @@ -111,8 +111,9 @@ uint32_t MachOTargetInfo::getCPUType() c
> case MachOTargetInfo::arch_armv7s:
> return mach_o::CPU_TYPE_ARM;
> case MachOTargetInfo::arch_unknown:
> - llvm_unreachable("Unknown arch type");
> + break;
> }
> + llvm_unreachable("Unknown arch type");
> }
>
> uint32_t MachOTargetInfo::getCPUSubType() const {
> @@ -128,8 +129,9 @@ uint32_t MachOTargetInfo::getCPUSubType(
> case MachOTargetInfo::arch_armv7s:
> return mach_o::CPU_SUBTYPE_ARM_V7S;
> case MachOTargetInfo::arch_unknown:
> - llvm_unreachable("Unknown arch type");
> + break;
> }
> + llvm_unreachable("Unknown arch type");
> }
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list