Re: [PATCH v4 3/9] add target method delegation

Pedro Alves
2013-12-17T16:17:08Z

On 12/16/2013 09:21 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
>>> 3. de_fault will be completely eliminated. INHERIT will be limited to
>>> the smallest possible list of fields, like to_shortname. Nearly
>>> every current_target method will simply delegate.
>
> Pedro> Sounds like the squashed target will end up mostly unused? It sounds
> Pedro> to me that even for those (data fields) we wouldn't need INHERIT. As
> Pedro> all targets have a name, e.g., target_shortname could be made a method
> Pedro> that returns the name of the currently topmost target in the stack
> Pedro> (not the squashed target).
>
> Yeah. The squashed target may still need to exist, or the debug target
> would have to be recast as a new stratum.

Yeah. It's always been silly that "set debug target" only works if
specified before opening/pushing the target.

>>> 5. Any given to_* method implementation will be guaranteed to be called
>>> with the target_ops with which it was registered. (This rule is
>>> handy on multi-target, where I split out the target_ops vtable from
>>> the object itself.)
>
> FWIW I wrote a script to add all the missing "this" arguments -- not
> just to target.h but to every method implementation in the tree.

Nice!

> This yields 103 patches -- one per converted method. (I may zap a few
> of these, the bulk of them seem to make sense...) I'm not quite sure
> how to submit it. I mean, email is doable, but it seems a bit large.
>

Yeah, not sure either... squash a few; post only the non-trivial
ones as email; post all of them at once anyway; split in 4 or
5 batches. Whatever really is fine with me.

> The nice thing about these refactorings is that the needed changes are
> usually trivial anyhow.

Yeah.

--
Pedro Alves