From patchwork Thu Oct 4 04:31:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=B8ren_Sandmann?= X-Patchwork-Id: 189017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B9D02C0333 for ; Thu, 4 Oct 2012 14:32:06 +1000 (EST) Received: from localhost ([::1]:32956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJd6S-0002Eh-Gn for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2012 00:32:04 -0400 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 Received: from llama10.cs.au.dk (unknown [10.11.82.10]) by nysmtp.nfit.au.dk (Postfix) with ESMTP id 1CD35E0C61; Thu, 4 Oct 2012 06:31:53 +0200 (CEST) From: sandmann@cs.au.dk (=?utf-8?Q?S=C3=B8ren?= Sandmann) To: Richard Henderson 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: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 130.225.17.180 Cc: qemu-devel@nongnu.org, =?utf-8?Q?S=C3=B8ren?= Sandmann Pedersen Subject: Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 >> >> /* 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. The patch below doesn't make any difference. Søren #define DO_UPCAST(type, field, dev) container_of(dev, type, field) 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