This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix invalid implicit conversions from void *
- From: Pedro Alves <palves at redhat dot com>
- To: Andreas Schwab <schwab at suse dot de>, gdb-patches at sourceware dot org
- Date: Thu, 19 May 2016 14:07:48 +0100
- Subject: Re: [PATCH] Fix invalid implicit conversions from void *
- Authentication-results: sourceware.org; auth=none
- References: <mvminya5hu9 dot fsf at hawking dot suse dot de>
On 05/19/2016 01:54 PM, Andreas Schwab wrote:
> Tested on ia64-suse-linux.
Thanks.
>
> * ia64-libunwind-tdep.c (libunwind_descr): Add cast from void *.
> (libunwind_frame_set_descr): Likewise.
> (libunwind_frame_cache): Likewise.
> (libunwind_frame_dealloc_cache): Likewise.
> (libunwind_frame_sniffer): Likewise.
> (libunwind_search_unwind_table): Likewise.
> (libunwind_sigtramp_frame_sniffer): Likewise.
> (libunwind_get_reg_special): Likewise.
> (libunwind_load): Likewise.
> * ia64-linux-nat.c (ia64_linux_fetch_register): Likewise.
> (ia64_linux_store_register): Likewise.
> (ia64_linux_xfer_partial): Likewise.
> * ia64-tdep.c (ia64_access_reg): Likewise.
> (ia64_access_fpreg): Likewise.
> (ia64_access_rse_reg): Likewise.
> (ia64_access_rse_fpreg): Likewise.
This is OK. Though ...
> /* Initialize pointers to the dynamic library functions we will use. */
>
> - unw_get_reg_p = dlsym (handle, get_reg_name);
> + unw_get_reg_p = ((int (*) (unw_cursor_t *, unw_regnum_t, unw_word_t *))
> + dlsym (handle, get_reg_name));
... I think would be nicer to use typedefs for these. Something like,
at the top:
-static int (*unw_get_reg_p) (unw_cursor_t *, unw_regnum_t, unw_word_t *);
+typedef int (unw_get_reg_p_ftype) (unw_cursor_t *, unw_regnum_t, unw_word_t *);
+static unw_get_reg_p_ftype *unw_get_reg_p;
etc.
and then:
unw_get_reg_p = (unw_get_reg_p_ftype *) dlsym (handle, get_reg_name);
It's what we've done in other similar cases, like linux-thread-db.c,
for example.
Thanks,
Pedro Alves