From eb7848a1df28cf830178960704a69c5aa8fca970 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 24 Oct 2017 21:39:21 -0700 Subject: [PATCH] libc: Make no-debug assert() conform to C requirements The C standard requires assert() to be a void result, so you could write something like: return assert(x), x; From the C11 standard (7.2 Diagnostic ): > If NDEBUG is defined as a macro name at the point in the source file > where is included, the assert macro is defined simply as > #define assert(ignore) ((void)0) Signed-off-by: Thiago Macieira --- lib/libc/minimal/include/assert.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/minimal/include/assert.h b/lib/libc/minimal/include/assert.h index b49deac0290..df50bda6d18 100644 --- a/lib/libc/minimal/include/assert.h +++ b/lib/libc/minimal/include/assert.h @@ -20,7 +20,7 @@ extern "C" { #endif #else #ifndef assert -#define assert(test) +#define assert(test) ((void)0) #endif #endif