On Fri, Jul 6, 2012 at 11:05 PM, Jason Merrill <ja...@redhat.com> wrote: > On 06/14/2012 04:13 PM, Sriraman Tallam wrote: >> >> C++ Frontend maintainers, Could you please take a look at the >> front-end part when you find the time? > > > It seems to me that what you have here are target-specific attributes that > affect the signature of a function such that they make two declarations > different that would otherwise declare the same function. Stepping away from > the specific notion of versioning, it seems that these are the questions > that you want the front end to be able to ask about these attributes: > > * Does this attribute affect a function signature?
The question becomes if a caller 'bar' with target attribute 'x' can make a call to a function 'foo' with an incompatible target attribute 'y'. If the answer is no, then the target attribute is part of 'foo's signature. I think the answer is yes -- the attribute affects a function signature. > * Do the attributes on these two declarations make them different? yes. > * Do the attributes on these two declarations make one a better match? yes -- and there are rules defined for that. > * Given a call to function X, should I call another function instead? The binding can happen at compile time (given caller/callee attribute) or at the runtime. > * Return a string representation of the attributes on this function that > affect its signature. yes. > > Does this seem like a worthwhile direction to other people, or do you like > better the approach the patch takes, handling versioning directly? There are prior discussions about this. The direct way of handling it is to use __builtin_dispatch, but we concluded that using function overloading is much more user friendly. Note that Intel's icc has a similar feature to the overloading approach implemented by Sri here. thanks, David > > Jason