From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12180 invoked by alias); 23 Feb 2011 15:12:54 -0000 Received: (qmail 12169 invoked by uid 22791); 23 Feb 2011 15:12:52 -0000 X-SWARE-Spam-Status: No, hits=0.0 required=5.0 tests=AWL,BAYES_50,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.155) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Feb 2011 15:12:46 +0000 Received: from md2.u-strasbg.fr (md2.u-strasbg.fr [IPv6:2001:660:2402::187]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p1NFCfVv079300 ; Wed, 23 Feb 2011 16:12:41 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms4.u-strasbg.fr [130.79.204.13]) by md2.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p1NFCfPS053826 ; Wed, 23 Feb 2011 16:12:41 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p1NFCehu099671 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Wed, 23 Feb 2011 16:12:41 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Kai Tietz'" Cc: "'Binutils'" References: <-8460070221060995487@unknownmsgid> <-6930711422310680743@unknownmsgid> <4D63D49D.90101@redhat.com> In-Reply-To: Subject: RE: [RFC patch]: Adjust the use of 'long' type in dwarf2.h header Date: Wed, 23 Feb 2011 15:12:00 -0000 Message-ID: <000301cbd36c$1c8c3330$55a49990$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00281.txt.bz2 Kai, please excuse me for asking this so late, but I don't really understand why you had to introduce a new 'dwarf_vma' type when we already have a 'bfd_signed_vma' type that must be signed 64-bit as soon as=20 BFD64 macro is defined... See definitions in bfd/bfd-in.h or bfd/bfd-in2.h This macro should be set if any of the supported target is a 64-bit target so it should be possible to use that type, no? But of course, I might be missing some important point, could you please explain to me in which case a 64-bit dwarf_vma could be necessary without BFD64 being set. Pierre Muller GDB pascal language maintainer > -----Message d'origine----- > De=A0: binutils-owner@sourceware.org [mailto:binutils- > owner@sourceware.org] De la part de Kai Tietz > Envoy=E9=A0: mercredi 23 f=E9vrier 2011 10:00 > =C0=A0: Nick Clifton > Cc=A0: Pierre Muller; GCC Patches; Binutils; gdb; Jakub Jelinek; Joel > Brobecker > Objet=A0: Re: [RFC patch]: Adjust the use of 'long' type in dwarf2.h > header >=20 > 2011/2/22 Nick Clifton : > > Hi Kai, > > > > > >> So this version uses new function dwarf_vma_print function for > >> printf-messages, which are getting localized. > >> > >> Tested for x86_64-w64-mingw32 and x86_64-pc-linux-gnu. Ok for apply? > > > >> +static const char * > >> +dwarf_vma_print (const char *fmtch, bfd_vma value) > > > > I think that I prefer your suggestion of dwarf_vmatoa. > > > >> +{ > >> + =A0static int buf_pos =3D 0; > >> + =A0static struct dwarf_vma_print_buf { > >> + =A0 =A0char place[64]; > >> + =A0} buf[16]; > > > > Ideally you should have a comment here explaining why you have an > array of > > these string buffers. > > > >> + =A0char fmt[32]; > >> + =A0char *ret; > >> + > >> + =A0sprintf (fmt, "%%%s%s", BFD_VMA_FMT, fmtch); > >> + =A0ret =3D &buf[buf_pos++].place[0]; > > > > Or, more simply: > > > > =A0ret =3D buf[buf_pos++].place; > > > >> + =A0buf_pos &=3D 15; > > > > That "15" should be: "ARRAY_SIZE (buf) - 1", and it would be safer to > write: > > > > =A0buf_pos %=3D ARRAY_SIZE (buf); > > > > and leave it to the compiler to optimize this into an AND operation > if it > > can. > > > >> snprintf (ret, 64, fmt, value); > > > > And the "64" here should be "sizeof (buf[0].place)". > > > > Cheers > > =A0Nick > > > > >=20 > Hello Nick, >=20 > adjust the binutils part as you suggested. Applied to binutils and gcc > (rev. 170433) tree. >=20 > Regards, > Kai