Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Jul 2000 10:21:44 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.ORG>
To:        Jason R Thorpe <thorpej@zembu.com>
Cc:        freebsd-current@FreeBSD.ORG, itojun@iijlab.net
Subject:   Re: _DIAGASSERT()
Message-ID:  <200007071721.KAA47676@john.baldwin.cx>
In-Reply-To: <20000707064640.A391@dr-evil.shagadelic.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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

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 <thorpej@zembu.com>

-- 

John Baldwin <jhb@FreeBSD.org> -- 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007071721.KAA47676>