X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Futil.h;h=b944ec793b817c56fe93a8e15da550857e01a73d;hb=1b035ef20084e14b90537fb3873af99f45d40e34;hp=70f36919a5bd0d645225902a10476bf24fe18a4a;hpb=35bedb6171b62dd528e01dbeb8943bb841365bf5;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. *