Turn check macros into functions. (issue6188088)

Diego Novillo dnovillo@google.com
Wed May 16 13:40:00 GMT 2012


On 12-05-16 09:27 , Richard Guenther wrote:

>> There's less typing if you use the template variant.  Not sure why
>> you say there is less type safety with templates.
>
> Because it accepts any type as tree argument?

Yes and no.  It accepts any type that responds to tree
operations and has the same fields.

>> No, templated functions must always stay in the header file.
>> There is no changing that.
>
> If they ain't templates they are not templates.  And thus do not
> need to stay in the header.  Not sure what you are after here ;)

I think we are talking past each other.  I simply stated that function
templates must stay in headers.  There's no export template, after all.

I'm not defending the choice of using templates for these particular 
functions.  That's something for Lawrence to argue.

I am simply curious as to how using the template variant produces
slightly smaller code.

>> Two bootstrapped compilers built exactly the same, except one was
>> using the template version, the other using the straight inline
>> functions with const_tree parameters and CONST_CAST_TREE in return
>> values.
>
> That's of course not exactly the same.  The checking fns should be
> able to unconditionally use const_tree anyway.

Sorry, I don't know what you are after.  I was comparing two compilers
that only differ in how they implement the tree checking functions.  One 
uses templates, the other uses inline functions taking const_tree (not 
even static inline, just inline).

They are bootstrapped compilers, so -fkeep-inline-functions is not used.
What do you think I should have compared?


Diego.



More information about the Gcc-patches mailing list