This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] dwarf2read.c: Don't assume uint32_t is unsigned int on all hosts.
- From: Pedro Alves <palves at redhat dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: dje at google dot com, gdb-patches at sourceware dot org
- Date: Wed, 22 May 2013 16:34:22 +0100
- Subject: Re: [PATCH] dwarf2read.c: Don't assume uint32_t is unsigned int on all hosts.
- References: <20130521203421 dot 23721 dot 93618 dot stgit at brno dot lan> <CADPb22TzeQEanUGOMcFBJrStDYkk5zRUE2Fht_c_d5mQAYM7sw at mail dot gmail dot com> <519C932E dot 7000601 at redhat dot com> <83k3mrt5nu dot fsf at gnu dot org>
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