Re: _DIAGASSERT in libusb libutil

2000-07-07 Thread Nick Hibma


Fixed. Sorry.

On Thu, 6 Jul 2000, John Baldwin wrote:

 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/
 

--
[EMAIL PROTECTED]
[EMAIL PROTECTED]  USB project
http://www.etla.net/~n_hibma/



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



Re: _DIAGASSERT in libusb libutil

2000-07-07 Thread itojun


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.

_DIAGASSERT() has its history and reasons (there was some proposal
on it and _DIAGASSERT() implements that). it is not just to be
different.  I admit it is now equivalent to assert().  netbsd may need
to clean them up...

itojun


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



Re: _DIAGASSERT()

2000-07-07 Thread Jason R Thorpe

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 

Re: _DIAGASSERT in libusb libutil

2000-07-07 Thread John Baldwin


On 07-Jul-00 [EMAIL PROTECTED] wrote:
 
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.
 
   _DIAGASSERT() has its history and reasons (there was some proposal
   on it and _DIAGASSERT() implements that). it is not just to be
   different.  I admit it is now equivalent to assert().  netbsd may need
   to clean them up...

It is slightly different in truth, because assert() is conditionally
defined on NDEBUG, whereas _DIAGASSERT() is conditionally defined on
DIAGNOSTICS.  Also, it calls __diagassert() rather than __assert(),
although both functions take the same arguments, so I suppose it
could be performing additional behavior of some sort.

 itojun

-- 

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



Re: _DIAGASSERT()

2000-07-07 Thread John Baldwin


On 07-Jul-00 Jason R Thorpe wrote:
 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).

I do believe I let my sarcasm exceed the allowable boundary in my e-mail. :(
I had noticed that _DIAGASSERT was conditional on _DIAGNOSTIC and that it
called __diagassert() rather than __assert(), but failed to dig around
enough to ascertain the differences between those functions.

 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.

IOW, a way to enable a subset of assertions w/o having to enable all
the normal debugging code I take it then?  I can see the benefit in that.

 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).

By default we do not, no.  Although our debugging flags in -current
would have caught this had I used them.  Regardless, my apologies for
allowing my sarcasm to come off much rougher than I intended.

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

-- 

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



_DIAGASSERT in libusb libutil

2000-07-06 Thread Charles Anderson


# 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

-Charlie
-- 
Charles Anderson[EMAIL PROTECTED]

No quote, no nothin'


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