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
Marcel Moolenaar
marcel at xcllnt.net
Wed Feb 18 15:36:37 PST 2004
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 at xcllnt.net
More information about the cvs-src
mailing list