[patch] small fix to stop gcc warning for lib/libstand/assert.c
Alexander Best
alexbestms at wwu.de
Mon Mar 15 21:57:28 UTC 2010
John Baldwin schrieb am 2010-03-15:
> 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.
indeed your patch seems a lot more reasonable than the one i proposed. i think
this could go directly into head. i'll run buildworld overnight to see if all
goes well.
btw: i've checked and exit() is used in assert.c on all major *bsd version
(netbsd, openbsd, dragonfly).
cheers.
alex
ps: i've opened a pr under misc/144749. you might want to submit your patch as
followup.
> 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);
> }
More information about the freebsd-hackers
mailing list