aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-03-01 23:29:50 +0000
committerlloyd <[email protected]>2013-03-01 23:29:50 +0000
commitba20b8f3a49ceb61307e3afea0d8f713d2315353 (patch)
treef63171543ed7d8fef38d79a16b3be30f6ae0144a
parent2a86d1ef1aae29037704c4b26fd79f9fb64c747f (diff)
Add BOTAN_ASSERT_IMPLICATION macro
-rw-r--r--src/utils/assert.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/assert.h b/src/utils/assert.h
index d92b41111..04b8ce4ed 100644
--- a/src/utils/assert.h
+++ b/src/utils/assert.h
@@ -46,6 +46,19 @@ void assertion_failure(const char* expr_str,
} while(0)
/**
+* Assert that expr1 (if true) implies expr2 is also true
+*/
+#define BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg) \
+ do { \
+ if((expr1) && !(expr2)) \
+ Botan::assertion_failure(#expr1 " implies " #expr2, \
+ msg, \
+ __func__, \
+ __FILE__, \
+ __LINE__); \
+ } while(0)
+
+/**
* Assert that a pointer is not null
*/
#define BOTAN_ASSERT_NONNULL(ptr) \