public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: mrs@wrs.com (Mike Stump)
To: egcs@cygnus.com
Subject: m68k structure packing
Date: Tue, 30 Sep 1997 12:08:00 -0000	[thread overview]
Message-ID: <199709301908.MAA01711@kankakee.wrs.com> (raw)

Could you fold in this work from the FSF sources?  Thanks.


Fri Sep 26 14:06:45 1997  Mike Stump  <mrs@wrs.com>

	* c-decl.c (start_struct): Ensure that structs with forward
	declarations are in fact packed when -fpack-struct is given.

Wed Sep 24 11:31:24 1997  Mike Stump  <mrs@wrs.com>

	* stor-layout.c (layout_record): Ignore STRUCTURE_SIZE_BOUNDARY if
	we are packing a structure.  This allows a structure with only
	bytes to be aligned on a byte boundary and have no padding on a
	m68k.

Index: stor-layout.c
===================================================================
RCS file: /folk/mrs/.cvsroot/egcs/gcc/stor-layout.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -p -r1.1.1.1 -r1.2
*** stor-layout.c	1997/08/15 18:56:53	1.1.1.1
--- stor-layout.c	1997/09/24 18:41:48	1.2
*************** layout_record (rec)
*** 306,316 ****
       tree rec;
  {
    register tree field;
- #ifdef STRUCTURE_SIZE_BOUNDARY
-   unsigned record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec));
- #else
    unsigned record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
- #endif
    /* These must be laid out *after* the record is.  */
    tree pending_statics = NULL_TREE;
    /* Record size so far is CONST_SIZE + VAR_SIZE bits,
--- 306,312 ----
*************** layout_record (rec)
*** 324,329 ****
--- 320,330 ----
       that we know VAR_SIZE has.  */
    register int var_align = BITS_PER_UNIT;
  
+ #ifdef STRUCTURE_SIZE_BOUNDARY
+   /* Packed structures don't need to have minimum size.  */
+   if (! TYPE_PACKED (rec))
+     record_align = MAX (record_align, STRUCTURE_SIZE_BOUNDARY);
+ #endif
  
    for (field = TYPE_FIELDS (rec); field; field = TREE_CHAIN (field))
      {
*************** layout_union (rec)
*** 563,579 ****
       tree rec;
  {
    register tree field;
- #ifdef STRUCTURE_SIZE_BOUNDARY
-   unsigned union_align = STRUCTURE_SIZE_BOUNDARY;
- #else
    unsigned union_align = BITS_PER_UNIT;
- #endif
  
    /* The size of the union, based on the fields scanned so far,
       is max (CONST_SIZE, VAR_SIZE).
       VAR_SIZE may be null; then CONST_SIZE by itself is the size.  */
    register int const_size = 0;
    register tree var_size = 0;
  
    /* If this is a QUAL_UNION_TYPE, we want to process the fields in
       the reverse order in building the COND_EXPR that denotes its
--- 564,582 ----
       tree rec;
  {
    register tree field;
    unsigned union_align = BITS_PER_UNIT;
  
    /* The size of the union, based on the fields scanned so far,
       is max (CONST_SIZE, VAR_SIZE).
       VAR_SIZE may be null; then CONST_SIZE by itself is the size.  */
    register int const_size = 0;
    register tree var_size = 0;
+ 
+ #ifdef STRUCTURE_SIZE_BOUNDARY
+   /* Packed structures don't need to have minimum size.  */
+   if (! TYPE_PACKED (rec))
+     union_align = STRUCTURE_SIZE_BOUNDARY;
+ #endif
  
    /* If this is a QUAL_UNION_TYPE, we want to process the fields in
       the reverse order in building the COND_EXPR that denotes its
Index: c-decl.c
===================================================================
RCS file: /folk/mrs/.cvsroot/egcs/gcc/c-decl.c,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -c -p -r1.1.1.4 -r1.2
*** c-decl.c	1997/09/16 02:07:07	1.1.1.4
--- c-decl.c	1997/09/26 21:09:25	1.2
*************** start_struct (code, name)
*** 5527,5532 ****
--- 5527,5533 ----
    if (ref && TREE_CODE (ref) == code)
      {
        C_TYPE_BEING_DEFINED (ref) = 1;
+       TYPE_PACKED (ref) = flag_pack_struct;
        if (TYPE_FIELDS (ref))
  	error ((code == UNION_TYPE ? "redefinition of `union %s'"
  		: "redefinition of `struct %s'"),
------

             reply	other threads:[~1997-09-30 12:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-30 12:08 Mike Stump [this message]
1997-09-30 12:57 ` Charles M. Hannum
1997-09-30 19:58 ` Jim Wilson
1997-09-30 21:13   ` Richard Henderson
1997-09-30 21:22   ` Jim Wilson
1997-10-01 15:14 ` Jim Wilson
1997-09-30 13:32 Mike Stump
1997-09-30 14:56 ` Jim Wilson
1997-09-30 16:58 Mike Stump
1997-09-30 18:20 ` Jim Wilson
1997-10-01  9:02   ` Peter Barada
1997-09-30 20:16 Mike Stump
1997-09-30 22:03 ` Jeffrey A Law
1997-09-30 21:42 Jim Wilson
1997-10-01  5:44 ` Kamil Iskra
1997-10-01 12:16 Mike Stump
1997-10-01 12:39 ` Joel Sherrill
1997-10-02 18:37 ` Jim Wilson
1997-10-01 15:08 Mike Stump
1997-10-01 15:56 ` Peter Barada
1997-10-01 16:16   ` Per Bothner
1997-10-02 20:14     ` Jim Wilson
1997-10-02  6:49   ` Paul Koning
1997-10-02 20:09   ` Jim Wilson
1997-10-02 20:01 ` Jim Wilson
1997-10-02 21:40   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199709301908.MAA01711@kankakee.wrs.com \
    --to=mrs@wrs.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).