From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20338 invoked by alias); 28 Nov 2001 07:08:28 -0000 Mailing-List: contact gdb-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 20250 invoked from network); 28 Nov 2001 07:08:11 -0000 Received: from unknown (HELO localhost.cygnus.com) (24.114.42.213) by hostedprojects.ges.redhat.com with SMTP; 28 Nov 2001 07:08:11 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id 68CDF3DC2; Wed, 28 Nov 2001 02:07:55 -0500 (EST) Message-ID: <3C048D4B.6050009@cygnus.com> Date: Sun, 18 Nov 2001 23:08:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.3) Gecko/20011020 X-Accept-Language: en-us MIME-Version: 1.0 To: Dan Nicolaescu Cc: gdb@sources.redhat.com Subject: Re: BYTE_BITFIELD in symtab.h References: <200111241235.aa09546@gremlin-relay.ics.uci.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2001-11/txt/msg00192.txt.bz2 Message-ID: <20011118230800.-3fx8WZu9C4US80r15T5j2X3KcREsddTwvDrKuzaxj4@z> > 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?