This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Don't pack a typedef of a struct
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 16 Jul 2003 06:24:00 -0400 (EDT)
- Subject: Re: [PATCH]: Don't pack a typedef of a struct
On Wed, 16 Jul 2003, Nathan Sidwell wrote:
> this patch stops you trying to apply a packed attribute to a typedef
> of a struct - only the underlying struct can be packed.
>
> I also discovered that when you do pack a struct by placing the packed
> attribute after the closing '}', any variants of that struct will
> not have a packed flag set. There is no test case for that, but a C++ patch
> & test I'm about to provide will test that functionality.
>
> booted & tested on i686-pc-linux-gnu, ok?
>int ary1[sizeof (struct p1) == sizeof (p1_t1)];
>int ary2[sizeof (struct p2) == sizeof (p2_t1)];
>int ary3[sizeof (struct p1) == sizeof (struct p2)];
Typos. Should attempt to have size -1 for the error cases,
because "int x[0];" compiles. The code compiles without your
patch! (cross to mmix-knuth-mmixware, which should be
irrelevant) Perhaps you forgot to run the test before your
patch too.
BTW those dg-warnings could just as well be dg-error:s; a fault
of the dg machinery as Joseph (and others before) has pointed
out.
brgds, H-P