This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cpp macro expansion for #pragmas

On Fri, Sep 29, 2006 at 06:40:29PM -0700, Ian Lance Taylor wrote:
> > This is revived from several months back.  It adds cpp macro expansion
> > capability for #pragma directives, under control of a gcc command line
> > option (-expand-pragmas).  It's against version 117267 of the svn
> > tree, which is now a day or so old, except the testsuite/ChangeLog
> > diff is against a newer revision (but changelogs always get patch
> > conflicts anyway).  I'd like to submit it for GCC 4.3.  I've run the
> > full gcc test suite and while there are a number of unexpected
> > failures and successes, they're in non-cpp-related areas and I get the
> > same failures when running the tests using the unpatched cpp (2
> > unexpected failures in C, one unexpected success in C++, and 16
> > unexpected failures in Fortran, IIRC.  I think Fortran does not use
> > the cpp at all).  Please let me know of any probs.
> This is an interesting idea, but it seems to me that pragma expansion
> should itself be under the control of a pragma.  Otherwise you have
> program which will have surprisingly different behaviour depending
> upon the command line options used.  Is that doable?

libcpp already supports expansion/non-expansion on a per-pragma namespace
basis.  When registering a pragma with a namespace, you can say if it will
be macro expanded or not.  So, e.g. omp namespace is always macro expanded,
STDC namespace is not, pack namespace is expanded or not expanded depending
on the habits of the target for compatibility with other compilers on
the target, etc.  The namespace name itself is never expanded, which is
IMHO a good thing.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]