On 10 February 2017 at 09:26, Nicolai Hähnle <nhaeh...@gmail.com> wrote:
> On 07.02.2017 19:34, Bartosz Tomczyk wrote:
>>
>> ---
>>  configure.ac    | 3 +++
>>  src/util/list.h | 9 +++++++++
>>  2 files changed, 12 insertions(+)
>>
>> diff --git a/configure.ac b/configure.ac
>> index a6ceee95a3..87f635c1a3 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -415,6 +415,9 @@ AC_C_BIGENDIAN(
>>     little_endian=no
>>  )
>>
>> +dnl Chek for typeof support
>> +AC_C_TYPEOF()
>> +
>>  dnl Check for POWER8 Architecture
>>  PWR8_CFLAGS="-mpower8-vector"
>>  have_pwr8_intrinsics=no
>> diff --git a/src/util/list.h b/src/util/list.h
>> index 07eb9f3e6a..eaaac43fec 100644
>> --- a/src/util/list.h
>> +++ b/src/util/list.h
>> @@ -171,10 +171,19 @@ static inline void list_validate(struct list_head
>> *list)
>>   * 'sample' MUST be initialized, or else the result is undefined!
>>   */
>>  #ifndef container_of
>> +#if HAVE_TYPEOF
>> +#define container_of_typed(ptr, type, member) ({                       \
>> +       const __typeof__( ((type *)0)->member ) *__mptr = (ptr);        \
>> +       (type *)( (char *)__mptr - offsetof(type,member) );})
>
>
> I believe this syntax is a GCC extension. Do all compilers with typeof also
> support that extension? This is something to be checked especially on
> Windows. Apart from that, the change looks good to me.
>
HAVE_TYPEOF will only be set if the compiler supports the typeof
extension, so we should be safe ;-)

For the patch
Acked-by: Emil Velikov <emil.veli...@collabora.com>

-Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to