From patchwork Wed Oct 3 18:04:58 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: 188881 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 EBE502C011B for ; Thu, 4 Oct 2012 04:20:22 +1000 (EST) Received: from localhost ([::1]:55790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTGk-0004fZ-Ay for incoming@patchwork.ozlabs.org; Wed, 03 Oct 2012 14:02:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTGd-0004fM-NM for qemu-devel@nongnu.org; Wed, 03 Oct 2012 14:01:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJTGZ-0003he-Dv for qemu-devel@nongnu.org; Wed, 03 Oct 2012 14:01:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTGZ-0003hN-5h for qemu-devel@nongnu.org; Wed, 03 Oct 2012 14:01:51 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q93I1nAD007349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Oct 2012 14:01:50 -0400 Received: from dhcp-100-3-184.bos.redhat.com (dhcp-189-4.bos.redhat.com [10.16.189.4]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q93I1m0Z009834; Wed, 3 Oct 2012 14:01:49 -0400 From: =?UTF-8?q?S=C3=B8ren=20Sandmann?= To: qemu-devel@nongnu.org Date: Wed, 3 Oct 2012 14:04:58 -0400 Message-Id: <1349287498-10475-1-git-send-email-sandmann@cs.au.dk> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q93I1nAD007349 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Subject: [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 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);}))