Re: C PATCH for c/52085 (enum forward declarations and attribute packed)

2015-04-24 Thread Jeff Law
On 04/24/2015 05:36 AM, Marek Polacek wrote: On Thu, Apr 23, 2015 at 08:25:51PM -0600, Jeff Law wrote: What happens if we have used the enum inside an aggregate? Can we just blindly change the alignment/precision like that? If you just forward declare an enum/struct, it has an incomplete type

Re: C PATCH for c/52085 (enum forward declarations and attribute packed)

2015-04-24 Thread Marek Polacek
On Thu, Apr 23, 2015 at 08:25:51PM -0600, Jeff Law wrote: > What happens if we have used the enum inside an aggregate? Can we just > blindly change the alignment/precision like that? If you just forward declare an enum/struct, it has an incomplete type, so you cannot use it inside an aggregate.

Re: C PATCH for c/52085 (enum forward declarations and attribute packed)

2015-04-23 Thread Jeff Law
On 04/23/2015 02:46 PM, Marek Polacek wrote: This PR points out a problem with enum forward declarations (so C++ is out as these are forbidden in C++). If we forward declare an enum, and later on declare the enum with __attribute__ ((packed)), the attribute is ignored. The reason is that when

C PATCH for c/52085 (enum forward declarations and attribute packed)

2015-04-23 Thread Marek Polacek
This PR points out a problem with enum forward declarations (so C++ is out as these are forbidden in C++). If we forward declare an enum, and later on declare the enum with __attribute__ ((packed)), the attribute is ignored. The reason is that when we first see the forward declaration, parser_xr