Skip to content

Commit

Permalink
include/assert: define ceph_assert[f] that mirror assert[f]
Browse files Browse the repository at this point in the history
We will transition to these.

Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Jun 28, 2016
1 parent bc1ca22 commit ae99910
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/include/assert.h
Expand Up @@ -76,10 +76,6 @@ extern void __ceph_assertf_fail(const char *assertion, const char *file, int lin
__attribute__ ((__noreturn__));
extern void __ceph_assert_warn(const char *assertion, const char *file, int line, const char *function);

#define ceph_assert(expr) \
((expr) \
? __CEPH_ASSERT_VOID_CAST (0) \
: __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION))

#define assert_warn(expr) \
((expr) \
Expand Down Expand Up @@ -128,10 +124,18 @@ using namespace ceph;
((expr) \
? __CEPH_ASSERT_VOID_CAST (0) \
: __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION))
#define ceph_assert(expr) \
((expr) \
? __CEPH_ASSERT_VOID_CAST (0) \
: __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION))

// Named by analogy with printf. Along with an expression, takes a format
// string and parameters which are printed if the assertion fails.
#define assertf(expr, ...) \
((expr) \
? __CEPH_ASSERT_VOID_CAST (0) \
: __ceph_assertf_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION, __VA_ARGS__))
#define ceph_assertf(expr, ...) \
((expr) \
? __CEPH_ASSERT_VOID_CAST (0) \
: __ceph_assertf_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION, __VA_ARGS__))

0 comments on commit ae99910

Please sign in to comment.