From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJVyi-000878-9A for qemu-devel@nongnu.org; Wed, 03 Oct 2012 16:55:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJVyg-0001AS-Vp for qemu-devel@nongnu.org; Wed, 03 Oct 2012 16:55:36 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:65068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJVyg-0001A9-PF for qemu-devel@nongnu.org; Wed, 03 Oct 2012 16:55:34 -0400 Received: by pbbrp2 with SMTP id rp2so10391992pbb.4 for ; Wed, 03 Oct 2012 13:55:33 -0700 (PDT) Sender: Richard Henderson Message-ID: <506CA643.5050603@twiddle.net> Date: Wed, 03 Oct 2012 13:55:31 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1349287498-10475-1-git-send-email-sandmann@cs.au.dk> In-Reply-To: <1349287498-10475-1-git-send-email-sandmann@cs.au.dk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?U8O4cmVuIFNhbmRtYW5u?= Cc: qemu-devel@nongnu.org, =?UTF-8?B?U8O4cmVuIFNhbmRtYW5uIFBlZGVyc2Vu?= On 10/03/2012 11:04 AM, Søren Sandmann wrote: > From: Søren Sandmann Pedersen > > Apparently GCC 4.5 still warns about "value computed not used" even > with __attribute__((unused)). Fix this by only doing the compile time > check on gcc > 4.5. > > Signed-off-by: Soren Sandmann > --- > > I need this patch to get qemu to compile with GCC 4.5, but I'm not > sure if 4.5 is the right compiler version to check against. > > osdep.h | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/osdep.h b/osdep.h > index cb213e0..df89552 100644 > --- a/osdep.h > +++ b/osdep.h > @@ -41,8 +41,9 @@ typedef signed int int_fast16_t; > #endif > > /* Convert from a base type to a parent type, with compile time checking. */ > -#ifdef __GNUC__ > -#define DO_UPCAST(type, field, dev) ( __extension__ ( { \ > +#if defined (__GNUC__) && \ > + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)) > +#define DO_UPCAST(type, field, dev) ( __extension__ ( { \ > char __attribute__((unused)) offset_must_be_zero[ \ > -offsetof(type, field)]; \ > container_of(dev, type, field);})) Try moving the attribute to the end of the declaration, i.e. just before the semi-colon. r~