[cfe-commits] tgmath.h

Howard Hinnant hhinnant at apple.com
Tue Feb 17 15:05:51 PST 2009


On Feb 17, 2009, at 5:37 PM, Chris Lattner wrote:

>
> On Feb 17, 2009, at 2:29 PM, Howard Hinnant wrote:
>
>>>
>>> Would it be possible to silence to tg_promote diagnostics by  
>>> adding a version that takes ...?
>>
>> I know how to solve this neatly in C++. ;-)
>>
>> Oh, well, I note that if I add:
>>
>> static void                 _TG_ATTRSp __tg_promote(void);
>>
>> the error message gets *a little* better.
>>
>> 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))
>>
>>
>> "..." doesn't work as I get:
>>
>> ./tgmath.h:40:53: error: ISO C requires a named argument before '...'
>> static void                 _TG_ATTRSp __tg_promote(...);
>>
>>
>> I'll keep looking for a better solution...
>
> does () work?  () is roughly equivalent to (...) in C++.


Using:

#include "tgmath.h"

int main()
{
    double* x = 0;
    x = acos(x);
    return 0;
}

(void) works better than () and () works better than (...).  Don't ask  
me to explain it... :-)

-------------
Using (...):
-------------
153 lines of output starting with:

In file included from test.c:1:
./tgmath.h:40:53: error: ISO C requires a named argument before '...'
static void                 _TG_ATTRSp __tg_promote(...);
                                                     ^
./tgmath.h:41:40: error: conflicting types for '__tg_promote'
static double               _TG_ATTRSp __tg_promote(int);

-------------
Using ():
-------------
150 lines of output starting with:

In file included from test.c:1:
./tgmath.h:41:40: error: conflicting types for '__tg_promote'
static double               _TG_ATTRSp __tg_promote(int);
                                        ^
./tgmath.h:40:40: note: previous declaration is here
static void                 _TG_ATTRSp __tg_promote();
                                        ^
-------------
Using (void):
-------------
84 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))

-Howard




More information about the cfe-commits mailing list