This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC v2] Unnecessary argument METHOD to valops.c:find_oload_champ?
- From: Siva Chandra <sivachandra at google dot com>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Fri, 28 Feb 2014 15:20:59 -0800
- Subject: Re: [RFC v2] Unnecessary argument METHOD to valops.c:find_oload_champ?
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gzMXpgtCCanBPB0hdo=f0GEqmJaFz+TKFYvv0CGccjNkA at mail dot gmail dot com> <CADPb22Q3VXYo+Hp5GcZFKE2w4hsvu_ZREcdEqGR3xS3MftkVKQ at mail dot gmail dot com>
On Fri, Feb 28, 2014 at 12:33 PM, Doug Evans <dje@google.com> wrote:
> On Fri, Feb 28, 2014 at 6:33 AM, Siva Chandra <sivachandra@google.com> wrote:
>> Realized I did not update function comment in v1. Attached v2 which
>> includes a typo fix and updates the function comment.
>>
>> v1 posting: https://sourceware.org/ml/gdb-patches/2014-02/msg00833.html
>>
>> ChangeLog
>> 2014-02-28 Siva Chandra Reddy <sivachandra@google.com>
>>
>> * valops.c (find_oload_champ): Remove unneccesary argument METHOD
>> (find_overload_match): Update call to find_oload_champ.
>> (find_oload_champ_namespace_loop): Likewise
>>
>> Thanks,
>> Siva Chandra
>
> Hi.
>
> Ok with me, with one nit:
>
> I'd collapse this into just a single assert:
>
> gdb_assert ((fns_ptr != NULL) + (oload_syms != NULL) == 1).
>
> ---
> + int domain_count = (fns_ptr != NULL? 1 : 0) + (oload_syms != NULL ? 1 : 0);
> [...]
> + /* A champion can be found among methods alone, or among functions
> + alone, but not both. */
> + gdb_assert (domain_count == 1);
>
> Thanks!
>
> Btw, I see room for more cleanups.
>
> E.g., oload_method_static could use some TLC.
> - it's passed an enum for the method arg where we assume non-zero
> values are correct
> - IWBN to delete its method arg too
> - its result feels like it's intended to be true/false, but it's used
> as an integer
> (rename function to oload_method_static_offset ?)
>
> I wouldn't make them part of the current patch, and feel free to pass.
> But since you're in the neighborhood ... :-)