This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] New pragma handling mechanism
On Fri, Apr 08, 2005 at 04:18:41PM -0700, Zack Weinberg wrote:
> The theory is, the recursive descent parser encounters the CPP_PRAGMA
> token and calls the function pointer embedded therein, which points to
> a handler function just like the functions we have now. For OMP
> pragmas, that handler function can call back into the expression
> parser (for instance). Is this what you mean by 'normal recursive
> descent parsing'?
Well, yes and no. Ok, say we've called some function to parse the
pragma. What's going to happen when we get to the CPP_EOF token
that marks the end of the pragma? Am I going to get no more tokens,
or can parsing continue?
Virtually all of the omp pragmas need to parse the next statement
and do something special with it. For instance,
#pragma omp atomic
var += 1;
which needs to parse both the pragma and the following statement.
>From this we generate the builtin __sync_fetch_and_add (&var, 1).
r~