X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Futil.h;h=b944ec793b817c56fe93a8e15da550857e01a73d;hb=4d5f814dfb737aae820b8ce70ff0a8b94c291ec3;hp=70f36919a5bd0d645225902a10476bf24fe18a4a;hpb=85b20fd6ee585f462e012fbcc7f966a81edab2ed;p=sliver-openvswitch.git diff --git a/lib/util.h b/lib/util.h index 70f36919a..b944ec793 100644 --- a/lib/util.h +++ b/lib/util.h @@ -62,6 +62,17 @@ #define BUILD_ASSERT_DECL_GCCONLY(EXPR) ((void) 0) #endif +/* Like the standard assert macro, except: + * + * - Writes the failure message to the log. + * + * - Not affected by NDEBUG. */ +#define ovs_assert(CONDITION) \ + if (!OVS_LIKELY(CONDITION)) { \ + ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION); \ + } +void ovs_assert_failure(const char *, const char *, const char *) NO_RETURN; + /* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes * anything other than an outermost "const" or "volatile" qualifier. *