This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa] save space by using enum bitfields
- From: Jim Blandy <jimb at redhat dot com>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: ac131313 at redhat dot com, drow at mvista dot com, ezannoni at redhat dot com,gdb-patches at sources dot redhat dot com, msnyder at redhat dot com
- Date: 19 Aug 2003 16:58:13 -0500
- Subject: Re: [rfa] save space by using enum bitfields
- References: <200308191938.h7JJcED0023548@duracef.shout.net>
Michael Elizabeth Chastain <mec@shout.net> writes:
> Rats, I found a bug in my patch. Too bad you didn't approve it
> before I found the bug. :)
>
> The bug is that the old code has some of this:
>
> struct minimal_symbol
> {
> ...
> enum minimal_symbol_type { ... } type BYTE_BITFIELD;
> ...
> };
>
> My patch has this:
>
> struct minimal_symbol
> {
> ...
> enum minimal_symbol_type { ... };
> BITFIELD_ENUM(minimal_symbol_type) type : 8
> ...
> };
>
> gcc 3.3.1 emits warnings for the declaration of enum inside struct.
> And gcc 3.2-7-rh emits errors for this!
I did notice that, actually, and went looking through the ISO C spec
to see whether it was kosher. ISO C says that there are only four
kinds of scope: function, block, file, and prototype. So those enums
should have file scope, which is what you want.
But if GCC doesn't like it, okay. *shrug*