From: "Jan Beulich" Subject: Re: [PATCH] Fix non-debug build after c/s 23767:80e9fcdaef36 Date: Mon, 22 Aug 2011 15:12:26 +0100 Message-ID: <4E527FEA02000078000528EE@nat28.tlf.novell.com> References: <20110822140733.GB96414@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20110822140733.GB96414@ocelot.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tim Deegan Cc: George Dunlap , Keir Fraser , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> On 22.08.11 at 16:07, Tim Deegan wrote: > At 15:02 +0100 on 22 Aug (1314025327), George Dunlap wrote: >> That seems to compile just fine, and obviously makes the code a lot >> cleaner. The only thing is that this will still cause functions >> inside ASSERTS (spin_is_locked() in this case) to be called; I thought >> part of the reason for having ASSERTs in the debug build only was to >> reduce the cost of all the checks (the other reason to avoid >> unnecessary crashes on production builds)? >=20 > How about #define ASSERT(p) do { if (0 && (p)); } while (0) ? That seems reasonable to me (but doesn't guarantee a more clever compiler would notice that any variable read only in ASSERT() expressions may now be initialized but never used - doesn't gcc 4.6 already do this to some degree?). Jan > Tim. >=20 >> On Mon, Aug 22, 2011 at 2:35 PM, Keir Fraser = wrote: >> > George, >> > >> > Would something like this work more generically for the non-debug = case? >> > >> > #define ASSERT(p) do { if (p); } while (0) >> > >> > -- Keir >> >