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