PATCH: eliminate warning from libnosys/_exit.c
Ben Elliston
bje@au1.ibm.com
Tue Dec 5 18:57:00 GMT 2006
GCC recognises a limited set of statements as non-returning. For
functions marked `noreturn' that do not meet this criteria, GCC emits
a warning. This patch eliminates this warning by ensuring that GCC
believes the function to not return. OK for mainline?
2006-12-05 Ben Elliston <bje@au.ibm.com>
* libnosys/_exit.c (_exit): Finish with an infinite loop to
eliminate a warning about this noreturn function returning.
Index: libnosys/_exit.c
===================================================================
RCS file: /cvs/src/src/libgloss/libnosys/_exit.c,v
retrieving revision 1.1
diff -u -r1.1 _exit.c
--- libnosys/_exit.c 25 Jun 2004 22:17:04 -0000 1.1
+++ libnosys/_exit.c 5 Dec 2006 06:37:35 -0000
@@ -12,4 +12,8 @@
/* Default stub just causes a divide by 0 exception. */
int x = rc / INT_MAX;
x = 4 / x;
+
+ /* Convince GCC that this function never returns. */
+ for (;;)
+ ;
}
More information about the Newlib
mailing list