[cfe-commits] tgmath.h
Chris Lattner
clattner at apple.com
Tue Feb 17 14:18:00 PST 2009
cc-ing cfe-commits
On Feb 17, 2009, at 1:16 PM, Howard Hinnant wrote:
> On Feb 17, 2009, at 1:44 PM, Chris Lattner wrote:
>
>> When you get the header done, just send it to me and I'll commit it.
>
> I've enclosed the header. I've barely tested it, only with the
> preprocessor. I looked for other header tests and couldn't find
> any. And I couldn't figure out how to create an executable. It
> "compiles" without warnings and the preprocess looks like what I
> think it should.
Daniel can help you with this.
> The current design "leaks" 3 macros:
>
> __tg_promote1
> __tg_promote2
> __tg_promote3
>
> If that's a problem I could expand those macros manually in each
> function. I don't consider the leak a problem since these names are
> within our namespace.
Yep, I think that is fine.
> Although I don't know of any bugs, if they're in there, they are
> probably simple type-o's that will be obvious in how to fix (lots
> and lots of repetition).
Ok!
I tried my silly overload case. Unfortunately, we get a pretty ugly
output now:
t.c:3:30: error: no matching function for call to '__tg_promote'
double test(int *X) { return acos(X); }
^~~~~~~
/Users/sabre/llvm/Debug/Headers/tgmath.h:87:29: note: instantiated from:
#define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:53:50: note: instantiated from:
#define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
^
In file included from t.c:1:
/Users/sabre/llvm/Debug/Headers/tgmath.h:51:40: note: candidate function
static long double _Complex _TG_ATTRSp __tg_promote(long double
_Complex);
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:50:40: note: candidate function
static double _Complex _TG_ATTRSp __tg_promote(double _Complex);
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:49:40: note: candidate function
static float _Complex _TG_ATTRSp __tg_promote(float _Complex);
^
... a bunch more __tg_promotes.
t.c:3:30: error: type name requires a specifier or qualifier
double test(int *X) { return acos(X); }
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:87:29: note: instantiated from:
#define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:53:68: note: instantiated from:
#define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
^
t.c:3:30: error: call to '__tg_acos' is ambiguous
double test(int *X) { return acos(X); }
^~~~~~~
/Users/sabre/llvm/Debug/Headers/tgmath.h:87:19: note: instantiated from:
#define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
^
In file included from t.c:1:
/Users/sabre/llvm/Debug/Headers/tgmath.h:84:5: note: candidate function
__tg_acos(long double _Complex __x) {return cacosl(__x);}
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:80:5: note: candidate function
__tg_acos(double _Complex __x) {return cacos(__x);}
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:76:5: note: candidate function
__tg_acos(float _Complex __x) {return cacosf(__x);}
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:72:5: note: candidate function
__tg_acos(long double __x) {return acosl(__x);}
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:68:5: note: candidate function
__tg_acos(double __x) {return acos(__x);}
^
/Users/sabre/llvm/Debug/Headers/tgmath.h:64:5: note: candidate function
__tg_acos(float __x) {return acosf(__x);}
^
21 diagnostics generated.
Would it be possible to silence to tg_promote diagnostics by adding a
version that takes ...?
-Chris
More information about the cfe-commits
mailing list