Commit 224bb373 by Mumit Khan Committed by Jeff Law

c-pragma.c (push_alignment): Don't ignore alignments greater than 4 bytes.

        * c-pragma.c (push_alignment): Don't ignore alignments greater than
        4 bytes.
        (insert_pack_attributes): Take into account member natural
        alignment.

From-SVN: r27648
parent 90e72e20
Mon Jun 21 05:33:15 1999 Mumit Khan <khan@xraylith.wisc.edu> Mon Jun 21 05:33:15 1999 Mumit Khan <khan@xraylith.wisc.edu>
* c-pragma.c (push_alignment): Don't ignore alignments greater than
4 bytes.
(insert_pack_attributes): Take into account member natural
alignment.
* i386/winnt.c (exports_head): New static variable. * i386/winnt.c (exports_head): New static variable.
(i386_pe_record_exported_symbol): New function. (i386_pe_record_exported_symbol): New function.
(i386_pe_asm_file_end): Use. (i386_pe_asm_file_end): Use.
......
...@@ -141,7 +141,7 @@ pop_alignment (id) ...@@ -141,7 +141,7 @@ pop_alignment (id)
{ {
entry = alignment_stack->prev; entry = alignment_stack->prev;
if (entry == NULL || entry->alignment > 4) if (entry == NULL)
maximum_field_alignment = 0; maximum_field_alignment = 0;
else else
maximum_field_alignment = entry->alignment * 8; maximum_field_alignment = entry->alignment * 8;
...@@ -163,6 +163,7 @@ insert_pack_attributes (node, attributes, prefix) ...@@ -163,6 +163,7 @@ insert_pack_attributes (node, attributes, prefix)
tree * prefix; tree * prefix;
{ {
tree a; tree a;
int field_alignment;
/* If we are not packing, then there is nothing to do. */ /* If we are not packing, then there is nothing to do. */
if (maximum_field_alignment == 0 if (maximum_field_alignment == 0
...@@ -173,12 +174,16 @@ insert_pack_attributes (node, attributes, prefix) ...@@ -173,12 +174,16 @@ insert_pack_attributes (node, attributes, prefix)
if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd' if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd'
|| TREE_CODE (node) != FIELD_DECL) || TREE_CODE (node) != FIELD_DECL)
return; return;
field_alignment = TYPE_ALIGN (TREE_TYPE (node));
if (field_alignment <= 0 || field_alignment > maximum_field_alignment)
field_alignment = maximum_field_alignment;
/* Add a 'packed' attribute. */ /* Add a 'packed' attribute. */
* attributes = tree_cons (get_identifier ("packed"), NULL, * attributes); * attributes = tree_cons (get_identifier ("packed"), NULL, * attributes);
/* If the alignment is > 8 then add an alignment attribute as well. */ /* If the alignment is > 8 then add an alignment attribute as well. */
if (maximum_field_alignment > 8) if (field_alignment > 8)
{ {
/* If the aligned attribute is already present then do not override it. */ /* If the aligned attribute is already present then do not override it. */
for (a = * attributes; a; a = TREE_CHAIN (a)) for (a = * attributes; a; a = TREE_CHAIN (a))
...@@ -201,7 +206,7 @@ insert_pack_attributes (node, attributes, prefix) ...@@ -201,7 +206,7 @@ insert_pack_attributes (node, attributes, prefix)
* attributes = tree_cons * attributes = tree_cons
(get_identifier ("aligned"), (get_identifier ("aligned"),
tree_cons (NULL, tree_cons (NULL,
build_int_2 (maximum_field_alignment / 8, 0), build_int_2 (field_alignment / 8, 0),
NULL), NULL),
* attributes); * attributes);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment