This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Solaris pragma macro expansion
- From: Zack Weinberg <zack at codesourcery dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 19 Nov 2004 13:02:46 -0800
- Subject: Re: Solaris pragma macro expansion
- References: <Pine.LNX.4.61.0411192005070.28964@digraph.polyomino.org.uk>
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