On 20 July 2016 at 23:09, Andrew Fish <[email protected]> wrote:
> It looks like clang has added a warning to detect infinite recursion and I'm 
> seeing the failure here:
>
> https://github.com/tianocore/edk2/blob/master/StdLib/LibC/StdLib/Environs.c#L123
> void
> _Exit(int status)
> {
>   gMD->ExitValue = status;          // Save our exit status.  Allows a status 
> of 0.
>   longjmp(gMD->MainExit, 0x55);     // Get out of here.  longjmp can't return 
> 0. Use 0x55 for a non-zero value.
>
> #ifdef __GNUC__
>   _Exit(status);        /* Keep GCC happy - never reached */
> #endif
> }
>
> This is the compiler warning.
>
> error: all paths through this function will call itself 
> [-Werror,-Winfinite-recursion]
>
> I fixed by replacing the infinite recursion with UNREACHABLE() but I'm not 
> sure what the rules are changing this chunk of code?
>

UNREACHABLE() resolves to an empty string on GCC44 [or it will as soon
as my patch that fixes that is merged, since 4.4 does not implement
__builtin_unreachable()]

The correct thing would be to set __attribute__((noreturn)) on the
longjmp() prototype [if __GNUC__], but it would be interesting to
understand what GCC was unhappy about to begin with.

-- 
Ard.
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to