qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix compilation on GCC 4.5
@ 2012-10-03 18:04 Søren Sandmann
  2012-10-03 18:19 ` Stefan Weil
  2012-10-03 20:55 ` Richard Henderson
  0 siblings, 2 replies; 7+ messages in thread
From: Søren Sandmann @ 2012-10-03 18:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Søren Sandmann Pedersen

From: Søren Sandmann Pedersen <ssp@redhat.com>

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 <ssp@redhat.com>
---

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-04  5:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-03 18:04 [Qemu-devel] [PATCH] Fix compilation on GCC 4.5 Søren Sandmann
2012-10-03 18:19 ` Stefan Weil
2012-10-03 19:49   ` Søren Sandmann
2012-10-03 20:45     ` Stefan Weil
2012-10-04  5:44       ` Søren Sandmann
2012-10-03 20:55 ` Richard Henderson
2012-10-04  4:31   ` Søren Sandmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).