[patch] small fix to stop gcc warning for lib/libstand/assert.c
John Baldwin
jhb at freebsd.org
Mon Mar 15 16:05:32 UTC 2010
On Saturday 13 March 2010 08:52:19 am Alexander Best wrote:
> hello,
>
> this patch fixes the following gcc warning:
>
> /usr/src/lib/libstand/assert.c:43: warning: implicit declaration of
> function 'exit'
>
> by using abort() instead of exit() (which is illegal anyway). looking at
> lib/libc/gen/assert.c abort() seems save to use instead of exit().
There is no abort() in libstand or any of the boot code. If you built a full
world with this change you should have gotten a link error for /boot/loader.
exit() is required by the boot code however (see sys/boot/common/panic.c).
The use of exit() instead of abort() here is on purpose. This is the fix I
would use. I would not add 'exit()' to <stand.h> as it is not an interface
that libstand provides, but one that it requires from the environment it is
linked with.
Index: assert.c
===================================================================
--- assert.c (revision 204953)
+++ assert.c (working copy)
@@ -31,6 +31,8 @@
#include "stand.h"
+void exit(int);
+
void
__assert(const char *func, const char *file, int line, const char
*expression)
{
@@ -40,5 +42,5 @@
else
printf("Assertion failed: (%s), function %s, file %s, line "
"%d.\n", expression, func, file, line);
- exit();
+ exit(1);
}
--
John Baldwin
More information about the freebsd-hackers
mailing list