[Bug target/52991] [6/7/8 Regression] attribute packed broken on mingw32?

dev at benjarobin dot fr gcc-bugzilla@gcc.gnu.org
Wed Feb 28 21:06:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991

--- Comment #34 from Benjamin Robin <dev at benjarobin dot fr> ---
Thank you a lot for the fix.
I have no idea what I did yesterday when I did test bf-ms-layout-2.c (Yes the
test was wrong, and by default cannot compile under Visual Studio VC)

The test can be slightly improved by replacing:

#ifdef __GNUC__
#define ATTR __attribute__ ((ms_struct))
#endif

By:

#ifdef __GNUC__
# ifdef _TEST_MS_LAYOUT
#  define ATTR __attribute__ ((ms_struct))
# else
#  define ATTR __attribute__ ((gcc_struct))
# endif
#else
# define ATTR
#endif

Otherwise the else branch of "#if defined (_TEST_MS_LAYOUT) || defined
(_MSC_VER)" cannot be tested easily.
And even more important, it can be directly compiled with Visual Studio VC (VC
does not known what is ATTR)


More information about the Gcc-bugs mailing list