diff --git a/include/assert.h b/include/assert.h index bcabb93..4e56e7a 100644 --- a/include/assert.h +++ b/include/assert.h @@ -8,17 +8,25 @@ * The FENIX C Library is distributed WITH NO WARRANTY WHATSOEVER. See * The CWPL for more details. */ - -#ifndef _ASSERT_H -#define _ASSERT_H - #include #include +/* + So, this one's a bit weird. Normally, we'd use include guards to make sure + a header is only included once, but the assert macro is supposed to be + redefined each time assert.h is included based on the current status of + NDEBUG, so we instead undefine-redefine assert and that's it. Technically, + it includes stdlib.h and stdio.h every time it's included, but meh. It's fine. + Those have include guards that mean it doesn't matter. + -Kat +*/ + +#ifdef assert +#undef assert +#endif + #ifdef NDEBUG #define assert(ignore) ((void) 0) #else #define assert(expression) (expression || (fprintf(stderr, "Assertion failed: %s: %d: %s", __FILE__, __LINE__, __func__) && abort())) -#endif - -#endif +#endif \ No newline at end of file