From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1373 invoked by alias); 16 Nov 2004 07:19:49 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1293 invoked from network); 16 Nov 2004 07:19:41 -0000 Received: from unknown (HELO krynn.se.axis.com) (212.209.10.221) by sourceware.org with SMTP; 16 Nov 2004 07:19:41 -0000 Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.83.5.18]) by krynn.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id iAG7JeAD013581; Tue, 16 Nov 2004 08:19:40 +0100 Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id iAG7JedD002705; Tue, 16 Nov 2004 08:19:40 +0100 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id iAG7JeQe002701; Tue, 16 Nov 2004 08:19:40 +0100 Date: Tue, 16 Nov 2004 07:19:00 -0000 Message-Id: <200411160719.iAG7JeQe002701@ignucius.se.axis.com> From: Hans-Peter Nilsson To: cagney@gnu.org CC: hans-peter.nilsson@axis.com, gdb-patches@gcc.gnu.org In-reply-to: <41922FBC.7020309@gnu.org> (message from Andrew Cagney on Wed, 10 Nov 2004 10:11:56 -0500) Subject: Re: [RFA:] sim-config.c: When having a bfd, don't just check bfd_little_endian X-SW-Source: 2004-11/txt/msg00328.txt.bz2 > Date: Wed, 10 Nov 2004 10:11:56 -0500 > From: Andrew Cagney > > Index: sim-config.c > > =================================================================== > > RCS file: /cvs/src/src/sim/common/sim-config.c,v > > retrieving revision 1.2 > > diff -c -p -r1.2 sim-config.c > > *** sim-config.c 23 Nov 2002 01:12:05 -0000 1.2 > > --- sim-config.c 9 Nov 2004 19:41:07 -0000 > > *************** sim_config (SIM_DESC sd) > > *** 146,152 **** > > SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); > > > > /* extract all relevant information */ > > ! if (STATE_PROG_BFD (sd) == NULL) > > prefered_target_byte_order = 0; > > else > > prefered_target_byte_order = (bfd_little_endian(STATE_PROG_BFD (sd)) > > --- 146,156 ---- > > SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); > > > > /* extract all relevant information */ > > ! if (STATE_PROG_BFD (sd) == NULL > > ! /* If we have a binary input file (presumably with specified > > ! "--architecture"), it'll have no endianness. */ > > ! || (!bfd_little_endian (STATE_PROG_BFD (sd)) > > ! && !bfd_big_endian (STATE_PROG_BFD (sd)))) > > Yes, although this three way case better expressed using a switch. Not one I see, not without looking at bfd private data abfd->xvec->byteorder or introducing a multi-valued accessor for the bfd endian data or expressing it awkwardly along the lines of: switch (2 * (bfd_little_endian (STATE_PROG_BFD (sd) != false)) + (bfd_big_endian (STATE_PROG_BFD (sd) != false))) ... > Change it before committing if you care. Since you made it optional I committed as-is; I didn't see an obvious and simple way to better express it as a switch. brgds, H-P