[cfe-commits] r120376 - /cfe/trunk/lib/AST/Type.cpp

John McCall rjmccall at apple.com
Mon Nov 29 23:39:40 PST 2010

On Nov 29, 2010, at 11:21 PM, Frits van Bommel wrote:

> On Tue, Nov 30, 2010 at 2:43 AM, John McCall <rjmccall at apple.com> wrote:
>> Please use llvm_unreachable and a return 0 instead of adding a default case to a supposedly exhaustive switch.
> There should be no need to return 0 after llvm_unreachable. It expands
> to a call to an __attribute__((noreturn)) (Or __declspec(noreturn) on
> MSVC) function.

Technically that only accounts for two compilers (and those that maintain compatibility with them), albeit the two most likely ones.  It's still best not to introduce code that's unnecessarily unportable, particularly when there's zero cost on compilers that support noreturn.


More information about the cfe-commits mailing list