]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg SysCall Lib: Fix warning with GCC in CrtWrapper.c
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 May 2011 00:56:33 +0000 (00:56 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 May 2011 00:56:33 +0000 (00:56 +0000)
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

CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c

index 79957cc89f780ce45a5fb11b4e15750e1f9b1989..7b3dda70e0941242e5b53af89d9bb878aaeca6df 100644 (file)
@@ -330,11 +330,42 @@ void closelog (void)
 \r
 }\r
 \r
+#ifdef __GNUC__\r
+\r
+typedef\r
+VOID\r
+(EFIAPI *NoReturnFuncPtr)(\r
+  VOID\r
+  ) __attribute__((__noreturn__));\r
+\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+NopFunction (\r
+  VOID\r
+  )\r
+{\r
+}\r
+\r
+\r
 void exit (int e)\r
 {\r
+  NoReturnFuncPtr NoReturnFunc;\r
+\r
+  NoReturnFunc = (NoReturnFuncPtr) NopFunction;\r
 \r
+  NoReturnFunc ();\r
 }\r
 \r
+#else\r
+\r
+void exit (int e)\r
+{\r
+}\r
+\r
+#endif\r
+\r
 int fclose (FILE *f)\r
 {\r
   return 0;\r