include: When defining NDEBUG, assert will implement alignment standards
As defined by the C standard, if NDEBUG is defined, assert should do nothing but be simply defined as:
#define assert(ignore) ((void)0)
Reference link:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/assert.h.html
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
diff --git a/include/assert.h b/include/assert.h
index 45d6e4d..f80b657 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -113,18 +113,26 @@
/* The C standard states that if NDEBUG is defined, assert will do nothing.
* Users can define and undefine NDEBUG as they see fit to choose when assert
* does something or does not do anything.
+ *
+ * #define assert(ignore) ((void)0)
+ *
+ * Reference link:
+ * https://pubs.opengroup.org/onlinepubs/009695399/basedefs/assert.h.html
+ *
+ * ASSERT/VERIFY is a non-standard interface, implemented using internal
+ *
*/
#ifdef NDEBUG
-# define assert(f) ((void)(1 || (f)))
-# define VERIFY(f) assert(f)
+# define assert(f) ((void)0)
+# define ASSERT(f) ((void)(1 || (f)))
+# define VERIFY(f) ((void)(1 || (f)))
#else
# define assert(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__)
+# define ASSERT(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__)
# define VERIFY(f) _VERIFY(f, __ASSERT_FILE__, __ASSERT_LINE__)
#endif
-#define ASSERT(f) assert(f)
-
/* Suppress 3rd party library redefine _assert/__assert */
#define _assert _assert