* BYTE_BITFIELD in symtab.h
@ 2001-11-11 21:40 Dan Nicolaescu
2001-11-27 23:08 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2001-11-11 21:40 UTC (permalink / raw)
To: gdb
Hi!
Is the following thing in symtab.h realy useful?
/* Don't do this; it means that if some .o's are compiled with GNU C
and some are not (easy to do accidentally the way we configure
things; also it is a pain to have to "make clean" every time you
want to switch compilers), then GDB dies a horrible death. */
/* GNU C supports enums that are bitfields. Some compilers don't. */
#if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
#define BYTE_BITFIELD :8;
#else
#define BYTE_BITFIELD /*nothing */
#endif
if BYTE_BITFIELD was defined to :8 the size of
"struct general_symbol_info" would decrease from 24 bytes to 20 bytes
for a tipical 32 bit machine.
And gdb uses quite a few of those...
Isn't the price payed for being able to switch compilers too high in
this case?
How common are compilers that don't support enum bitfields?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BYTE_BITFIELD in symtab.h
2001-11-27 23:08 ` Andrew Cagney
@ 2001-11-18 23:08 ` Andrew Cagney
2001-11-22 5:12 ` Dan Nicolaescu
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2001-11-18 23:08 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: gdb
> Hi!
>
> Is the following thing in symtab.h realy useful?
>
>
> /* Don't do this; it means that if some .o's are compiled with GNU C
> and some are not (easy to do accidentally the way we configure
> things; also it is a pain to have to "make clean" every time you
> want to switch compilers), then GDB dies a horrible death. */
> /* GNU C supports enums that are bitfields. Some compilers don't. */
> #if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
> #define BYTE_BITFIELD :8;
> #else
> #define BYTE_BITFIELD /*nothing */
> #endif
>
> if BYTE_BITFIELD was defined to :8 the size of
> "struct general_symbol_info" would decrease from 24 bytes to 20 bytes
> for a tipical 32 bit machine.
> And gdb uses quite a few of those...
>
> Isn't the price payed for being able to switch compilers too high in
> this case?
> How common are compilers that don't support enum bitfields?
Oh, what the heck I'll name names. ``gnu'' added this 1994-01-12 only to
have ``kingdon'' disable it less than a month later (1994-02-07). I
agree with JimK. I think that #if is nasty asking for trouble.
A quick glance at my (very old) tartan labs book suggests a compiler
need only support unsigned bit fields. If you think about it, that is
probably the only thing with vaguely well defined and fairly portable
semantics.
For the above my personal preference would be to zap that macro and then
investigate some explicit pack/unpack or explicit (i.e. no macro)
unsigned bitfields.
Fortuantly, that isn't my file :-)
enjoy,
Andrew
PS: JimB, did you know ``struct { unsigned :1; } foo'' is valid?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BYTE_BITFIELD in symtab.h
2001-11-27 23:08 ` Andrew Cagney
2001-11-18 23:08 ` Andrew Cagney
@ 2001-11-22 5:12 ` Dan Nicolaescu
2001-11-28 14:56 ` Dan Nicolaescu
1 sibling, 1 reply; 5+ messages in thread
From: Dan Nicolaescu @ 2001-11-22 5:12 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
Andrew Cagney <ac131313@cygnus.com> writes:
> > Hi!
> > Is the following thing in symtab.h realy useful?
> > /* Don't do this; it means that if some .o's are compiled with GNU C
> > and some are not (easy to do accidentally the way we configure
> > things; also it is a pain to have to "make clean" every time you
> > want to switch compilers), then GDB dies a horrible death. */
> > /* GNU C supports enums that are bitfields. Some compilers don't. */
> > #if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
> > #define BYTE_BITFIELD :8;
> > #else
> > #define BYTE_BITFIELD /*nothing */
> > #endif
> > if BYTE_BITFIELD was defined to :8 the size of
> > "struct general_symbol_info" would decrease from 24 bytes to 20 bytes
> > for a tipical 32 bit machine. And gdb uses quite a few of those...
> > Isn't the price payed for being able to switch compilers too high in
> > this case? How common are compilers that don't support enum
> > bitfields?
>
> Oh, what the heck I'll name names. ``gnu'' added this 1994-01-12 only
> to have ``kingdon'' disable it less than a month later (1994-02-07).
> I agree with JimK. I think that #if is nasty asking for trouble.
>
> A quick glance at my (very old) tartan labs book suggests a compiler
> need only support unsigned bit fields. If you think about it, that is
> probably the only thing with vaguely well defined and fairly portable
> semantics.
>
> For the above my personal preference would be to zap that macro and
> then investigate some explicit pack/unpack or explicit (i.e. no macro)
> unsigned bitfields.
FWIW gcc is using the following rtx_def in rtl.h
ENUM_BITFIELD(rtx_code) code: 16;
ENUM_BITFIELD is defined in system.h:
/* Be conservative and only use enum bitfields with GCC.
FIXME: provide a complete autoconf test for buggy enum bitfields. */
#if (GCC_VERSION > 2000)
#define ENUM_BITFIELD(TYPE) enum TYPE
#else
#define ENUM_BITFIELD(TYPE) unsigned int
#endif
Should gdb do the same?
> Fortuantly, that isn't my file :-)
>
> enjoy,
> Andrew
>
> PS: JimB, did you know ``struct { unsigned :1; } foo'' is valid?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BYTE_BITFIELD in symtab.h
2001-11-11 21:40 BYTE_BITFIELD in symtab.h Dan Nicolaescu
@ 2001-11-27 23:08 ` Andrew Cagney
2001-11-18 23:08 ` Andrew Cagney
2001-11-22 5:12 ` Dan Nicolaescu
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2001-11-27 23:08 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: gdb
> Hi!
>
> Is the following thing in symtab.h realy useful?
>
>
> /* Don't do this; it means that if some .o's are compiled with GNU C
> and some are not (easy to do accidentally the way we configure
> things; also it is a pain to have to "make clean" every time you
> want to switch compilers), then GDB dies a horrible death. */
> /* GNU C supports enums that are bitfields. Some compilers don't. */
> #if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
> #define BYTE_BITFIELD :8;
> #else
> #define BYTE_BITFIELD /*nothing */
> #endif
>
> if BYTE_BITFIELD was defined to :8 the size of
> "struct general_symbol_info" would decrease from 24 bytes to 20 bytes
> for a tipical 32 bit machine.
> And gdb uses quite a few of those...
>
> Isn't the price payed for being able to switch compilers too high in
> this case?
> How common are compilers that don't support enum bitfields?
Oh, what the heck I'll name names. ``gnu'' added this 1994-01-12 only to
have ``kingdon'' disable it less than a month later (1994-02-07). I
agree with JimK. I think that #if is nasty asking for trouble.
A quick glance at my (very old) tartan labs book suggests a compiler
need only support unsigned bit fields. If you think about it, that is
probably the only thing with vaguely well defined and fairly portable
semantics.
For the above my personal preference would be to zap that macro and then
investigate some explicit pack/unpack or explicit (i.e. no macro)
unsigned bitfields.
Fortuantly, that isn't my file :-)
enjoy,
Andrew
PS: JimB, did you know ``struct { unsigned :1; } foo'' is valid?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: BYTE_BITFIELD in symtab.h
2001-11-22 5:12 ` Dan Nicolaescu
@ 2001-11-28 14:56 ` Dan Nicolaescu
0 siblings, 0 replies; 5+ messages in thread
From: Dan Nicolaescu @ 2001-11-28 14:56 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
Andrew Cagney <ac131313@cygnus.com> writes:
> > Hi!
> > Is the following thing in symtab.h realy useful?
> > /* Don't do this; it means that if some .o's are compiled with GNU C
> > and some are not (easy to do accidentally the way we configure
> > things; also it is a pain to have to "make clean" every time you
> > want to switch compilers), then GDB dies a horrible death. */
> > /* GNU C supports enums that are bitfields. Some compilers don't. */
> > #if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
> > #define BYTE_BITFIELD :8;
> > #else
> > #define BYTE_BITFIELD /*nothing */
> > #endif
> > if BYTE_BITFIELD was defined to :8 the size of
> > "struct general_symbol_info" would decrease from 24 bytes to 20 bytes
> > for a tipical 32 bit machine. And gdb uses quite a few of those...
> > Isn't the price payed for being able to switch compilers too high in
> > this case? How common are compilers that don't support enum
> > bitfields?
>
> Oh, what the heck I'll name names. ``gnu'' added this 1994-01-12 only
> to have ``kingdon'' disable it less than a month later (1994-02-07).
> I agree with JimK. I think that #if is nasty asking for trouble.
>
> A quick glance at my (very old) tartan labs book suggests a compiler
> need only support unsigned bit fields. If you think about it, that is
> probably the only thing with vaguely well defined and fairly portable
> semantics.
>
> For the above my personal preference would be to zap that macro and
> then investigate some explicit pack/unpack or explicit (i.e. no macro)
> unsigned bitfields.
FWIW gcc is using the following rtx_def in rtl.h
ENUM_BITFIELD(rtx_code) code: 16;
ENUM_BITFIELD is defined in system.h:
/* Be conservative and only use enum bitfields with GCC.
FIXME: provide a complete autoconf test for buggy enum bitfields. */
#if (GCC_VERSION > 2000)
#define ENUM_BITFIELD(TYPE) enum TYPE
#else
#define ENUM_BITFIELD(TYPE) unsigned int
#endif
Should gdb do the same?
> Fortuantly, that isn't my file :-)
>
> enjoy,
> Andrew
>
> PS: JimB, did you know ``struct { unsigned :1; } foo'' is valid?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-11-28 22:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-11 21:40 BYTE_BITFIELD in symtab.h Dan Nicolaescu
2001-11-27 23:08 ` Andrew Cagney
2001-11-18 23:08 ` Andrew Cagney
2001-11-22 5:12 ` Dan Nicolaescu
2001-11-28 14:56 ` Dan Nicolaescu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox