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

RFA: Add test for targets that use MS style bitfields


Hi Janis,

  I would like to add a new proc to target-supports.exp to check for
  targets that use Microsoft style bitfields, and then use this check
  to suppress tests that depend upon GCC's default behaviour.

  This is intended primarily for the new RX target which uses MS style
  bitfields (unconditionally - it is a requirement of the ABI).

  Tested with an rx-elf toolchain and an i686-pc-linux-gnu toolchain.
  There were no regressions for the i686 toolchain and several fixed
  testsuite failures for the rx toolchain.

  OK to apply ?

Cheers
  Nick

gcc/testsuite/ChangeLog
2009-11-03  Nick Clifton  <nickc@redhat.com>

	* lib/target-supports.exp (proc
	check_effective_target_non_ms_bitfield_layout): New proc.
        * gcc.dg/bitfld-18.c: Add a requirement for non-ms bitfield
	layout.
        * gcc.dg/bitfld-15.c: Likewise.
        * gcc.dg/bitfld-16.c: Likewise.
        * gcc.dg/bitfld-17.c: Likewise.
        * g++.dg/ext/bitfield5.C: Likewise.
        * g++.dg/ext/bitfield2.C: Likewise.
        * g++.dg/ext/bitfield3.C: Likewise.
        * g++.dg/ext/bitfield4.C: Likewise.
        * g++.dg/abi/bitfield5.C: Likewise.

Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp	(revision 153851)
+++ testsuite/lib/target-supports.exp	(working copy)
@@ -552,6 +552,16 @@
     }]
 }
 
+# Return 1 if target defines TARGET_MS_BITFIELD_LAYOUT_P to false.
+
+proc check_effective_target_non_ms_bitfield_layout { } {
+    return [check_no_compiler_messages non_ms_bitfield_layout assembly {
+	struct foo1 { int x:4; short y:4; };
+        struct foo2 { int z:8; };
+        int s[sizeof (struct foo1) == sizeof (struct foo2) ? 1 : -1];
+    }]
+}
+
 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
 
 proc check_effective_target_tls {} {

Index: testsuite/gcc.dg/bitfld-18.c
===================================================================
--- testsuite/gcc.dg/bitfld-18.c	(revision 153851)
+++ testsuite/gcc.dg/bitfld-18.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* { dg-options "-Wno-packed-bitfield-compat" } */
 /* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target i?86-*-netware } } */

Index: testsuite/gcc.dg/bitfld-15.c
===================================================================
--- testsuite/gcc.dg/bitfld-15.c	(revision 153851)
+++ testsuite/gcc.dg/bitfld-15.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* Remove pedantic.  Allow the GCC extension to use char for bitfields.  */
 /* { dg-options "" } */
 /* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */

Index: testsuite/gcc.dg/bitfld-16.c
===================================================================
--- testsuite/gcc.dg/bitfld-16.c	(revision 153851)
+++ testsuite/gcc.dg/bitfld-16.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* { dg-options "-Wno-packed-bitfield-compat" } */
 /* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target i?86-*-netware } } */
 
Index: testsuite/gcc.dg/bitfld-17.c
===================================================================
--- testsuite/gcc.dg/bitfld-17.c	(revision 153851)
+++ testsuite/gcc.dg/bitfld-17.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* { dg-options "" } */
 /* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
 
Index: testsuite/g++.dg/ext/bitfield5.C
===================================================================
--- testsuite/g++.dg/ext/bitfield5.C	(revision 153851)
+++ testsuite/g++.dg/ext/bitfield5.C	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* { dg-options "-Wno-packed-bitfield-compat" } */
 /* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target i?86-*-netware } } */
 
Index: testsuite/g++.dg/ext/bitfield2.C
===================================================================
--- testsuite/g++.dg/ext/bitfield2.C	(revision 153851)
+++ testsuite/g++.dg/ext/bitfield2.C	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* Remove pedantic.  Allow the GCC extension to use char for bitfields.  */
 /* { dg-options "" } */
 /* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
Index: testsuite/g++.dg/ext/bitfield3.C
===================================================================
--- testsuite/g++.dg/ext/bitfield3.C	(revision 153851)
+++ testsuite/g++.dg/ext/bitfield3.C	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* { dg-options "-Wno-packed-bitfield-compat" } */
 /* { dg-options "-Wno-packed-bitfield-compat -mno-ms-bitfields" { target i?86-*-netware } } */
 
Index: testsuite/g++.dg/ext/bitfield4.C
===================================================================
--- testsuite/g++.dg/ext/bitfield4.C	(revision 153851)
+++ testsuite/g++.dg/ext/bitfield4.C	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target non_ms_bitfield_layout } */
 /* { dg-options "" } */
 /* { dg-options "-mno-ms-bitfields" { target i?86-*-netware } } */
 
Index: testsuite/g++.dg/abi/bitfield5.C
===================================================================
--- testsuite/g++.dg/abi/bitfield5.C	(revision 153851)
+++ testsuite/g++.dg/abi/bitfield5.C	(working copy)
@@ -1,4 +1,5 @@
 // { dg-do compile } 
+// { dg-require-effective-target non_ms_bitfield_layout }
 // { dg-options "-Wabi -fabi-version=1" }
 // { dg-options "-Wabi -fabi-version=1 -mno-ms-bitfields" { target i?86-*-* x86_64-*-* } }
 


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