From owner-freebsd-current Fri Jul 7 6:49:32 2000 Delivered-To: freebsd-current@freebsd.org Received: from dr-evil.shagadelic.org (yeah-baby.shagadelic.org [208.176.2.162]) by hub.freebsd.org (Postfix) with ESMTP id E202437B9A4 for ; Fri, 7 Jul 2000 06:49:24 -0700 (PDT) (envelope-from thorpej@zembu.com) Received: by dr-evil.shagadelic.org (Postfix, from userid 7518) id 06500D203; Fri, 7 Jul 2000 06:46:41 -0700 (PDT) Date: Fri, 7 Jul 2000 06:46:40 -0700 From: Jason R Thorpe To: itojun@iijlab.net Cc: freebsd-current@FreeBSD.org Subject: Re: _DIAGASSERT() Message-ID: <20000707064640.A391@dr-evil.shagadelic.org> Reply-To: thorpej@zembu.com References: <9787.962964470@coconut.itojun.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <9787.962964470@coconut.itojun.org>; from itojun@iijlab.net on Fri, Jul 07, 2000 at 07:07:50PM +0900 Organization: Zembu Labs, Inc. Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Jul 07, 2000 at 07:07:50PM +0900, itojun@iijlab.net wrote: > do we still need _DIAGASSERT()? i'm not sure if they are maintained > any longer... jhb does not seem to have checked the history of it BTW. Yes, if Mr. Baldwin had done his homework, rather than make an insulting and uninformed comment on a public FreeBSD mailing list, he would have discovered that _DIAGASSERT() performs a very different role than the standard assert(). That's why it's in the implementation namespace (and used only in system libraries). They are designed to catch bugs in non-library code when the library is specifically compiled to do such checks. We went through all this before, and it is *inappropriate* for those checks to be ASSERT/assert for shipped libraries. It's *intended* that they expand only when the library is compiled with -D_DIAGNOSTIC. The goal is to improve the quality if NetBSD's userland code. FreeBSD, if they were smart, would adopt the same mechanism. But as can be shown by the error message, FreeBSD isn't even doing the basic work like building with strict prototype checking (which would have caught the missing _DIAGASSERT() in FreeBSD at compile time, rather than at run-time). > > itojun > > > ------- Forwarded Message > > Return-Path: > Received: from hub.freebsd.org (hub.FreeBSD.ORG [204.216.27.18]) > by coconut.itojun.org (8.9.3+3.2W/3.7W) with ESMTP id JAA02871 > for ; Fri, 7 Jul 2000 09:55:50 +0900 (JST) > Received: by hub.freebsd.org (Postfix, from userid 538) > id 12D6E37BC6C; Thu, 6 Jul 2000 17:53:25 -0700 (PDT) > Received: from localhost (localhost [127.0.0.1]) > by hub.freebsd.org (Postfix) with SMTP > id ED2182E816E; Thu, 6 Jul 2000 17:53:24 -0700 (PDT) > (envelope-from owner-freebsd-current) > Received: by hub.freebsd.org (bulk_mailer v1.12); Thu, 6 Jul 2000 17:53:24 -0700 > Delivered-To: freebsd-current@freebsd.org > Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) > by hub.freebsd.org (Postfix) with ESMTP > id EA87837BD24; Thu, 6 Jul 2000 17:53:05 -0700 (PDT) > (envelope-from jhb@FreeBSD.org) > Received: from foo.osd.bsdi.com (root@foo.osd.bsdi.com [204.216.28.137]) > by pike.osd.bsdi.com (8.9.3/8.9.3) with ESMTP id RAA29382; > Thu, 6 Jul 2000 17:52:54 -0700 (PDT) > (envelope-from jhb@FreeBSD.org) > Received: from FreeBSD.org (jhb@localhost [127.0.0.1]) > by foo.osd.bsdi.com (8.9.3/8.9.3) with ESMTP id RAA10197; > Thu, 6 Jul 2000 17:52:28 -0700 (PDT) > (envelope-from jhb@FreeBSD.org) > Message-ID: <396529CC.6988EBE9@FreeBSD.org> > Date: Thu, 06 Jul 2000 17:52:28 -0700 > From: John Baldwin > Organization: BSD, Inc. > X-Mailer: Mozilla 4.73 [en] (X11; I; FreeBSD 4.0-STABLE i386) > X-Accept-Language: en > MIME-Version: 1.0 > To: Charles Anderson > Cc: FreeBSD Current , n_hibma@FreeBSD.org > Subject: Re: _DIAGASSERT in libusb & libutil > References: <20000706181523.B38809@midgard.dhs.org> > Content-Type: text/plain; charset=us-ascii > Content-Transfer-Encoding: 7bit > Sender: owner-freebsd-current@FreeBSD.ORG > X-Loop: FreeBSD.ORG > Precedence: bulk > X-Filter: mailagent [version 3.0 PL68] for itojun@itojun.org > > Charles Anderson wrote: > > > > # grep -r DIAGASSERT . (from /usr/src) > > ./lib/libutil/fparseln.c: _DIAGASSERT(sp != NULL); > > ./lib/libutil/fparseln.c: _DIAGASSERT(p != NULL); > > ./lib/libutil/fparseln.c: _DIAGASSERT(fp != NULL); > > ./lib/libusb/data.c: _DIAGASSERT(p != NULL); > > ./lib/libusb/data.c: _DIAGASSERT(h != NULL); > > ./lib/libusb/data.c: _DIAGASSERT(p != NULL); > > ./lib/libusb/data.c: _DIAGASSERT(h != NULL); > > ./lib/libusb/descr.c: _DIAGASSERT(fd != -1); > > ./lib/libusb/parse.c: _DIAGASSERT(c != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(d != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(s != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(s != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(h != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(r != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(desc != NULL); > > ./lib/libusb/parse.c: _DIAGASSERT(h != NULL); > > ./make.out.070600.1528:/usr/obj/usr/src/i386/usr/lib/libusb.so: undefined reference to `_DIAGASSERT' > > > > Where does _DIAGASSERT come from? I updated right before I built which was > > 3:30 edt > > It's a macro that NetBSD uses just to be different from the rest of the > known > world which uses the assert() macro from /usr/include/assert.h. In > libutil/fparseln.c, all the _DIAGASSERT() macro calls are #if 0/#endif'd > out. > A similar patch should fix libusb. > > - -- > > John Baldwin -- http://www.FreeBSD.org/~jhb/ > PGP Key: http://www.cslab.vt.edu/~jobaldwi/pgpkey.asc > "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > > ------- End of Forwarded Message > > -- -- Jason R. Thorpe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message