Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH c++ 05/12] guile: Constify gdbscm_with_guile return value
Date: Tue, 27 Oct 2015 17:35:00 -0000	[thread overview]
Message-ID: <m3eggg9uje.fsf@sspiff.org> (raw)
In-Reply-To: <CAFXXi0m1DjU2YQuEnuVk7ZVTHwTijZnUC902qeaw95ifDJCiWA@mail.gmail.com>	(Simon Marchi's message of "Mon, 26 Oct 2015 21:29:32 -0400")

Simon Marchi <simon.marchi@polymtl.ca> writes:
> On 26 October 2015 at 12:21, Doug Evans <xdje42@gmail.com> wrote:
>> The function comment for gdbscm_with_guile says:
>>
>> /* A wrapper around scm_with_guile that prints backtraces and exceptions
>>    according to "set guile print-stack".
>>    The result if NULL if no exception occurred, otherwise it is a statically
>>    allocated error message (caller must *not* free).  */
>>
>> If we're going to return an error message,
>> why make it a void * and not a char * (const as appropriate)?
>>
>> The lower level guile API uses a void * because it doesn't specify what
>> the result is. But in this use of it we do specify what the result is.
>
> It totally makes sense.  Here is the updated patch (probably garbled
> by gmail, sorry about that):
>
>
> From 2defdf7de52146ea7508d0dda2f0c59e7fdd42fe Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon dot marchi at polymtl dot ca>
> Date: Sun, 25 Oct 2015 23:46:37 -0400
> Subject: [PATCH] guile: Change return value of gdbscm_with_guile for const
>  char *
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The documentation of gdbscm_with_guile says that it returns a statically
> allocated string (IOW, a const char *).  We can reflect that in its
> return value type, and get rid of C++ build errors.
>
> Initially fixes:
>
> /home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c: In function
> ‘void* gdbscm_disasm_read_memory_worker(void*)’:
> /home/simark/src/binutils-gdb/gdb/guile/scm-disasm.c:93:12: error:
> invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
>      return "seek error";
>
> gdb/ChangeLog:
>
>     * guile/guile-internal.h (gdbscm_with_guile): Change return
>     types to const char *.
>     * guile/scm-safe-call.c (gdbscm_with_guile): Likewise.
>     (struct c_data) <func>: Likewise.
>     (struct c_data) <result>: Change type to const char *.
>     (scscm_eval_scheme_string): Change return type to
>     const char *.
>     (scscm_source_scheme_script): Likewise.
>     (gdbscm_safe_eval_string): Change type of result variable to
>     const char * and remove cast.
>     (gdbscm_safe_source_script): Likewise.
>     * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker):
>     Change return type to const char *.
>     (gdbscm_disasm_read_memory): Change type of status to
>     const char *.

LGTM.
Thanks!


  reply	other threads:[~2015-10-27 15:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26  3:49 [PATCH c++ 01/12] Introduce ax_raw_byte and use it Simon Marchi
2015-10-26  4:17 ` [PATCH c++ 03/12] ctf_xfer_partial: Return TARGET_XFER_E_IO instead of -1 on error Simon Marchi
2015-10-27  9:54   ` Simon Marchi
2015-10-26  5:24 ` [PATCH c++ 06/12] Fix constness problem in ioscm_make_gdb_stdio_port Simon Marchi
2015-10-26 12:40   ` Doug Evans
2015-10-26 18:36   ` Pedro Alves
2015-10-27  1:30     ` Simon Marchi
2015-10-27  1:55       ` Pedro Alves
2015-10-27  2:02         ` Doug Evans
2015-10-27  2:07           ` Simon Marchi
2015-10-26  5:27 ` [PATCH c++ 08/12] scm-symbol.c: Add (domain_enum) casts Simon Marchi
2015-10-26 12:55   ` Doug Evans
2015-10-26  5:29 ` [PATCH c++ 05/12] guile: Constify gdbscm_with_guile return value Simon Marchi
2015-10-26 11:45   ` Doug Evans
2015-10-26 17:39     ` Simon Marchi
2015-10-26 20:34       ` Doug Evans
2015-10-27  9:31         ` Simon Marchi
2015-10-27 17:35           ` Doug Evans [this message]
2015-10-28 14:59             ` Simon Marchi
2015-10-26  5:30 ` [PATCH c++ 09/12] stap-probe.c: Add casts Simon Marchi
2015-10-27  9:54   ` Simon Marchi
2015-10-26  5:32 ` [PATCH c++ 10/12] symtab.c: Add cast Simon Marchi
2015-10-26 12:55   ` Doug Evans
2015-10-26  7:53 ` [PATCH c++ 04/12] Add scm_t_dynwind_flags casts Simon Marchi
2015-10-27 14:59   ` Pedro Alves
2015-10-27 16:02     ` Simon Marchi
2015-10-26  8:17 ` [PATCH c++ 07/12] gdbscm_memory_port_write: use local variable to avoid adding casts Simon Marchi
2015-10-26 12:55   ` Doug Evans
2015-10-26 10:03 ` [PATCH c++ 02/12] ctf.c: Fix int/enum implicit cast Simon Marchi
2015-10-27 15:17   ` Pedro Alves
2015-10-27 17:11     ` Yao Qi
2015-10-27 17:14       ` Simon Marchi
2015-10-27 15:08 ` [PATCH c++ 01/12] Introduce ax_raw_byte and use it Pedro Alves
2015-10-27 16:55   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3eggg9uje.fsf@sspiff.org \
    --to=xdje42@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox