@@ -28,6 +28,32 @@ Extensions:
2828
2929//===---------------------------------------------------------------------===//
3030
31+ When we go to reimplement <tgmath.h>, we should do it more intelligently than
32+ the GCC-supplied header. EDG has an interesting __generic builtin that provides
33+ overloading for C:
34+ http://www.edg.com/docs/edg_cpp.pdf
35+
36+ For example, they have:
37+ #define sin(x) __generic(x,,, sin, sinf, sinl, csin, csinf,csinl)(x)
38+
39+ It's unclear to me why you couldn't just have a builtin like:
40+ __builtin_overload(1, arg1, impl1, impl2, impl3)
41+ __builtin_overload(2, arg1, arg2, impl1, impl2, impl3)
42+ __builtin_overload(3, arg1, arg2, arg3, impl1, impl2, impl3)
43+
44+ Where the compiler would just pick the right "impl" based on the arguments
45+ provided. One nasty detail is that some arithmetic promotions most be done for
46+ use by the tgmath.h stuff, but it would be nice to be able to handle vectors
47+ etc as well without huge globs of macros. With the above scheme, you could
48+ use:
49+
50+ #define sin(x) __builtin_overload(1, x, sin, sinf, sinl, csin, csinf,csinl)(x)
51+
52+ and not need to keep track of which argument to "__generic" corresponds to which
53+ type, etc.
54+
55+ //===---------------------------------------------------------------------===//
56+
3157To time GCC preprocessing speed without output, use:
3258 "time gcc -MM file"
3359This is similar to -Eonly.
0 commit comments