[cfe-dev] #pragmas in the AST.

Paolo Bolzoni bolzoni at cs.unipr.it
Tue Dec 9 03:58:44 PST 2008


On Tue, 9 Dec 2008 05:59:32 -0500
steve naroff <snaroff at apple.com> wrote:

Hi snaroff,
I am probably missing the obvious then, how the following phases of
compilation knows if I set or I didn't set a pragma?

Example, from C99 standard, speaking of pragma STDC FENU_ACCESS:
'''
When outside external declarations, the pragma takes effect from its
occurrence until another FENV_ACCESS pragma is encountered, or until the end
of the translation unit.
When inside a compound statement, the pragma takes effect from its occurrence
until another FENV_ACCESS pragma is encountered (including within a nested
compound statement), or until the end of the compound statement; 
'''

If the ast forgets about pragmas, how can I know if a certain statement have
FENU_ACCESS on?

Thanks,
pb




> Hi Paolo,
> 
> Pragma's are preprocessing directives. Since they aren't integrated  
> with the C grammar (and aren't declarations in the language), they  
> aren't represented in the AST.
> 
> snaroff
> 
> On Dec 9, 2008, at 5:35 AM, Paolo Bolzoni wrote:
> 
> >
> > dear cfe-list,
> > I'd like to know how the AST represents eventual pragmas of the  
> > original
> > source code. As far I understood the pragmas disappear, or at least  
> > aren't
> > global declarations.
> >
> >
> > I am overall interested about the standard pragmas (#pragma STDC, for
> > example C99 7.6.1).
> >
> > Thanks.
> > pb



More information about the cfe-dev mailing list