From: jljusten Date: Wed, 4 May 2011 00:56:33 +0000 (+0000) Subject: CryptoPkg SysCall Lib: Fix warning with GCC in CrtWrapper.c X-Git-Tag: edk2-stable201903~14894 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=f114914b39c03f6af3173ba3aae09395ed65faaa;ds=sidebyside CryptoPkg SysCall Lib: Fix warning with GCC in CrtWrapper.c Exit is declared to be 'noreturn' function, but GCC sees that the empty function will return. Therefore, GCC flags a warning. To work-around this, we use a function pointer, along with a cast to force the code to think that a 'noreturn' function is being called. Signed-off-by: jljusten Reviewed-by: qlong git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11609 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c index 79957cc89f..7b3dda70e0 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c @@ -330,11 +330,42 @@ void closelog (void) } +#ifdef __GNUC__ + +typedef +VOID +(EFIAPI *NoReturnFuncPtr)( + VOID + ) __attribute__((__noreturn__)); + + +STATIC +VOID +EFIAPI +NopFunction ( + VOID + ) +{ +} + + void exit (int e) { + NoReturnFuncPtr NoReturnFunc; + + NoReturnFunc = (NoReturnFuncPtr) NopFunction; + NoReturnFunc (); } +#else + +void exit (int e) +{ +} + +#endif + int fclose (FILE *f) { return 0;