[Mesa-dev] [PATCH 02/10] mesa: remove M_PI, M_E, M_LOG2E macro definitions

Brian Paul brianp at vmware.com
Thu Feb 26 07:39:15 PST 2015


On 02/26/2015 05:07 AM, Jose Fonseca wrote:
> On 26/02/15 09:19, Erik Faye-Lund wrote:
>> On Thu, Feb 26, 2015 at 10:10 AM, Erik Faye-Lund <kusmabite at gmail.com>
>> wrote:
>>> On Thu, Feb 26, 2015 at 4:24 AM, Matt Turner <mattst88 at gmail.com> wrote:
>>>> On Wed, Feb 25, 2015 at 5:29 PM, Brian Paul <brianp at vmware.com> wrote:
>>>>> Should be defined in math.h.  If not, we can add them to c99_math.h
>>>>
>>>> And FWIW, the MSDN page [0] says that if you define _USE_MATH_DEFINES
>>>> before including math.h, these will be defined for you. Not sure what
>>>> versions of MSVC that applies to.
>>>>
>>>> [0]
>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__msdn.microsoft.com_en-2Dus_library_4hwaceh6.aspx&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=X_K0Nwx5tQCSFwVyG_ZygN6O81dMZbappObbbXBIo8o&s=RfLpDMUnAlzskfxAQZy8epMADQIMRc0BG2CFhhdtLlM&e=
>>>>
>>>
>>> That link says "Visual Studio 2013", but roughly the same message is
>>> also in the Visual Studio .NET 2003 docs (available through the "Other
>>> Versions"-selector at the top).
>>>
>>> IIRC, this has been the case since VC6, but we probably don't care
>>> about that old toolchains.
>>
>> By the way, it seems we already define _USE_MATH_DEFINES, at least here:
>>
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__cgit.freedesktop.org_mesa_mesa_tree_scons_gallium.py-3Fid-3D9db7b12cb283b915865d99d2fd3356af0662a18e-23n328&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=X_K0Nwx5tQCSFwVyG_ZygN6O81dMZbappObbbXBIo8o&s=wyVfp2Vd2fgWXHkzZhXPVVcPSuCIGZvTEJAzvQgunLI&e=
>>
>>
>> But do we always build for MSVC with SCons, and with gallium? If so,
>> it seems this patch is OK from a MSVC's point of view.
>
> That's right.  _USE_MATH_DEFINES should be always defined on MSVC.
>
> We could add
>
>    #if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
>    #error _USE_MATH_DEFINES define required when building with MSVC
>    #endif

In c99_math.h?  I can write a patch for that.

-Brian


>
> To make this explicit.  Actually defining _USE_MATH_DEFINES in the
> headers is hopeless, because the .c file might have included math.h
> before, so it can be too late.  It must be passed to cl.exe to be 100%
> sure.
>
> Jose
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=Wn1NTyqEjgVfSzIL5w02FwdCqrHdEuzWL7KlW1qLfWM&s=11VIZbm4b3L5t-EHZk-e1dUMBa6lpW9VRbhv11xThFQ&e=
>



More information about the mesa-dev mailing list