This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH/RFC] sim: common: add PRI printf defines
- From: Doug Evans <dje at google dot com>
- To: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 23 Jun 2015 15:07:16 -0500
- Subject: Re: [PATCH/RFC] sim: common: add PRI printf defines
- Authentication-results: sourceware.org; auth=none
- References: <1434909729-6766-1-git-send-email-vapier at gentoo dot org> <CADPb22Tr-=zZb=d0bccRTgythwJaCc73ZV7=oiJD_DChqLPdbA at mail dot gmail dot com> <20150623162145 dot GI17734 at vapier> <CADPb22R0hOWqxqO4FWOZNSsBsSmv9SBe45uQovpSr2if-g09Hg at mail dot gmail dot com> <20150623195832 dot GK17734 at vapier>
On Tue, Jun 23, 2015 at 2:58 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 23 Jun 2015 11:28, Doug Evans wrote:
>> On Tue, Jun 23, 2015 at 11:21 AM, Mike Frysinger wrote:
>> > On 22 Jun 2015 17:29, Doug Evans wrote:
>> >> On Sun, Jun 21, 2015 at 1:02 PM, Mike Frysinger wrote:
>> >> > Keeping track of the right printf formats for the various types can be
>> >> > a pretty big hassle, especially in common code which has to support a
>> >> > variety of bitsizes. Take a page from the existing standards and add
>> >> > a set of PRI macros which hide the details in a common header.
>> >> > ---
>> >> > sim/common/ChangeLog | 8 ++++++++
>> >> > sim/common/sim-types.h | 21 +++++++++++++++++++++
>> >> > 2 files changed, 29 insertions(+)
>> >> >
>> >> > diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
>> >> > index 722ad98..db67a1d 100644
>> >> > --- a/sim/common/ChangeLog
>> >> > +++ b/sim/common/ChangeLog
>> >> > @@ -1,5 +1,13 @@
>> >> > 2015-06-21 Mike Frysinger <vapier@gentoo.org>
>> >> >
>> >> > + * sim-types.h (_SIM_PRI_TB, __SIM_PRI_TB): New helper macros for
>> >> > + expanding target bitsizes into standard PRI formats.
>> >> > + (PRI_TW, PRIiTW, PRIxTW): New PRI target word defines.
>> >> > + (PRI_TA, PRIiTA, PRIxTA): New PRI target address defines.
>> >> > + (PRI_TF, PRIiTF, PRIxTF): New PRI target floating point defines.
>> >> > +
>> >>
>> >> It's not that big a deal, but _[_A-Z]+ is reserved for the compiler.
>> >
>> > i'm aware of that rule, but it hasn't really stopped us in the code base from
>> > using the _xxx namespace. the sim-bits.h header in particular uses this to mark
>> > the internal macros as such.
>> >
>> > i'm certainly open to a diff convention of clearly conveying "this is internal"
>> > if gdb has such a thing. although it too uses _xxx in a few places :).
>>
>> How about a rule saying to avoid _[_A-Z] going forward,
>> and we'll fix the existing cases if/when we get to them.
>> ?
>
> what's the proposed replacement ? :)
>
> GDB__XXX & SIM__XXX ?
> -mike
Hi.
I didn't want to impose anything, sometimes the leading _ can just be removed.
For the current patch, SIM__XXX is fine with me.
[if it's important to use something that denotes these as being local
to the file.
Anything beginning with SIM_ would be fine I think.]