]> 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 1b528a4b37176a89d249e533062477c970d4af21..4c60056fbde755298b66df60136edb1643b68754 100644 (file)
@@ -73,21 +73,26 @@ __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, "")
+#endif
+
 __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