This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] Parser for OpenMP directives
On Mon, 28 Mar 2005, Daniel Jacobowitz wrote:
> > This is going to have to be done differently. Note that section 2.1
> > specifies that preprocessing tokens following "#pragma omp" are
> > subject to macro replacement. Thus
> >
> > #define foo barrier
> > #pragma omp foo
> >
> > is legal. AFAIK, the interface currently provided by libcpp contains
> > the raw text line.
>
> You're right; but see c_register_pragma_with_expansion.
In this regard note bug 18638: #pragma macro expansion is disabled when
deferred pragma handling is in effect (for C++) to avoid expanding macros
in the wrong context of macro definitions. We will want to do lexing up
from for C as well at some point, and this issue with #pragma macro
expansion will need to be fixed, as it will if an OpenMP parser for C++ is
to be implemented.
I concur with Zack's view that cpplib should end up expanding all
non-ignored pragmas as a token sequence (with or without macro expansion)
which is then parsed by the parser however it likes. This would start
with a special token for #pragma, end with a special token for the end of
a #pragma (I prefer such a special token to ending with an ordinary ';'
token) and inbetween have the tokens of the pragma. The pragma namespace
("GCC", "STDC", "omp") might or might not be a property of the #pragma
special token rather than a separate token, as might the following
identifier naming the pragma in question.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)