[cfe-commits] tgmath.h

Howard Hinnant hhinnant at apple.com
Wed Feb 18 07:48:38 PST 2009


On Feb 18, 2009, at 2:10 AM, Douglas Gregor wrote:

> On Feb 17, 2009, at 3:30 PM, Howard Hinnant wrote:
>> Oh, and:
>>
>> -------------
>> none of the above:
>> -------------
>> 81 lines of output starting with:
>>
>> test.c:7:8: error: no matching function for call to '__tg_promote'
>>   x = acos(x);
>>       ^~~~~~~
>> ./tgmath.h:88:29: note: instantiated from:
>> #define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
>>
>> :-)
>
> I just added some more toys that should help improve this. First of  
> all, I wired up the Objective-C "unavailable" attribute so that it  
> works like a C++0x deleted function, e.g.,
>
> 	void f(int) __attribute__((__unavailable__));
>
> 	f(5); // error: called an unavailable function
>
> Second, we now allow "overloadable" functions in C to be variadic  
> without any named parameters, e.g., this is well-formed
>
> 	void f(...) __attribute__((__overloaded__));
>
> I'm sure that'll help improve the diagnostics in tgmath.h :)
>
> 	- Doug

That did help.  I'm not set up with write access.

Index: lib/Headers/tgmath.h
===================================================================
--- lib/Headers/tgmath.h	(revision 64913)
+++ lib/Headers/tgmath.h	(working copy)
@@ -37,6 +37,7 @@

  // promotion

+static void __tg_promote(...)  
__attribute__((__unavailable__,__overloadable__));
  static double               _TG_ATTRSp __tg_promote(int);
  static double               _TG_ATTRSp __tg_promote(unsigned int);
  static double               _TG_ATTRSp __tg_promote(long);

-Howard




More information about the cfe-commits mailing list