qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/3] qemu-tls.h: Add abstraction layer for TL


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 1/3] qemu-tls.h: Add abstraction layer for TLS variables
Date: Thu, 27 Oct 2011 17:18:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

On 10/27/2011 05:15 PM, Peter Maydell wrote:

>>  +#define DEFINE_TLS(type, x)  __thread __typeof__(type) tls__##x
>  I assume __typeof__() is a GCCism, indicated by ..._GCC_H, to ensure
>  type is actually a valid type?
Paolo?

No, _GCC_H has nothing to do with GCCisms. __typeof__ is needed so that "type" can be "int[5]":

    __thread __typeof__ (int[5]) foo; /* works */
    __thread int[5] foo; /* fails */

(even without __thread of course).

In fact, it has the opposite side effect: type can be any expression, but the assumption is that DEFINE_TLS(123, x) will be caught by review.

Paolo



reply via email to

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