guile: Add as_a_scm_t_subr
Commit Message
On 08/29/2015 08:55 PM, Doug Evans wrote:
> Pedro Alves <palves@redhat.com> writes:
>> Building GDB in C++ mode on Fedora 20, the gdb/guile/ code shows ~280
>> errors like:
>>
>> src/gdb/guile/guile.c:515:1: error: invalid conversion from ‘scm_unused_struct* (*)(SCM, SCM) {aka scm_unused_struct* (*)(scm_unused_struct*, scm_unused_struct*)}’ to ‘scm_t_subr {aka void*}’ [-fpermissive]
>>
>> This commit fixes them all.
>>
>> gdb/ChangeLog:
>> 2015-08-04 Pedro Alves <palves@redhat.com>
>>
>> * guile/guile-internal.h (as_a_scm_t_subr): New.
>> * guile/guile.c (misc_guile_functions): Use it.
>> * guile/scm-arch.c (arch_functions): Use it.
>> * guile/scm-block.c (block_functions, gdbscm_initialize_blocks):
>> Use it.
>> * guile/scm-breakpoint.c (breakpoint_functions): Use it.
>> * guile/scm-cmd.c (command_functions): Use it.
>> * guile/scm-disasm.c (disasm_functions): Use it.
>> * guile/scm-exception.c (exception_functions)
>> (private_exception_functions): Use it.
>> * guile/scm-frame.c (frame_functions)
>> * guile/scm-gsmob.c (gsmob_functions): Use it.
>> * guile/scm-iterator.c (iterator_functions): Use it.
>> * guile/scm-lazy-string.c (lazy_string_functions): Use it.
>> * guile/scm-math.c (math_functions): Use it.
>> * guile/scm-objfile.c (objfile_functions): Use it.
>> * guile/scm-param.c (parameter_functions): Use it.
>> * guile/scm-ports.c (port_functions, private_port_functions): Use
>> it.
>> * guile/scm-pretty-print.c (pretty_printer_functions): Use it.
>> * guile/scm-progspace.c (pspace_functions): Use it.
>> * guile/scm-string.c (string_functions): Use it.
>> * guile/scm-symbol.c (symbol_functions): Use it.
>> * guile/scm-symtab.c (symtab_functions): Use it.
>> * guile/scm-type.c (type_functions, gdbscm_initialize_types): Use
>> it.
>> * guile/scm-value.c (value_functions): Use it.
>
> LGTM.
>
Pushed with the line-wrap Simon noticed in his repost squashed
in, along with a fix for a typo I meanwhile had noticed.
(Actually, I see now that Simon noticed it too.)
Thanks,
Pedro Alves
From 1501445462a9d2c0ef0afca3262440b63b830cde Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Mon, 7 Sep 2015 19:15:06 +0100
Subject: [PATCH] guile: Add as_a_scm_t_subr
Fixes.
---
gdb/guile/guile-internal.h | 2 +-
gdb/guile/scm-arch.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
@@ -56,7 +56,7 @@ typedef struct
in some versions of guile, it is actually a typedef to "void *".
That means that in C++, an explicit cast is necessary to convert
function pointer to scm_t_subr. But a cast also makes it possible
- to pass function pointers with the wrong type my mistake. So
+ to pass function pointers with the wrong type by mistake. So
instead of adding such casts throughout, we use 'as_a_scm_t_subr'
to do the conversion, which (only) has overloads for function
pointer types that are valid.
@@ -579,7 +579,8 @@ of the architecture." },
Return the <gdb:type> object for the \"double\" type\n\
of the architecture." },
- { "arch-longdouble-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_longdouble_type),
+ { "arch-longdouble-type", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_arch_longdouble_type),
"\
Return the <gdb:type> object for the \"long double\" type\n\
of the architecture." },