This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: MS Style #pragma pack(push,...)
- To: Jeremy White <jwhite at codeweavers dot com>
- Subject: Re: MS Style #pragma pack(push,...)
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Wed, 28 Jun 2000 10:11:12 -0700
- Cc: gcc at gcc dot gnu dot org
- References: <395A2DB8.DD9C7D01@codeweavers.com>
On Wed, Jun 28, 2000 at 11:54:16AM -0500, Jeremy White wrote:
> I'm compiling Microsoft C++ code (MFC, in fact)
> for use with the Wine project under LINUX.
>
> As has been discussed previously, the MFC code has a lot of
> non standard extensions to the language. The one I'm
> fighting right now is their use of #pragma pack(push/pop,...).
>
> gcc now handles this almost perfectly (see question #2, below),
> but you have to #define HANDLE_PRAGMA_PACK_PUSH_POP in
> order to enable this code.
This will be enabled by default for all Linux configurations in gcc
2.96, and may have been there in 2.95 as well.
> Second, the pattern of #pragmas that MS uses is similar
> to the following:
>
> #define _PACKNUM 4
> #pragma pack(push, _PACKNUM)
>
> Currently, gcc treats that as a compiler error, because it doesn't
> expand the macro in cccp.c. I have revised cccp.c to solve
> this error, as is attached.
The new (1999) C standard requires some pragmas _not_ to be macro
expanded. For consistency we'd like all pragmas not to be expanded,
unless some overriding concern exists. This is a valid overriding
concern - but what that means is you need to make your patch specific
to #pragma pack.
Also, cccp.c no longer exists, and in general we cannot use patches
against anything but the current development sources.
zw