Received: from eggs.gnu.org ([208.118.235.92]:36700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJd6K-0002EZ-E4 for qemu-devel@nongnu.org; Thu, 04 Oct 2012 00:31:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJd6J-0002C6-49 for qemu-devel@nongnu.org; Thu, 04 Oct 2012 00:31:56 -0400 Received: from smtp.nfit.au.dk ([130.225.17.180]:53034 helo=nysmtp.nfit.au.dk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJd6I-0002AY-To for qemu-devel@nongnu.org; Thu, 04 Oct 2012 00:31:55 -0400 From: sandmann@cs.au.dk (=?utf-8?Q?S=C3=B8ren?= Sandmann) References: <1349287498-10475-1-git-send-email-sandmann@cs.au.dk> <506CA643.5050603@twiddle.net> Date: Thu, 04 Oct 2012 06:31:52 +0200 In-Reply-To: <506CA643.5050603@twiddle.net> (Richard Henderson's message of "Wed, 3 Oct 2012 13:55:31 -0700") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org, =?utf-8?Q?S=C3=B8ren?= Sandmann Pedersen Richard Henderson writes: >> 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 >>=20=20 >> /* Convert from a base type to a parent type, with compile time checkin= g. */ >> -#ifdef __GNUC__ >> -#define DO_UPCAST(type, field, dev) ( __extension__ ( { \ >> +#if defined (__GNUC__) && \ >> + (__GNUC__ > 4 || (__GNUC__ =3D=3D 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. The patch below doesn't make any difference.=20 S=C3=B8ren diff --git a/osdep.h b/osdep.h index cb213e0..1a36c20 100644 --- a/osdep.h +++ b/osdep.h @@ -43,8 +43,8 @@ typedef signed int int_fast16_t; /* Convert from a base type to a parent type, with compile time checking. */ #ifdef __GNUC__ #define DO_UPCAST(type, field, dev) ( __extension__ ( { \ - char __attribute__((unused)) offset_must_be_zero[ \ - -offsetof(type, field)]; \ + char offset_must_be_zero[ \ + -offsetof(type, field)] __attribute__((unused)) ; \ container_of(dev, type, field);})) #else #define DO_UPCAST(type, field, dev) container_of(dev, type, field)