[cfe-commits] tgmath.h

Howard Hinnant hhinnant at apple.com
Wed Feb 18 10:29:53 PST 2009


On Feb 18, 2009, at 12:48 PM, Douglas Gregor wrote:

>> Nice.  The '\' confused me at first, but seems harmless enough.
>
> I guess we could give the attribute a named macro, e.g.,
>
> static _Argument_type_is_not_arithmetic __tg_promote(...)  
> __ATTRACT_BAD_TGMATH_ARG
>
> ?

Or just remove the '\' ?  Not that I really care. :-)

Curious:  Does it have a function?

>
>
>>> We're recovering badly from failures when calling __tg_promote.  
>>> I'm working on some parser/sema tweaks to improve the situation,  
>>> and will send an updated error message when it's done.
>
> Here's what we get now when we try to take the sine of a pointer to  
> short:
>
> tgmath_test.c:4:3: error: call to function '__tg_promote' that has  
> been intentionally made unavailable
>  sin(sp);
>  ^~~~~~~
> ./tgmath.h:293:27: note: instantiated from:
> #define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
>                          ^
> ./tgmath.h:56:50: note: instantiated from:
> #define __tg_promote1(__x)           (__typeof__(__tg_promote(__x)))
>                                                 ^
> In file included from tgmath_test.c:1:
> ./tgmath.h:41:41: note: unavailable function is declared here
> static _Argument_type_is_not_arithmetic __tg_promote(...) \
>                                        ^
> 2 diagnostics generated.

Nice!

-Howard




More information about the cfe-commits mailing list