OSDN Git Service

* config/i386/i386.c (ix86_handle_struct_attribute): Use the proper
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Apr 2012 08:11:57 +0000 (08:11 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Apr 2012 08:11:57 +0000 (08:11 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186959 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 8a93313..996ab01 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-27  Richard Guenther  <rguenther@suse.de>
 
        PR c/51527
index 35f2ac5..80b2439 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-09  Mike Stump  <mikestump@comcast.net>
 
        * a-assert.ads: Remove execute permission.
index 062df3a..83ed782 100644 (file)
@@ -704,6 +704,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 6949587..50ca8bf 100644 (file)
@@ -31898,8 +31898,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);