diff options
author | Ben Pfaff <blp@ovn.org> | 2018-01-31 11:23:24 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-02-01 11:21:34 -0800 |
commit | 500db308e2704fa9fc5ff69cdcd9cb3b22116e99 (patch) | |
tree | 8a5cf13bf33232372b806bcbd48c791add83a4df /include | |
parent | 4bc938ccb3124282c873084a7d11cd8bc37e27a7 (diff) | |
download | openvswitch-500db308e2704fa9fc5ff69cdcd9cb3b22116e99.tar.gz |
util: Document and rely on ovs_assert() always evaluating its argument.
The ovs_assert() macro always evaluates its argument, even when NDEBUG is
defined so that failure is ignored. This behavior wasn't documented, and
thus a lot of code didn't rely on it. This commit documents the behavior
and simplifies bits of code that heretofore didn't rely on it.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/openvswitch/util.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/openvswitch/util.h b/include/openvswitch/util.h index ad1b184f7..b4d49ee21 100644 --- a/include/openvswitch/util.h +++ b/include/openvswitch/util.h @@ -44,8 +44,11 @@ const char *ovs_get_program_version(void); : (X) <= UINT_MAX / (Y) ? (unsigned int) (X) * (unsigned int) (Y) \ : UINT_MAX) -/* Like the standard assert macro, except writes the failure message to the - * log. */ +/* Like the standard assert macro, except: + * + * - Writes the failure message to the log. + * + * - Always evaluates the condition, even with NDEBUG. */ #ifndef NDEBUG #define ovs_assert(CONDITION) \ (OVS_LIKELY(CONDITION) \ |