]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
assert: make our assert clobber any others too
authorSage Weil <sage.weil@dreamhost.com>
Sat, 7 May 2011 04:59:41 +0000 (21:59 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Sat, 7 May 2011 04:59:41 +0000 (21:59 -0700)
Two can play this game, /usr/include/assert.h!

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/assert.h

index 98199b876447021d3cfa8917dd76ea99117dba2b..62e79490ed302a471890f839274f42d555b2efb2 100644 (file)
@@ -56,21 +56,11 @@ extern void __ceph_assert_fail(const char *assertion, const char *file, int line
   __attribute__ ((__noreturn__));
 extern void __ceph_assert_warn(const char *assertion, const char *file, int line, const char *function);
 
-// wipe any prior assert definition
-#ifdef assert
-# undef assert
-#endif
-
 #define ceph_assert(expr)                                                      \
   ((expr)                                                              \
    ? __CEPH_ASSERT_VOID_CAST (0)                                       \
    : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
 
-#define assert(expr)                                                   \
-  ((expr)                                                              \
-   ? __CEPH_ASSERT_VOID_CAST (0)                                       \
-   : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
-
 #define assert_warn(expr)                                                      \
   ((expr)                                                              \
    ? __CEPH_ASSERT_VOID_CAST (0)                                       \
@@ -113,3 +103,12 @@ using namespace ceph;
 
 #endif
 
+// wipe any prior assert definition
+#ifdef assert
+# undef assert
+#endif
+
+#define assert(expr)                                                   \
+  ((expr)                                                              \
+   ? __CEPH_ASSERT_VOID_CAST (0)                                       \
+   : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))