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: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 21 May 2013 16:35:07 -0700
- 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>
On Tue, May 21, 2013 at 1:34 PM, Pedro Alves <palves@redhat.com> wrote:
> Building gdb on GNU/Linux, for --host=i586-pc-msdosdjgpp, I get:
>
> ../../src/gdb/dwarf2read.c: In function 'create_dwp_hash_table':
> ../../src/gdb/dwarf2read.c:8626:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
> ../../src/gdb/dwarf2read.c:8632:7: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' [-Werror=format]
> ../../src/gdb/dwarf2read.c: In function 'create_dwo_in_dwp':
> ../../src/gdb/dwarf2read.c:8754:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' [-Werror=format]
> ../../src/gdb/dwarf2read.c: In function 'open_and_init_dwp_file':
> ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Werror=format]
> ../../src/gdb/dwarf2read.c:9248:6: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format]
>
> And:
>
> $ grep uint32_t /usr/i586-pc-msdosdjgpp/sys-include/*
> /usr/i586-pc-msdosdjgpp/sys-include/stdint.h:typedef unsigned long uint32_t;
>
> Use pulongest rather than PRIu32, so that the translatable format
> string does not depend on host.
>
> Tested on F17. Also confirmed GDB still builds OK with --host=i686-w64-mingw32.
>
> gdb/
> 2013-05-21 Pedro Alves <palves@redhat.com>
>
> * dwarf2read.c (create_dwp_hash_table, create_dwo_in_dwp)
> (open_and_init_dwp_file): Use %s/pulongest instead of %u for
> printing uint32_t variables.
Lovely.
Although having to remember to use pulongest to print uint32_t sounds
like a never ending series of headaches.