qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5
Date: Wed, 03 Oct 2012 20:19:36 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20120724 Iceowl/1.0b1 Icedove/3.0.11

Am 03.10.2012 20:04, schrieb Søren Sandmann:
From: Søren Sandmann Pedersen<address@hidden>

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<address@hidden>
---

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);}))

Hello,

I don't see any warnings with gcc Debian 4.4.5-8.

Could you please provide more information on your environment
and the warnings which you get?

Here is a macro which simplifies the version check:

#if QEMU_GNUC_PREREQ(4, 6)

Regards

Stefan Weil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]