This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] dwarf2read.c: Don't assume uint32_t is unsigned int on all hosts.


On 05/22/2013 04:07 PM, Eli Zaretskii wrote:
>> Date: Wed, 22 May 2013 10:43:10 +0100
>> From: Pedro Alves <palves@redhat.com>
>> CC: gdb-patches <gdb-patches@sourceware.org>
>>
>> Hmm.  Grepping for PRIu in src/intl/ finds lots of hits.
> 
> They are all in the same single source file, at least in GDB 7.6.

Yeah.

>> Looks like gettext is doing some magic to deal with these.
> 
> No magic, just a lot of these:
> 
>   #if !defined PRIo32 || PRI_MACROS_BROKEN
>   # undef PRIo32
>   # define PRIo32 "o"
>   #endif
...

I actually meant this:

/* Expand a system dependent string segment.  Return NULL if unsupported.  */
static const char *
get_sysdep_segment_value (name)
     const char *name;
{
  /* Test for an ISO C 99 section 7.8.1 format string directive.
     Syntax:
     P R I { d | i | o | u | x | X }
     { { | LEAST | FAST } { 8 | 16 | 32 | 64 } | MAX | PTR }  */
  /* We don't use a table of 14 times 6 'const char *' strings here, because
     data relocations cost startup time.  */
  if (name[0] == 'P' && name[1] == 'R' && name[2] == 'I')
    {
      if (name[3] == 'd' || name[3] == 'i' || name[3] == 'o' || name[3] == 'u'
	  || name[3] == 'x' || name[3] == 'X')
	{
	  if (name[4] == '8' && name[5] == '\0')
	    {
	      if (name[3] == 'd')
		return PRId8;
	      if (name[3] == 'i')
		return PRIi8;
	      if (name[3] == 'o')
		return PRIo8;
	      if (name[3] == 'u')

I peeked at some .mo files in my system, and I see "PRIu64", etc.
there, so it seems gettext knows these macros are special.

I couldn't find much about it in the gettext manual, but

 http://www.gnu.org/software/gettext/manual/gettext.html#Marking

does contain a couple references to PRIuMAX.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]