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: Søren Sandmann
Subject: Re: [Qemu-devel] [PATCH] Fix compilation on GCC 4.5
Date: Thu, 04 Oct 2012 06:31:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

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

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)



reply via email to

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