]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix -Wformat warnings in gnu-nat.c
authorYao Qi <yao@codesourcery.com>
Sun, 5 Jan 2014 11:37:27 +0000 (19:37 +0800)
committerYao Qi <yao@codesourcery.com>
Mon, 17 Feb 2014 03:25:37 +0000 (11:25 +0800)
commita9a758e3ee008b76613350cfc71b44dbe2167180
tree4c24561ff5d9c9ca798b600a5067b27d61a56f84
parent0ec36e11ee648a0bcf3f6aed0a636af29fc1f429
Fix -Wformat warnings in gnu-nat.c

I've seen some -Wformat warnings when build native gdb for hurd.

../../../git/gdb/gnu-nat.c:2384:8: error: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'vm_address_t' [-Werror=format]
../../../git/gdb/gnu-nat.c:2394:8: error: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'vm_address_t' [-Werror=format]
../../../git/gdb/gnu-nat.c: In function 'steal_exc_port':
../../../git/gdb/gnu-nat.c:2898:5: error: format '%d' expects argument of type 'int', but argument 2 has type 'mach_port_t' [-Werror=format]

in usr/include/mach/port.h, we have:

typedef vm_offset_t mach_port_t;

and in usr/include/mach/machine/vm_types.h, we have:

typedef       unsigned long   vm_offset_t;

so this patch changes '%d' to '%lu' in format string for mach_port_t
variables.

Similarly, in usr/include/mach/std_types.h, we have,

typedef      vm_offset_t     vm_address_t;

this patch also changes '%x' to '%lx' in gnu_write_inferior.

gdb:

2014-02-17  Yao Qi  <yao@codesourcery.com>

* gnu-nat.c (proc_get_exception_port): Use 'lu' insetad of 'd'
in format string.
(proc_steal_exc_port, make_proc, inf_set_pid): Likewise.
(inf_validate_procs, inf_signal): Likewise.
(S_exception_raise_request): Likewise.
(do_mach_notify_dead_name): Likewise.
(steal_exc_port): Likewise.
(gnu_read_inferior): Change 'copy_count''s type to
mach_msg_type_number_t.
(gnu_write_inferior): Likewise.  Use 'lx' instead of 'x' in
format string.
gdb/ChangeLog
gdb/gnu-nat.c