diff options
author | Pedro Alves <palves@redhat.com> | 2015-10-27 17:25:09 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-10-27 17:33:01 +0000 |
commit | b80c3053162ec5533e120ee4e4ed30296d4c5fb2 (patch) | |
tree | d9ee9703b487e999a1f3c4d47fbf756bd6cec9d0 /gdb/common | |
parent | d09f2c3fc15dd4491e9cfa455191045c0729a3c3 (diff) | |
download | gdb-b80c3053162ec5533e120ee4e4ed30296d4c5fb2.zip gdb-b80c3053162ec5533e120ee4e4ed30296d4c5fb2.tar.gz gdb-b80c3053162ec5533e120ee4e4ed30296d4c5fb2.tar.bz2 |
Make host_address_to_string/gdb_print_host_address cast parameter to 'void *'
Fixes a set of errors like:
../../src/gdb/symfile-debug.c: In function ‘int debug_qf_map_symtabs_matching_filename(objfile*, const char*, const char*, int (*)(symtab*, void*), void*)’:
../../src/gdb/symfile-debug.c:137:39: error: invalid conversion from ‘int (*)(symtab*, void*)’ to ‘const void*’ [-fpermissive]
host_address_to_string (callback),
^
Note this has to work with data and function pointers. In C++11 we
may perhaps do something a bit safer, but we're not there yet, and I
don't think it really matters. For now just always do a simple
C-style cast in host_address_to_string itself. No point in adding a
void * cast to each and every caller.
gdb/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* common/print-utils.c (host_address_to_string): Rename to ...
(host_address_to_string_1): ... this.
* common/print-utils.h (host_address_to_string): Reimplement as
wrapper around host_address_to_string_1.
* utils.c (gdb_print_host_address): Rename to ...
(gdb_print_host_address_1): ... this.
* utils.h (gdb_print_host_address): Reimplement as wrapper macro
around host_address_to_string_1.
Diffstat (limited to 'gdb/common')
-rw-r--r-- | gdb/common/print-utils.c | 2 | ||||
-rw-r--r-- | gdb/common/print-utils.h | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gdb/common/print-utils.c b/gdb/common/print-utils.c index 1c1a5c1..7eba07d 100644 --- a/gdb/common/print-utils.c +++ b/gdb/common/print-utils.c @@ -316,7 +316,7 @@ core_addr_to_string_nz (const CORE_ADDR addr) /* See print-utils.h. */ const char * -host_address_to_string (const void *addr) +host_address_to_string_1 (const void *addr) { char *str = get_cell (); diff --git a/gdb/common/print-utils.h b/gdb/common/print-utils.h index 8d16966..49bc09a 100644 --- a/gdb/common/print-utils.h +++ b/gdb/common/print-utils.h @@ -65,6 +65,10 @@ extern const char *core_addr_to_string (const CORE_ADDR addr); extern const char *core_addr_to_string_nz (const CORE_ADDR addr); -extern const char *host_address_to_string (const void *addr); +extern const char *host_address_to_string_1 (const void *addr); + +/* Wrapper that avoids adding a pointless cast to all callers. */ +#define host_address_to_string(ADDR) \ + host_address_to_string_1 ((const void *) (ADDR)) #endif /* COMMON_CELLS_H */ |