This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 01/67] Add add_cmd function overloads
- From: Pedro Alves <palves at redhat dot com>
- To: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>, Tom Tromey <tom at tromey dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 21 Sep 2017 11:25:17 +0100
- Subject: Re: [RFA 01/67] Add add_cmd function overloads
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.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 0369781E0A
- References: <20170921051023.19023-1-tom@tromey.com> <20170921051023.19023-2-tom@tromey.com> <A78C989F6D9628469189715575E55B2369606D8D@IRSMSX104.ger.corp.intel.com>
On 09/21/2017 08:02 AM, Metzger, Markus T wrote:
>> +void
>> +set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
>> +{
>> + if (cfunc == NULL)
>> + cmd->func = NULL;
>> + else
>> + cmd->func = do_const_cfunc;
>> + cmd->function.const_cfunc = cfunc; /* Ok. */
>> +}
>
> We shouldn't really have the NULL case, anymore. It is still possible but I don't expect it to be used. Should we assert CFUNC != NULL?
If that's possible, then it'd be nice to add ATTRIBUTE_NONNULL
on the declaration too.
>
> Should we also set CMD->FUNCTION.CFUNC to NULL?
I think not, because it's a union.
Thanks,
Pedro Alves