diff options
author | Jonathan Adams <Jonathan.Adams@Sun.COM> | 2010-01-12 17:06:34 -0800 |
---|---|---|
committer | Jonathan Adams <Jonathan.Adams@Sun.COM> | 2010-01-12 17:06:34 -0800 |
commit | 56f33205c9ed776c3c909e07d52e94610a675740 (patch) | |
tree | 7a0c9fb16d059f20cdf267568985fb237e43c9bf /usr/src/uts/common/sys/debug.h | |
parent | 9217f8fd97307134fc9a37e74da9fc2dd246e58a (diff) | |
download | illumos-joyent-56f33205c9ed776c3c909e07d52e94610a675740.tar.gz |
4517853 debug.h should include macros to assert implication and equivalence
6915090 struct memlist should have ml_ member prefixes
Diffstat (limited to 'usr/src/uts/common/sys/debug.h')
-rw-r--r-- | usr/src/uts/common/sys/debug.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr/src/uts/common/sys/debug.h b/usr/src/uts/common/sys/debug.h index 7c12ecab01..4de39d255e 100644 --- a/usr/src/uts/common/sys/debug.h +++ b/usr/src/uts/common/sys/debug.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -74,6 +74,25 @@ extern int assfail(); #endif /* + * IMPLY and EQUIV are assertions of the form: + * + * if (a) then (b) + * and + * if (a) then (b) *AND* if (b) then (a) + */ +#if DEBUG +#define IMPLY(A, B) \ + ((void)(((!(A)) || (B)) || \ + assfail("(" #A ") implies (" #B ")", __FILE__, __LINE__))) +#define EQUIV(A, B) \ + ((void)((!!(A) == !!(B)) || \ + assfail("(" #A ") is equivalent to (" #B ")", __FILE__, __LINE__))) +#else +#define IMPLY(A, B) ((void)0) +#define EQUIV(A, B) ((void)0) +#endif + +/* * ASSERT3() behaves like ASSERT() except that it is an explicit conditional, * and prints out the values of the left and right hand expressions as part of * the panic message to ease debugging. The three variants imply the type |