i386.c (ix86_handle_struct_attribute): Use the proper predicate to discriminate types.
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 30 Apr 2012 08:11:42 +0000 (08:11 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 30 Apr 2012 08:11:42 +0000 (08:11 +0000)
* config/i386/i386.c (ix86_handle_struct_attribute): Use the proper
predicate to discriminate types.
ada/
* gcc-interface/utils.c (finish_record_type): Force the traditional GCC
layout for bitfields on the type if it is packed or has a representation
clause and an alternate layout is available.

From-SVN: r186958

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/config/i386/i386.c

index 5d5149e2786375cd2e16e1ddfce594b93d05f066..86a2f2d01dbae4c551d6c4e5138da371a3a657bb 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-30  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * config/i386/i386.c (ix86_handle_struct_attribute): Use the proper
+       predicate to discriminate types.
+
 2012-04-30  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * doc/invoke.texi (Wmissing-format-attribute): Document as an
index e8421391e63c4d15dfc0b2c3022784a0d19493ab..838e4d0f6a8acc54accf32c20f624dd7abba6eb7 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-30  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/utils.c (finish_record_type): Force the traditional GCC
+       layout for bitfields on the type if it is packed or has a representation
+       clause and an alternate layout is available.
+
 2012-04-30  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/gigi.h (mark_out_of_scope): Delete.
index 123c3a5705c3a6ea6b7c36bcab524a898cb24292..03d7cb011aab4c31dfd44210ef3cd35294755cb0 100644 (file)
@@ -721,6 +721,19 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
         case where there is a rep clause but all fields have errors and
         no longer have a position.  */
       TYPE_SIZE (record_type) = 0;
+
+      /* Ensure we use the traditional GCC layout for bitfields when we need
+        to pack the record type or have a representation clause.  The other
+        possible layout (Microsoft C compiler), if available, would prevent
+        efficient packing in almost all cases.  */
+#ifdef TARGET_MS_BITFIELD_LAYOUT
+      if (TARGET_MS_BITFIELD_LAYOUT && TYPE_PACKED (record_type))
+       decl_attributes (&record_type,
+                        tree_cons (get_identifier ("gcc_struct"),
+                                   NULL_TREE, NULL_TREE),
+                        ATTR_FLAG_TYPE_IN_PLACE);
+#endif
+
       layout_type (record_type);
     }
 
index a34c68c418e7e69628cb54a39b91a60876cd8da1..903683e3500e6c8e4cb3ce03fd181e7eab9a6711 100644 (file)
@@ -32465,8 +32465,7 @@ ix86_handle_struct_attribute (tree *node, tree name,
   else
     type = node;
 
-  if (!(type && (TREE_CODE (*type) == RECORD_TYPE
-                || TREE_CODE (*type) == UNION_TYPE)))
+  if (!(type && RECORD_OR_UNION_TYPE_P (*type)))
     {
       warning (OPT_Wattributes, "%qE attribute ignored",
               name);