This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Detecting #pragma pack support?
- From: Bob Bradley <bob at chaoticsoftware dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 08 May 2007 18:22:51 -0700
- Subject: Detecting #pragma pack support?
Is there a way to detect whether #pragma pack( push, n ) is supported? Some
targets seem to support it in some versions of GCC and some don't so I was
hoping there was some kind of preprocessor symbol I can check to see which
one I should use at compile time. I have to support other compilers in
addition to GCC so I can't use the packed attribute. I essentially want to
do this:
#if PRAGMA_PACK_PUSH_SUPPORTED
#pragma pack( push, 2 )
#elfif PRAGMA_PACK_SUPPORTED
#pragma pack( 2 )
#else
#error pragma pack not supported at all
#endif
Is there a way to detect this with GCC?