From 0b9275b2c7ed2f88491898345e03618dbfbf4b0f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 6 May 2011 11:43:04 -0700 Subject: [PATCH] util: Suppress build assertions when building with sparse. sparse simply doesn't like our build assertions on packed structures. It seems that its ideas about struct packing are different from GCC's: ../lib/cfm.h:50:1: error: invalid bitfield width, -1. ../lib/packets.h:206:1: error: invalid bitfield width, -1. ../lib/packets.h:213:1: error: invalid bitfield width, -1. ../lib/packets.h:367:1: error: invalid bitfield width, -1. sparse isn't generating code so we don't really care how it lays out structures. We might as well just skip the assertions, as done here. --- lib/util.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/util.h b/lib/util.h index 4ed291ab..2be7a709 100644 --- a/lib/util.h +++ b/lib/util.h @@ -33,7 +33,10 @@ #endif #endif -#ifndef __cplusplus +#ifdef __CHECKER__ +#define BUILD_ASSERT(EXPR) ((void) 0) +#define BUILD_ASSERT_DECL(EXPR) extern int (*build_assert(void))[1] +#elif !defined(__cplusplus) /* Build-time assertion building block. */ #define BUILD_ASSERT__(EXPR) \ sizeof(struct { unsigned int build_assert_failed : (EXPR) ? 1 : -1; }) -- 2.30.2