On Fri, Jul 07, 2000 at 07:07:50PM +0900, [EMAIL PROTECTED] 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: <[EMAIL PROTECTED]>
 > 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 <[EMAIL PROTECTED]>; 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: [EMAIL PROTECTED]
 > 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 [EMAIL PROTECTED])
 > Received: from foo.osd.bsdi.com ([EMAIL PROTECTED] [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 [EMAIL PROTECTED])
 > 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 [EMAIL PROTECTED])
 > Message-ID: <[EMAIL PROTECTED]>
 > Date: Thu, 06 Jul 2000 17:52:28 -0700
 > From: John Baldwin <[EMAIL PROTECTED]>
 > 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 <[EMAIL PROTECTED]>
 > Cc: FreeBSD Current <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
 > Subject: Re: _DIAGASSERT in libusb & libutil
 > References: <[EMAIL PROTECTED]>
 > Content-Type: text/plain; charset=us-ascii
 > Content-Transfer-Encoding: 7bit
 > Sender: [EMAIL PROTECTED]
 > X-Loop: FreeBSD.ORG
 > Precedence: bulk
 > X-Filter: mailagent [version 3.0 PL68] for [EMAIL PROTECTED]
 > 
 > 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 <[EMAIL PROTECTED]> -- 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 [EMAIL PROTECTED]
 > with "unsubscribe freebsd-current" in the body of the message
 > 
 > ------- End of Forwarded Message
 > 
 > 

-- 
        -- Jason R. Thorpe <[EMAIL PROTECTED]>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to