From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 15 21:57:28 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CDE2106566C; Mon, 15 Mar 2010 21:57:28 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-relay2.uni-muenster.de (ZIVM-RELAY2.UNI-MUENSTER.DE [128.176.192.13]) by mx1.freebsd.org (Postfix) with ESMTP id 987A18FC35; Mon, 15 Mar 2010 21:57:26 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.49,645,1262559600"; d="scan'208";a="239198648" Received: from zivmaildisp1.uni-muenster.de (HELO ZIVMAILUSER04.UNI-MUENSTER.DE) ([128.176.188.85]) by zivm-relay2.uni-muenster.de with ESMTP; 15 Mar 2010 22:57:25 +0100 Received: by ZIVMAILUSER04.UNI-MUENSTER.DE (Postfix, from userid 149459) id 696CF1B07C1; Mon, 15 Mar 2010 22:57:25 +0100 (CET) Date: Mon, 15 Mar 2010 22:57:24 +0100 (CET) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: John Baldwin , Bruce Evans Message-ID: In-Reply-To: <201003151132.18617.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: [patch] small fix to stop gcc warning for lib/libstand/assert.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2010 21:57:28 -0000 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 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); > }