[Mesa-dev] [PATCH 1/4] mesa: move fpclassify work-arounds into c99_math.h

Brian Paul brianp at vmware.com
Wed Mar 11 08:48:49 PDT 2015


On 03/11/2015 08:20 AM, Brian Paul wrote:
> On 03/11/2015 01:23 AM, Jose Fonseca wrote:
>> On 11/03/15 01:41, Brian Paul wrote:
>>> ---
>>>   include/c99_math.h          | 52
>>> +++++++++++++++++++++++++++++++++++++++++++++
>>>   src/mesa/main/querymatrix.c | 51
>>> +-------------------------------------------
>>>   2 files changed, 53 insertions(+), 50 deletions(-)
>>>
>>> diff --git a/include/c99_math.h b/include/c99_math.h
>>> index 0a49950..f1a6685 100644
>>> --- a/include/c99_math.h
>>> +++ b/include/c99_math.h
>>> @@ -161,4 +161,56 @@ llrintf(float f)
>>>   #endif
>>>
>>>
>>> +#if defined(fpclassify)
>>> +/* ISO C99 says that fpclassify is a macro.  Assume that any
>>> implementation
>>> + * of fpclassify, whether it's in a C99 compiler or not, will be a
>>> macro.
>>> + */
>>> +#elif defined(__cplusplus)
>>> +/* For C++, fpclassify() should be defined in <cmath> */
>>
>> Does MSVC's cmath implement fpclassify?  If not this #elif clause should
>> be moved after MSC_VER clause.
>
> Looks like the answer is "no".

Actually, I take that back.  This patch works as-is on MSVC.  I also 
added an fpclassify() test in a .cpp file and it builds too (both MSVC 
and gcc).

The MSVC header #includes files are hard to follow, but somewhere, 
fpclassify() and the FP_* tokens are getting defined when compiling C++ 
code.

If I move the  #elif defined(__cplusplus) case after the #elif 
defined(_MSC_VER) case then things blow up.

I'll repost the patch with just the #error change.

-Brian




More information about the mesa-dev mailing list