From patchwork Mon Sep 7 18:39:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 8593 Received: (qmail 99387 invoked by alias); 7 Sep 2015 18:40:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 99371 invoked by uid 89); 7 Sep 2015 18:39:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 07 Sep 2015 18:39:58 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 75FDEC18F6C9; Mon, 7 Sep 2015 18:39:57 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t87IdsOn003374; Mon, 7 Sep 2015 14:39:55 -0400 Message-ID: <55EDD9FA.3040908@redhat.com> Date: Mon, 07 Sep 2015 19:39:54 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Doug Evans CC: gdb-patches@sourceware.org, Simon Marchi Subject: Re: [PATCH] guile: Add as_a_scm_t_subr References: <1438679998-15113-1-git-send-email-palves@redhat.com> In-Reply-To: On 08/29/2015 08:55 PM, Doug Evans wrote: > Pedro Alves 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 >> >> * 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 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(-) diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h index ca5f1c0..017309a 100644 --- a/gdb/guile/guile-internal.h +++ b/gdb/guile/guile-internal.h @@ -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. diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c index 1e15127..9a1a922 100644 --- a/gdb/guile/scm-arch.c +++ b/gdb/guile/scm-arch.c @@ -579,7 +579,8 @@ of the architecture." }, Return the 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 object for the \"long double\" type\n\ of the architecture." },