HANDLE_PRAGMA_PACK_PUSH_POP
Define this macro (to a value of 1) if you want to support the Win32 style pragmas #pragma pack(push,n) and #pragma pack(pop). The pack(push,n) pragma specifies the maximum alignment (in bytes) of fields within a structure, in much the same way as the __aligned__ and __packed__ __attribute__s do. A pack value of zero resets the behavior to the default. Successive invocations of this pragma cause the previous values to be stacked, so that invocations of #pragma pack(pop) will return to the previous value.
To do a quick and dirty test without patching, I built oi-userland/components/illumos-gcc with the following:
richard@devzone:~/src/oi-userland/components/illumos-gcc$ git diff .
diff --git a/components/illumos-gcc/Makefile b/components/illumos-gcc/Makefile
index df86dd8..e984f21 100644
--- a/components/illumos-gcc/Makefile
+++ b/components/illumos-gcc/Makefile
@@ -26,6 +26,7 @@ include $(WS_TOP)/make-rules/configure.mk
include $(WS_TOP)/make-rules/ips.mk
CC_BITS=
+CPPFLAGS= -DHANDLE_PRAGMA_PACK_PUSH_POP
CFLAGS= -g -O2
CONFIG_SHELL= /bin/sh
@@ -51,6 +52,7 @@ CONFIGURE_OPTIONS += --with-pkgversion="Illumos $(ILLUMOS_VER
CONFIGURE_OPTIONS += --with-bugurl="http://github.com/illumos/gcc/issues"
COMPONENT_BUILD_ENV= SHELL=$(CONFIG_SHELL) CFLAGS="$(CFLAGS)" STAGE1_
+COMPONENT_BUILD_ENV+= CPPFLAGS="$(CPPFLAGS)" STAGE1_CPPFLAGS="$(CPPFLA
COMPONENT_BUILD_GMAKE_ARGS= -j8
COMPONENT_BUILD_TARGETS= bootstrap
The motivation to add this concerns acpica-unix2-20140214 integration, where (the following is an extract from changes.txt):
ACPICA headers: Deployed the use of #pragma pack(push) and #pragma
pack(pop) directives to ensure that the ACPICA headers are independent of
compiler settings or other host headers.
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actypes.h:47: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actypes.h:1320: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acexcep.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acexcep.h:350: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl1.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl1.h:1146: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl2.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl2.h:1421: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl3.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl3.h:737: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/actbl.h:445: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acoutput.h:47: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acoutput.h:469: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acrestyp.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acrestyp.h:702: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acpiosxf.h:53: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acpiosxf.h:556: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acconfig.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acconfig.h:239: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acbuffer.h:48: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acbuffer.h:249: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acpixf.h:57: error: #pragma pack(push[, id], <n>) is not supported on this target [-Wpragmas]
/home/richard/ws/illumos-gate/usr/src/common/acpica/include/acpixf.h:836: error: #pragma pack(pop[, id], <n>) is not supported on this target [-Wpragmas]
Again, recent gcc versions, have this by default and clang does as well.