This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to give compiler error if a function parameter is not declared with __thread?
- From: Ian Lance Taylor <iant at google dot com>
- To: "Shaun Pinney" <shaun dot pinney at hl dot konicaminolta dot us>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 25 Mar 2011 18:10:21 -0700
- Subject: Re: How to give compiler error if a function parameter is not declared with __thread?
- References: <00e301cbeb48$a0811d60$e1835820$@pinney@hl.konicaminolta.us>
"Shaun Pinney" <shaun.pinney@hl.konicaminolta.us> 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