[cfe-commits] [PATCH] Fix Empty Return
Matt Beaumont-Gay
matthewbg at google.com
Wed Jan 9 10:37:47 PST 2013
On Wed, Jan 9, 2013 at 10:32 AM, <dag at cray.com> wrote:
> Matt Beaumont-Gay <matthewbg at google.com> writes:
>
>> On Tue, Jan 8, 2013 at 1:18 PM, David Greene <dag at cray.com> wrote:
>>> Return a value to avoid an empty return warning.
>>> ---
>>> llvm/tools/clang/lib/AST/ASTContext.cpp | 1 +
>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/llvm/tools/clang/lib/AST/ASTContext.cpp b/llvm/tools/clang/lib/AST/ASTContext.cpp
>>> index dc398f3..e0e2478 100644
>>> --- a/llvm/tools/clang/lib/AST/ASTContext.cpp
>>> +++ b/llvm/tools/clang/lib/AST/ASTContext.cpp
>>> @@ -4870,6 +4870,7 @@ static char getObjCEncodingForPrimitiveKind(const ASTContext *C,
>>> #include "clang/AST/BuiltinTypes.def"
>>> llvm_unreachable("invalid builtin type for @encode");
>>> }
>>> + return 0;
>>
>> It looks like falling off the end of this switch should never happen,
>> so there should be an llvm_unreachable rather than a return here.
>
> I'm trying to silence a warning. Will llvm_unreachable do that?
As far as I know, all of the compilers that we care about understand
that if llvm_unreachable is reached, it doesn't return.
Out of curiosity, which version of GCC warns here?
-Matt
More information about the cfe-commits
mailing list