[cfe-commits] [PATCH] Fix Empty Return

dag at cray.com dag at cray.com
Wed Jan 9 10:33:49 PST 2013


David Blaikie <dblaikie at gmail.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;
>
> Please use llvm_unreachable in these contexts (essentially any case of
> a missing return that GCC catches and Clang doesn't is probably
> deserving of llvm_unreachable, not a return).

Will that silence the gcc warning.

> (your patches still aren't coming through as attachments, btw (I don't
> mind both attachment and inline, especially for these short patches,
> but there should always at least be an attachment))

Sorry.  I sent them all before I started getting replies.  I've set up
my config to automatically attach in the future.

> Committed with this change in r171982.

Thanks!  I also have commit access so I can do that step in the future
if it's easier.

                              -David



More information about the cfe-commits mailing list