This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 01/67] Add add_cmd function overloads


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]