Date: Wed, 18 Feb 2004 15:36:35 -0800 From: Marcel Moolenaar <marcel@xcllnt.net> To: John Baldwin <jhb@FreeBSD.org> Cc: Jun Kuriyama <kuriyama@imgsrc.co.jp> Subject: Re: cvs commit: src/sys/alpha/alpha support.s src/sys/i386/i386 swtch.s src/sys/kern kern_shutdown.c src/sys/sys systm.h Message-ID: <20040218233635.GA9510@ns1.xcllnt.net> In-Reply-To: <200402181414.01381.jhb@FreeBSD.org> References: <200401192127.i0JLRBL3041817@repoman.freebsd.org> <200402180839.09285.jhb@FreeBSD.org> <20040218174059.GC7878@ns1.xcllnt.net> <200402181414.01381.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 18, 2004 at 02:14:00PM -0500, John Baldwin wrote:
*snip*
> Thus, you have:
>
> #define KASSERT(condition) KASSERTL(condition, __FILE__, __LINE__)
> #define KASSERTV(condition, ...) KASSERTLV(condition, __FILE__, __LINE__, \
> __VA_ARGS__)
> #define KASSERTL(condition, file, line) KASSERTLV(condition, file, line, \
> "%s", __STRING(condition))
> #define KASSERTLV(condition, file, line, ...) do { \
> if (!(condition)) { \
> printf("Assertion \""); \
> printf(__VA_ARGS__); \
> printf("\" failed at %s:%d\n", file, line); \
> } \
> } while(0)
>
> Even nicer might be to make fixup_filename() from subr_witness.c a global
> #ifdef INVARIANTS_SUPPORT and have KASSERTLV() use that (it trims any (../)*
> from the front of a filename to improve readability of messages by just
> returning a char * pointer farther along in the string).
Yes, looks very workable to me (KASSERTLV needs to panic though :-)
The only downside is that we need to visit any existing KASSERTs.
See also below.
> If ASSERT() is preferred to KASSERT() that would certain ease the transition
> to the different macros.
That's the reason I threw in ASSERT. If KASSERT remains unchanged, then
the switch/adoption is much easer because there are no ABI breakages.
Other than that, I don't care much if it's called ASSERT or KASSERT.
/me says: go for s/MPASS/ASSERT/g...
--
Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040218233635.GA9510>
