RE: How to give compiler error if a function parameter is not declared with __thread?

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

 



Thanks Ian.  I thought this would be the case.  I'm thinking, since there is
a runtime component to __thread, there may be a function to query if a
variable is thread-local (e.g. __isthreadscope(), __getscope(), etc).  Do
you know of any query method?  It's not a major issue, but would help a bit.
So far, I haven't spotted one.  Thanks again.

--Shaun

> -----Original Message-----
> From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
> Behalf Of Ian Lance Taylor
> Sent: Friday, March 25, 2011 6:10 PM
> To: Shaun Pinney
> Cc: gcc-help@xxxxxxxxxxx
> Subject: Re: How to give compiler error if a function parameter is not
> declared with __thread?
> 
> "Shaun Pinney" <shaun.pinney@xxxxxxxxxxxxxxxxxxx> writes:
> 
> > I want to restrict a function parameter to variables declared with
> __thread.
> > Is there a way to generate compiler errors if a user uses an
> incompatible
> > storage class?  The idea is to improve the 'user-friendliness' of an
> OS
> > porting layer - specifically, the parts related to thread-local
> storage.
> 
> __thread is of course a concept that only applies to global or static
> variables, not to function parameters; function parameters are always
> thread-local.  There is no way to require that all arguments in a
> function call be __thread global/static variables, no.
> 
> Ian




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux