From e01e35713b51aafc05fe2d7d41ccc3886430125f Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 2 Apr 2026 15:38:06 +0300 Subject: [PATCH] LibC: Allow including assert.h multiple times Some shit seems to depend on this --- userspace/libraries/LibC/include/assert.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/userspace/libraries/LibC/include/assert.h b/userspace/libraries/LibC/include/assert.h index 8b4be91d..6b9732a7 100644 --- a/userspace/libraries/LibC/include/assert.h +++ b/userspace/libraries/LibC/include/assert.h @@ -1,3 +1,11 @@ +#ifndef assert +#ifdef NDEBUG + #define assert(ignore) ((void)0) +#else + #define assert(expr) ((expr) ? (void)0 : __assert_fail(#expr, __FILE__, __LINE__, __func__)) +#endif +#endif + #ifndef _ASSERT_H #define _ASSERT_H 1 @@ -5,12 +13,6 @@ #include -#ifdef NDEBUG - #define assert(ignore) ((void)0) -#else - #define assert(expr) ((expr) ? (void)0 : __assert_fail(#expr, __FILE__, __LINE__, __func__)) -#endif - #if !defined(__cplusplus) && __STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L #define static_assert _Static_assert #endif