[i386,mingw,g++.dg,gcc.dg] : Set -mms-bitfields as default for native windows targets

Submitted by Kai Tietz on April 12, 2011, 12:47 p.m.

Details

Message ID BANLkTim30Qgovfpwu2kAP0mio_1x2ntftQ@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz April 12, 2011, 12:47 p.m.
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

Comments

Richard Henderson April 12, 2011, 5:46 p.m.
On 04/12/2011 05:47 AM, Kai Tietz wrote:
> 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.

Ok.


r~
Kai Tietz April 12, 2011, 6:53 p.m.
2011/4/12 Richard Henderson <rth@redhat.com>:
> On 04/12/2011 05:47 AM, Kai Tietz wrote:
>> 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.
>
> Ok.
>
>
> r~
>


Applied at revision 172336.

Thanks,
Kai
Pedro Alves April 13, 2011, 10:36 a.m.
On Tuesday 12 April 2011 19:53:42, Kai Tietz wrote:
> 2011/4/12 Richard Henderson <rth@redhat.com>:
> > On 04/12/2011 05:47 AM, Kai Tietz wrote:
> >> 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.
> >
> > Ok.
> >
> >
> > r~
> >
> 
> 
> Applied at revision 172336.
> 
> Thanks,
> Kai
> 

This is a default ABI change (IIRC, when the option was
introduced, it was left off as default so to not break the ABI).

Shouldn't we advertise it somewhere?
Kai Tietz April 13, 2011, 10:43 a.m.
2011/4/13 Pedro Alves <pedro@codesourcery.com>:
> On Tuesday 12 April 2011 19:53:42, Kai Tietz wrote:
>> 2011/4/12 Richard Henderson <rth@redhat.com>:
>> > On 04/12/2011 05:47 AM, Kai Tietz wrote:
>> >> 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.
>> >
>> > Ok.
>> >
>> >
>> > r~
>> >
>>
>>
>> Applied at revision 172336.
>>
>> Thanks,
>> Kai
>>
>
> This is a default ABI change (IIRC, when the option was
> introduced, it was left off as default so to not break the ABI).
>
> Shouldn't we advertise it somewhere?
>
> --
> Pedro Alves
>

Yes, I did recently a lot of abi changing for mingw's targets.  They
all will need a nice description (and possible ways to get old default
behavior) in changes.html

I collect them for later.  Or do you mean it should be noted earlier?

Regards,
Kai
Pedro Alves April 13, 2011, 10:49 a.m.
On Wednesday 13 April 2011 11:43:43, Kai Tietz wrote:
> > This is a default ABI change (IIRC, when the option was
> > introduced, it was left off as default so to not break the ABI).
> >
> > Shouldn't we advertise it somewhere?

> Yes, I did recently a lot of abi changing for mingw's targets.  They
> all will need a nice description (and possible ways to get old default
> behavior) in changes.html
> 
> I collect them for later.  Or do you mean it should be noted earlier?

As long as it's mentioned somewhere before a release, that's fine
with me.

(Though mentioning changes as you do them has better chances of
something not getting forgotten, or in case you end up
unavailable.  Hope not! :-) )
Dave Korn Nov. 8, 2011, 6:55 p.m.
On 13/04/2011 11:49, Pedro Alves wrote:
> On Wednesday 13 April 2011 11:43:43, Kai Tietz wrote:
>>> This is a default ABI change (IIRC, when the option was
>>> introduced, it was left off as default so to not break the ABI).
>>>
>>> Shouldn't we advertise it somewhere?
> 
>> Yes, I did recently a lot of abi changing for mingw's targets.  They
>> all will need a nice description (and possible ways to get old default
>> behavior) in changes.html
>>
>> I collect them for later.  Or do you mean it should be noted earlier?
> 
> As long as it's mentioned somewhere before a release, that's fine
> with me.
> 
> (Though mentioning changes as you do them has better chances of
> something not getting forgotten, or in case you end up
> unavailable.  Hope not! :-) )

  Now we're coming up for a release.... did this happen?

    cheers,
      DaveK

Patch hide | download patch | download mbox

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
 {