gomp-discuss
[Top][All Lists]
Advanced

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

[Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end


From: Zack Weinberg
Subject: [Gomp-discuss] Re: Implementing OpenMP pragmas for the C front end
Date: Tue, 11 Feb 2003 08:37:38 -0800
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2

Steven Bosscher <address@hidden> writes:

> Pragmas are registered in cpplib with a handler that is called from
> cpplib.  So the lexer and parser never see the pragmas. This makes it a
> bit difficult to have elaborate interaction between the parser and the
> pragma handlers.  There are additional callbacks for most pragmas from
> c-decl (the maybe_apply_{weak,renaming_pragma} functions) because the
> compiler may encounted symbols that are affected by those pragmas long
> after the pragma itself was handled.
>
> In OpenMP, the pragmas are more like grammar productions.  Certain
> pragmas can only be followed or by a compound statement, some other
> pragmas can only appear inside a compound.  Some constructs need
> information about scope and/or about how deep they're nested.
>
> In fact, the OpenMP specifications present the OpenMP pragmas as grammar
> extensions for C/C++!

Pragmas are callbacks only for historical reasons: It was easier to
implement them that way at the time.  With the C/C++ front ends moving
to recursive descent parsers, it would make perfect sense to put them
back in the token stream.  Perhaps we would transform

#pragma foo bar baz

into

__builtin_pragma foo bar baz;

and feed that to phase 7.

zw




reply via email to

[Prev in Thread] Current Thread [Next in Thread]