aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-10-27 17:25:09 +0000
committerPedro Alves <palves@redhat.com>2015-10-27 17:33:01 +0000
commitb80c3053162ec5533e120ee4e4ed30296d4c5fb2 (patch)
treed9ee9703b487e999a1f3c4d47fbf756bd6cec9d0 /gdb/utils.h
parentd09f2c3fc15dd4491e9cfa455191045c0729a3c3 (diff)
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/utils.h')
-rw-r--r--gdb/utils.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index 995a1cfb8e..e1f3827cac 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -246,7 +246,11 @@ extern void fputstrn_unfiltered (const char *str, int n, int quotr,
extern int filtered_printing_initialized (void);
/* Display the host ADDR on STREAM formatted as ``0x%x''. */
-extern void gdb_print_host_address (const void *addr, struct ui_file *stream);
+extern void gdb_print_host_address_1 (const void *addr, struct ui_file *stream);
+
+/* Wrapper that avoids adding a pointless cast to all callers. */
+#define gdb_print_host_address(ADDR, STREAM) \
+ gdb_print_host_address_1 ((const void *) ADDR, STREAM)
/* Convert CORE_ADDR to string in platform-specific manner.
This is usually formatted similar to 0x%lx. */