This is the mail archive of the gcc-help@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]

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?



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