[llvm] r188524 - Fixing a warning about control reaching the end of a non-void function.

Aaron Ballman aaron at aaronballman.com
Fri Aug 16 10:42:31 PDT 2013


Clang does support __attribute__((noreturn)), so I don't see the harm
in that.  Would you like to make the change?

~Aaron

On Fri, Aug 16, 2013 at 1:35 PM, Matt Beaumont-Gay <matthewbg at google.com> wrote:
> On Thu, Aug 15, 2013 at 7:50 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Thu, Aug 15, 2013 at 10:46 PM, Matt Beaumont-Gay
>> <matthewbg at google.com> wrote:
>>> On Thu, Aug 15, 2013 at 6:43 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>>>> Author: aaronballman
>>>> Date: Thu Aug 15 20:43:31 2013
>>>> New Revision: 188524
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=188524&view=rev
>>>> Log:
>>>> Fixing a warning about control reaching the end of a non-void function.
>>>>
>>>> Modified:
>>>>     llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
>>>>
>>>> Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=188524&r1=188523&r2=188524&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original)
>>>> +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Thu Aug 15 20:43:31 2013
>>>> @@ -192,6 +192,7 @@ CGIOperandList::ParseOperandName(const s
>>>>
>>>>    // Otherwise, didn't find it!
>>>>    PrintFatalError(TheDef->getName() + ": unknown suboperand name in '" + Op + "'");
>>>> +  return std::make_pair(0U, 0U);
>>>
>>> PrintFatalError is marked noreturn; what compiler complained about this?
>>
>> clang-x86_64-darwin11-self-mingw32
>
> From Compiler.h:
>
> #ifdef __GNUC__
> #define LLVM_ATTRIBUTE_NORETURN __attribute__((noreturn))
> #elif defined(_MSC_VER)
> #define LLVM_ATTRIBUTE_NORETURN __declspec(noreturn)
> #else
> #define LLVM_ATTRIBUTE_NORETURN
> #endif
>
> From InitPreprocessor.cpp:
>
>   if (!LangOpts.MicrosoftMode) {
>     // Currently claim to be compatible with GCC 4.2.1-5621, but only if we're
>     // not compiling for MSVC compatibility
>     Builder.defineMacro("__GNUC_MINOR__", "2");
>     Builder.defineMacro("__GNUC_PATCHLEVEL__", "1");
>     Builder.defineMacro("__GNUC__", "4");
>     Builder.defineMacro("__GXX_ABI_VERSION", "1002");
>   }
>
> Maybe the first condition for LLVM_ATTRIBUTE_NORETURN should be "#if
> defined(__GNUC__) || defined(__clang__)"?



More information about the llvm-commits mailing list