From: Ben Pfaff Date: Mon, 26 Jan 2009 18:33:14 +0000 (-0800) Subject: Avoid a "statement has no effect" warning from BUILD_ASSERT. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9de49eacbc1ade9ab90fe8d9f7b5f7a881463c5;p=openvswitch Avoid a "statement has no effect" warning from BUILD_ASSERT. --- diff --git a/lib/util.h b/lib/util.h index fde681fa..cf6cd6b1 100644 --- a/lib/util.h +++ b/lib/util.h @@ -51,13 +51,16 @@ #endif #ifndef __cplusplus -/* Build-time assertion for use in a statement context. */ -#define BUILD_ASSERT(EXPR) \ +/* Build-time assertion building block. */ +#define BUILD_ASSERT__(EXPR) \ sizeof(struct { unsigned int build_assert_failed : (EXPR) ? 1 : -1; }) +/* Build-time assertion for use in a statement context. */ +#define BUILD_ASSERT(EXPR) (void) BUILD_ASSERT__(EXPR) + /* Build-time assertion for use in a declaration context. */ #define BUILD_ASSERT_DECL(EXPR) \ - extern int (*build_assert(void))[BUILD_ASSERT(EXPR)] + extern int (*build_assert(void))[BUILD_ASSERT__(EXPR)] #else /* __cplusplus */ #include #define BUILD_ASSERT BOOST_STATIC_ASSERT