log: document the assign() macro
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 27 Jul 2019 18:21:06 +0000 (20:21 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 7 Aug 2019 19:31:02 +0000 (15:31 -0400)
Provide a concise description of the assert() macro. Point out that the
tested expression is always executed, irrespective of the value of _DEBUG.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
include/log.h

index 7566ba7f2dbbd8f35cb76f6577541df9e43e3dce..6d15e955d7e29b9c9fd99e3936032baf7ce644f4 100644 (file)
@@ -183,6 +183,18 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
  */
 void __assert_fail(const char *assertion, const char *file, unsigned int line,
                   const char *function);
  */
 void __assert_fail(const char *assertion, const char *file, unsigned int line,
                   const char *function);
+
+/**
+ * assert() - assert expression is true
+ *
+ * If the expression x evaluates to false and _DEBUG evaluates to true, a panic
+ * message is written and the system stalls. The value of _DEBUG is set to true
+ * if DEBUG is defined before including common.h.
+ *
+ * The expression x is always executed irrespective of the value of _DEBUG.
+ *
+ * @x:         expression to test
+ */
 #define assert(x) \
        ({ if (!(x) && _DEBUG) \
                __assert_fail(#x, __FILE__, __LINE__, __func__); })
 #define assert(x) \
        ({ if (!(x) && _DEBUG) \
                __assert_fail(#x, __FILE__, __LINE__, __func__); })