[libc-commits] [libc] [libc] assert.h modifications for newhdrgen (PR #98092)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Mon Jul 8 16:14:22 PDT 2024


================
@@ -12,4 +12,21 @@
 // This file may be usefully included multiple times to change assert()'s
 // definition based on NDEBUG.
 
+#ifndef __cplusplus
+#undef static_assert
+#define static_assert _Static_assert
+#endif
+
+#undef assert
+#ifdef NDEBUG
+#define assert(e) (void)0
+#else
+#ifdef __cplusplus
+extern "C"
+#endif
----------------
petrhosek wrote:

This file already includes `__llvm-libc-common.h` so you can use `__BEGIN_C_DECLS` and `__END_C_DECLS`.

https://github.com/llvm/llvm-project/pull/98092


More information about the libc-commits mailing list