+/* CC0 (Public domain) - see LICENSE file for details */
#ifndef CCAN_CHECK_TYPE_H
#define CCAN_CHECK_TYPE_H
#include "config.h"
* argument is of the expected type. No type promotion of the expression is
* done: an unsigned int is not the same as an int!
*
- * check_type() always evaluates to 1.
+ * check_type() always evaluates to 0.
*
* If your compiler does not support typeof, then the best we can do is fail
* to compile if the sizes of the types are unequal (a less complete check).
*
* Example:
* // Do subtraction to get to enclosing type, but make sure that
- * // pointer is of correct type for that member.
+ * // pointer is of correct type for that member.
* #define container_of(mbr_ptr, encl_type, mbr) \
* (check_types_match((mbr_ptr), &((encl_type *)0)->mbr), \
* ((encl_type *) \
#include <ccan/build_assert/build_assert.h>
/* Without typeof, we can only test the sizes. */
#define check_type(expr, type) \
- EXPR_BUILD_ASSERT(sizeof(expr) == sizeof(type))
+ BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type))
#define check_types_match(expr1, expr2) \
- EXPR_BUILD_ASSERT(sizeof(expr1) == sizeof(expr2))
+ BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2))
#endif /* HAVE_TYPEOF */
#endif /* CCAN_CHECK_TYPE_H */