This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 38/67] Constify some linespec functions
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 26 Sep 2017 13:17:12 +0100
- Subject: Re: [RFA 38/67] Constify some linespec functions
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9DD24D7121
- References: <20170921051023.19023-1-tom@tromey.com> <20170921051023.19023-39-tom@tromey.com> <3ee0e33a-422c-a0f0-33aa-e8c4aa207407@redhat.com> <87bmm2hxjc.fsf@tromey.com>
On 09/23/2017 05:03 AM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> In several places you followed a pattern like:
>
>>> static void
>>> -foo_command (char *args, int from_tty)
>>> +foo_command (char *args_in, int from_tty)
>
> Pedro> ... and then args_in wasn't used.
>
> Hmm... normally I think it should be used.
> Like in this patch (#38):
>
> -info_scope_command (char *args, int from_tty)
> +info_scope_command (char *args_in, int from_tty)
> ...
> - char *save_args = args;
> + const char *save_args = args_in;
> ...
> + const char *args = args_in;
>
I meant, used other than for immediately initializating a const version.
> Pedro> I'd be nice to mention in the commit log the reason for this.
> Pedro> I assume that it's because we don't have the corresponding
> Pedro> constified add_cmd variant?
>
> In this case I believe the reason is that info_scope_command could not
> be constified yet, because add_info isn't constified; but on the other
> hand it calls string_to_event_location, which is now constified, and it
> didn't seem worthwhile to overload that.
>
Makes sense, and that's exactly the sort of info I was looking for.
> I think all the cases *should* be things like this, but of course there
> may be errors.
Thanks,
Pedro Alves