Bug 75336

Summary: Don't provide inline definitions of functions available in MSVS 2013's standard library
Product: Mesa Reporter: hans
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch for u_math.h
patch for imports.h

Description hans 2014-02-21 19:22:13 UTC
MSVS 2013 provides functions that were previously not available in the standard library. Mesa provides inline definitions for these when _MSC_VER is set. For example, http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/main/imports.h#n136

Clang warns about this "non-static declaration followed by static declaration" situation:

..\..\third_party\mesa\src\src\mesa\main/imports.h(148,20) :  warning(clang): static declaration of 'truncf' follows non-static declaration
static inline float truncf(float x) { return x < 0.0f ? ceilf(x) : floorf(x); }
                    ^
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(597,22) :  note(clang): previous declaration is here
_CRTIMP float __cdecl truncf(_In_ float _X);
                      ^

These declarations should probably be guarded by #if _MSC_VER < 1800.

(Chromium worked around the warning here: http://src.chromium.org/viewvc/chrome?revision=252594&view=revision)
Comment 1 Brian Paul 2014-03-01 18:32:10 UTC
Created attachment 94935 [details] [review]
patch for u_math.h
Comment 2 Brian Paul 2014-03-01 18:33:04 UTC
Created attachment 94936 [details] [review]
patch for imports.h

Can you verify that these two patches fixes the issue for you with Mesa git master?

If so, I'll also tag them for inclusion in the next 10.1.x release too.
Comment 3 hans 2014-03-03 18:38:48 UTC
Thanks Brian. I can confirm that those patches fixes the issue on the Mesa version we are using (Chromium is pretty far behind the Mesa git master so I don't have an easy way of testing that.)
Comment 4 Brian Paul 2014-03-03 20:08:30 UTC
OK, the patches are in Mesa git/master now (bf2566032589e and 837da9bdae) and tagged for inclusion in future 10.0.x and 10.1.x releases.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.