[cfe-dev] Proposed change to __builtin_overload

Douglas Gregor dgregor at apple.com
Mon Feb 9 06:07:57 PST 2009


Hi Chris,

On Feb 9, 2009, at 12:55 AM, Chris Lattner wrote:

> I've been pondering on tgmath.h, but it is more evil than I thought.
> As such, I'd like to extend __builtin_overload like this:
> http://clang.llvm.org/docs/LanguageExtensions.html#__builtin_overload
>
> The basic problem is that tgmath doesn't follow standard arithmetic
> promotion rules.  For example fmax(int, float) is supposed to call the
> double version of fmax, not the float version as normal promotion
> rules would specify.
>
> Because I couldn't find a non-evil approach to handling this (e.g.
> with builtin_classify_type like GCC does) I just decided to allow a
> fixed set of programmable promotion rules.  This way, we can support
> any craziness in altivec.h, support the standard promotion rules, and
> support tgmath.h all in one framework.

I'll say this: it's the least horrible __builtin I've seen that  
supports tgmath.h, and better than most. That first string argument  
will *definitely* help diagnostics.

	- Doug



More information about the cfe-dev mailing list