c++/10366: Unable to apply __attribute__ ((packed)) to an enum

dberger@motorola.com dberger@motorola.com
Wed Apr 9 21:26:00 GMT 2003


>Number:         10366
>Category:       c++
>Synopsis:       Unable to apply __attribute__ ((packed)) to an enum
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 09 21:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     dberger@motorola.com
>Release:        2.93.5, 3.2-3
>Organization:
>Environment:
Any
>Description:
The following syntax works fine for the C fe, but not for the C++ fe:

typedef enum
{
  ZERO,
  ONE
} __attribute__ ((packed)) packedEnum;

How are you supposed to do it in C++?
>How-To-Repeat:

>Fix:
Fix C++ parser to accept attributes in enums
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="junk.c"
Content-Disposition: inline; filename="junk.c"

volatile unsigned long i;

typedef enum
{
  ZERO,
  ONE
} __attribute__ ((packed)) packedEnum;

void test(void)
{

  i = (((i & 0xf0) >> 4) >= 14);
  i = ((i & 0xf0) >= (14 << 4));
}



More information about the Gcc-bugs mailing list