This is the mail archive of the gcc-patches@gcc.gnu.org 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: Solaris pragma macro expansion


Joseph S. Myers wrote:
> 
> This patch makes the implementation of the "align" and "pack" pragmas
> on Solaris follow the specification followed by the Sun compiler more
> closely.  In particular, #pragma align may appear after the first
> declaration, and the Solaris specification is that the arguments to
> certain pragmas are macro expanded.  (The introduction of
> macro-expanded pragmas is part of the Solaris 10 patches which I'm not
> particularly certain of the desirability of for FSF GCC, though if the
> pragmas are for compatibility with vendor compilers it seems to make
> sense to follow the vendor specification in this regard.)

I also think that it makes sense to follow the vendor specification;
I'm fine with adding this capability to GCC.  Two things.  First,
please add arguments to cpp_register_pragma rather than introducing a
new interface.  There is no ABI or API guarantee for libcpp.  Second,
did you test this with C++ as well as C?  I am not certain that the
macro expansion logic works when #pragmas are deferred - specifically,
if you have

#define y12 12
#pragma align(y12)
#undef y12

I suspect that the #pragma will see y12 as a defined macro in C, but
not in C++.

zw


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