Re-factor tree.h - Part 1

Jakub Jelinek jakub@redhat.com
Wed Nov 6 07:40:00 GMT 2013


On Wed, Nov 06, 2013 at 08:04:51AM +0100, Marc Glisse wrote:
> On Tue, 5 Nov 2013, Diego Novillo wrote:
> 
> >This is the first patch in a series of patches to cleanup tree.h to
> >reduce the exposure it has all over the compiler.
> >
> >In this patch, I'm moving functions that are used once into the files
> >that use them, and make them private to that file. These functions
> >were declared extern in tree.h and called from exactly one place.
> 
> I am not a big fan of doing it so automatically. For instance
> widest_int_cst_value should imho remain next to int_cst_value since
> they mostly share the same implementation. Doing this also doesn't
> promote code reuse: if I am looking for a function that does some
> basic operation on trees, I won't only need to look in the file that
> is semantically relevant, I'll also need to randomly grep through
> possible users to see if I should revert that part of your patch. On
> the other hand, most of those functions you move probably are better
> off in their new location, so you can ignore my post.

I have similar concern, the fact that some function is only used once so far
doesn't necessarily mean it is not useful for other places, and in that case
the patch makes code reuse harder and function duplication much more likely.

	Jakub



More information about the Gcc-patches mailing list