]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/assert.h
xnu-3248.30.4.tar.gz
[apple/xnu.git] / osfmk / kern / assert.h
index c704dca5f0084936b409044498dc598b84acd755..4c60056fbde755298b66df60136edb1643b68754 100644 (file)
@@ -73,7 +73,7 @@ __BEGIN_DECLS
 extern void    Assert(
        const char      *file,
        int             line,
-       const char      *expression);
+       const char      *expression) __attribute__((noinline));
 
 #if CONFIG_NO_PANIC_STRINGS
 #define Assert(file, line, ex) (Assert)("", line, "")
@@ -84,15 +84,15 @@ __END_DECLS
 #if    MACH_ASSERT
 
 #define assert(ex)  \
-       ((ex) ? (void)0 : Assert(__FILE__, __LINE__, # ex))
-#define        assert_static(x)        assert(x)
+       (__builtin_expect(!!((long)(ex)), 1L) ? (void)0 : Assert(__FILE__, __LINE__, # ex))
+#define assert_static(ex) _Static_assert((ex), #ex)
 
 #define __assert_only
 
 #else  /* MACH_ASSERT */
 
 #define assert(ex) ((void)0)
-#define assert_static(ex) do {} while (0)
+#define assert_static(ex) _Static_assert((ex), #ex)
 
 #define __assert_only __unused