[Mesa-dev] [PATCH 08/15] scons: Define YY_USE_CONST on MSVC.

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


This prevents the MSVC from

  warning C4090: 'function' : different 'const' qualifiers

when compiling flex generated lexers.
---
 scons/gallium.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scons/gallium.py b/scons/gallium.py
index 2b11526..9924f1e 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -622,6 +622,14 @@ def generate(env):
 
     # Load tools
     env.Tool('lex')
+    if env['msvc']:
+        env.Append(LEXFLAGS = [
+            # Force flex to use const keyword in prototypes, as relies on
+            # __cplusplus or __STDC__ macro to determine whether it's safe to
+            # use const keyword, but MSVC never defines __STDC__ unless we
+            # disable all MSVC extensions.
+            '-DYY_USE_CONST=',
+        ])
     env.Tool('yacc')
     if env['llvm']:
         env.Tool('llvm')
-- 
2.1.0



More information about the mesa-dev mailing list