Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 2010 22:57:24 +0100 (CET)
From:      Alexander Best <alexbestms@wwu.de>
To:        John Baldwin <jhb@freebsd.org>, Bruce Evans <brde@optusnet.com.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [patch] small fix to stop gcc warning for lib/libstand/assert.c
Message-ID:  <permail-2010031521572480e26a0b00004806-a_best01@message-id.uni-muenster.de>
In-Reply-To: <201003151132.18617.jhb@freebsd.org>

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?permail-2010031521572480e26a0b00004806-a_best01>