[gomp] Parser for OpenMP directives
Joseph S. Myers
joseph@codesourcery.com
Wed Mar 30 17:21:00 GMT 2005
On Wed, 30 Mar 2005, Dmitry Kurochkin wrote:
> What do you think of creating/changing pragma registration function,
> which will allow specifying that macro expansion should take place for
> pragma name and that pragma tokens should be inserted into stream?
> And I think that the special token can be CPP_PRAGMA, with the pragma
> name as its value in the beginning of pragma token and empy CPP_PRAGMA
> in the end.
>
> If you like this variant, I would like to implement it.
We currently have two different forms of pragma handling, deferred and
immediate. In the latter case we can do macro expansion for pragmas
requiring it, but not in the former. What I don't want is to have *three*
different forms of pragma handling. You could avoid this by moving C to
lex up front (so deferred pragmas are the only way) before changing the
tokens used, or you could implement the changed tokens at the same time
for both lexing up front and lexing a token at a time (with the necessary
changes to both C and C++ parsers to handle this), or you could implement
the changed tokens initially for deferred pragma handling only so they
would at first only be used for C++ and become available for C only later
when C changes to lexing up front. In any case, these changes should be
made on mainline and then merged from there to gomp-branch.
Note there is an existing target pragma handling interface, where target
pragma handlers call c_lex, which will need emulating under the new system
unless you want to change all target pragma handlers at once and keep them
working for both C and C++ throughout.
--
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)
More information about the Gcc-patches
mailing list