[Mesa-dev] [PATCH 13/15] scons: Ensure inttypes.h is always pre-included on MSVC.

Jose Fonseca jfonseca at vmware.com
Fri Mar 20 06:59:39 PDT 2015


It's a bit hackish couldn't find another solution.  See code comment
for details.   The warning is useful, so universally disabling doesn't
sound a good idea.

Fixes

   warning C4005: 'xxx' : macro redefinition
---
 scons/gallium.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scons/gallium.py b/scons/gallium.py
index fac724e..52f1b8d 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -640,6 +640,13 @@ def generate(env):
             # disable all MSVC extensions.
             '-DYY_USE_CONST=',
         ])
+        # Flex relies on __STDC_VERSION__>=199901L to decide when to include
+        # C99 inttypes.h.  We always have inttypes.h available with MSVC
+        # (either the one bundled with MSVC 2013, or the one we bundle
+        # ourselves), but we can't just define __STDC_VERSION__ without
+        # breaking stuff, as MSVC doesn't fully support C99.  There's also no
+        # way to premptively include stdint.
+        env.Append(CCFLAGS = ['-FIinttypes.h'])
     if host_platform.system() == 'Windows':
         # Prefer winflexbison binaries -- http://winflexbison.sourceforge.net/
         # --, as not only they are easier to install (no additional
-- 
2.1.0



More information about the mesa-dev mailing list