Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2010 11:32:18 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Alexander Best <alexbestms@wwu.de>
Subject:   Re: [patch] small fix to stop gcc warning for lib/libstand/assert.c
Message-ID:  <201003151132.18617.jhb@freebsd.org>
In-Reply-To: <permail-20100313135219f7e55a9d00006340-a_best01@message-id.uni-muenster.de>
References:  <permail-20100313135219f7e55a9d00006340-a_best01@message-id.uni-muenster.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003151132.18617.jhb>