Hello,
This patch enables by default for native Windows targets the
-mms-bitfields option, like the netware target does.
ChangeLog gcc/
* config/i386/mingw32.h (TARGET_SUBTARGET_DEFAULT): Add
MASK_MS_BITFIELD_LAYOUT bit.
ChangeLog gcc/testsuite
* g++.dg/ext/bitfield2.C: Add for i?86/x86_64-*-mingw*
targets the additional -mno-ms-bitfields and
-Wno-packed-bitfield-compat options.
* g++.dg/ext/bitfield3.C: Likewise.
* g++.dg/ext/bitfield4.C: Likewise.
* g++.dg/ext/bitfield5.C: Likewise.
* gcc.dg/bitfld-15.c: Likewise.
* gcc.dg/bitfld-16.c: Likewise.
* gcc.dg/bitfld-17.c: Likewise.
* gcc.dg/bitfld-18.c: Likewise.
Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
x86_&4-pc-linux-gnu. Ok for apply?
Regards,
Kai
Index: gcc/gcc/config/i386/mingw32.h
===================================================================
--- gcc.orig/gcc/config/i386/mingw32.h 2011-04-12 12:07:34.000000000 +0200
+++ gcc/gcc/config/i386/mingw32.h 2011-04-12 12:13:05.891324300 +0200
@@ -22,6 +22,17 @@ along with GCC; see the file COPYING3.
#undef DEFAULT_ABI
#define DEFAULT_ABI MS_ABI
+/* By default, target has a 80387, uses IEEE compatible arithmetic,
+ returns float values in the 387 and needs stack probes.
+ We also align doubles to 64-bits for MSVC default compatibility.
+ Additionally we enable MS_BITFIELD_LAYOUT by default. */
+
+#undef TARGET_SUBTARGET_DEFAULT
+#define TARGET_SUBTARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
+ | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
+ | MASK_MS_BITFIELD_LAYOUT)
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
Index: gcc/gcc/testsuite/g++.dg/ext/bitfield2.C
===================================================================
--- gcc.orig/gcc/testsuite/g++.dg/ext/bitfield2.C 2010-11-11
18:00:57.000000000 +0100
+++ gcc/gcc/testsuite/g++.dg/ext/bitfield2.C 2011-04-12 14:32:33.112826500
+0200
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* Remove pedantic. Allow the GCC extension to use char for bitfields. */
/* { dg-options "" } */
-/* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
+/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target {
i?86-*-netware i?86-*-mingw* x86_64-*-mingw* } } } */
struct t /* { dg-message "note: offset of packed bit-field 't::b' has changed
in GCC 4.4" "" { target pcc_bitfield_type_matters } } */
{
Index: gcc/gcc/testsuite/g++.dg/ext/bitfield3.C
===================================================================
--- gcc.orig/gcc/testsuite/g++.dg/ext/bitfield3.C 2010-09-09
16:04:53.000000000 +0200
+++ gcc/gcc/testsuite/g++.dg/ext/bitfield3.C 2011-04-12 12:29:11.612455300
+0200
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-Wno-packed-bitfield-compat" } */
-/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target
i?86-*-netware } } */
+/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target {
i?86-*-netware i?86-*-mingw* x86_64-*-mingw* } } } */
struct t
{
Index: gcc/gcc/testsuite/g++.dg/ext/bitfield4.C
===================================================================
--- gcc.orig/gcc/testsuite/g++.dg/ext/bitfield4.C 2010-11-11
18:00:57.000000000 +0100
+++ gcc/gcc/testsuite/g++.dg/ext/bitfield4.C 2011-04-12 14:33:10.989636200
+0200
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "" } */
-/* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
+/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target {
i?86-*-netware i?86-*-mingw* x86_64-*-mingw* } } } */
struct t /* { dg-message "note: offset of packed bit-field 't::b' has changed
in GCC 4.4" "" { target pcc_bitfield_type_matters } } */
{
Index: gcc/gcc/testsuite/g++.dg/ext/bitfield5.C
===================================================================
--- gcc.orig/gcc/testsuite/g++.dg/ext/bitfield5.C 2010-09-09
16:04:52.000000000 +0200
+++ gcc/gcc/testsuite/g++.dg/ext/bitfield5.C 2011-04-12 14:33:35.115199800
+0200
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-Wno-packed-bitfield-compat" } */
-/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target
i?86-*-netware } } */
+/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target {
i?86-*-netware i?86-*-mingw* x86_64-*-mingw* } } } */
struct t
{
Index: gcc/gcc/testsuite/gcc.dg/bitfld-15.c
===================================================================
--- gcc.orig/gcc/testsuite/gcc.dg/bitfld-15.c 2010-11-11 18:00:57.000000000
+0100
+++ gcc/gcc/testsuite/gcc.dg/bitfld-15.c 2011-04-12 14:23:33.380789200
+0200
@@ -2,6 +2,7 @@
/* Remove pedantic. Allow the GCC extension to use char for bitfields. */
/* { dg-options "" } */
/* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
+/* { dg-options "-mno-ms-bitfields -Wno-packed-bitfield-compat" { target {
i?86-*-mingw* x86_64-*-mingw* } } } */
struct t
{
Index: gcc/gcc/testsuite/gcc.dg/bitfld-16.c
===================================================================
--- gcc.orig/gcc/testsuite/gcc.dg/bitfld-16.c 2010-09-09 16:02:35.000000000
+0200
+++ gcc/gcc/testsuite/gcc.dg/bitfld-16.c 2011-04-12 12:22:00.129163900
+0200
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-Wno-packed-bitfield-compat" } */
/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target
i?86-*-netware } } */
+/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target {
i?86-*-mingw* x86_64-*-mingw* } } } */
struct t
{
Index: gcc/gcc/testsuite/gcc.dg/bitfld-17.c
===================================================================
--- gcc.orig/gcc/testsuite/gcc.dg/bitfld-17.c 2010-11-11 18:00:57.000000000
+0100
+++ gcc/gcc/testsuite/gcc.dg/bitfld-17.c 2011-04-12 14:29:02.181541600
+0200
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "" } */
/* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
+/* { dg-options "-mno-ms-bitfields -Wno-packed-bitfield-compat" { target {
i?86-*-mingw* x86_64-*-mingw* } } } */
struct t
{
Index: gcc/gcc/testsuite/gcc.dg/bitfld-18.c
===================================================================
--- gcc.orig/gcc/testsuite/gcc.dg/bitfld-18.c 2010-09-09 16:02:30.000000000
+0200
+++ gcc/gcc/testsuite/gcc.dg/bitfld-18.c 2011-04-12 14:24:04.904792200
+0200
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-Wno-packed-bitfield-compat" } */
/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target
i?86-*-netware } } */
+/* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target {
i?86-*-mingw* x86_64-*-mingw* } } } */
struct t
{