scons: Use -Werror MSVC compatibility flags per-directory.
authorJose Fonseca <jfonseca@vmware.com>
Wed, 4 Mar 2015 14:23:52 +0000 (14:23 +0000)
committerJose Fonseca <jfonseca@vmware.com>
Wed, 4 Mar 2015 15:12:06 +0000 (15:12 +0000)
Matching what we already do with autotools builds.

Reviewed-by: Brian Paul <brianp@vmware.com>
scons/gallium.py
src/egl/main/SConscript
src/gallium/auxiliary/SConscript
src/gallium/drivers/llvmpipe/SConscript
src/glsl/SConscript
src/loader/SConscript
src/mapi/glapi/SConscript
src/mesa/SConscript
src/util/SConscript

index c34468fb673f37d8ed0d739227ec67c8f6b3dab5..f839758690814fbe04f6ab87e248c2b014a1e6ef 100755 (executable)
@@ -87,6 +87,25 @@ def createInstallMethods(env):
     env.AddMethod(install_shared_library, 'InstallSharedLibrary')
 
 
+def msvc2013_compat(env):
+    if env['gcc']:
+        env.Append(CCFLAGS = [
+            '-Werror=vla',
+            '-Werror=pointer-arith',
+        ])
+
+def msvc2008_compat(env):
+    msvc2013_compat(env)
+    if env['gcc']:
+        env.Append(CFLAGS = [
+            '-Werror=declaration-after-statement',
+        ])
+
+def createMSVCCompatMethods(env):
+    env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
+    env.AddMethod(msvc2008_compat, 'MSVC2008Compat')
+
+
 def num_jobs():
     try:
         return int(os.environ['NUMBER_OF_PROCESSORS'])
@@ -443,13 +462,6 @@ def generate(env):
             '-Wmissing-prototypes',
             '-std=gnu99',
         ]
-        if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2'):
-            ccflags += [
-                '-Wpointer-arith',
-            ]
-            cflags += [
-                '-Wdeclaration-after-statement',
-            ]
     if icc:
         cflags += [
             '-std=gnu99',
@@ -617,6 +629,7 @@ def generate(env):
     # Custom builders and methods
     env.Tool('custom')
     createInstallMethods(env)
+    createMSVCCompatMethods(env)
 
     env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13'])
     env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
index 399c020c2d0fee1a7366420d6fc5d03cc7ae5171..b4e9b67a2efede68ff9fc083a251e3a64afe6b4d 100644 (file)
@@ -6,6 +6,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Append(CPPDEFINES = [
     '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
 ])
index 6cb6b8c656561ed493acab0300b9c4e80203f5dd..d5fa880c7f2ae81b73d00680997ccaf7d7d927af 100644 (file)
@@ -8,6 +8,10 @@ env.Append(CPPPATH = [
     'util',
 ])
 
+env = env.Clone()
+
+env.MSVC2008Compat()
+
 env.CodeGenerate(
     target = 'indices/u_indices_gen.c', 
     script = 'indices/u_indices_gen.py', 
index 1bea61151c6580287cef5bc8b4992394a4512252..3a51efcd5069fe967a459760dcd77679d736f475 100644 (file)
@@ -9,6 +9,8 @@ if not env['llvm']:
 
 env = env.Clone()
 
+env.MSVC2008Compat()
+
 llvmpipe = env.ConvenienceLibrary(
        target = 'llvmpipe',
        source = env.ParseSourceList('Makefile.sources', 'C_SOURCES')
index 21c8266a636230b614193aeaf911b7a2d62eb0a8..26de455f07410136b3fd7d79fdd73b54dd7f93fe 100644 (file)
@@ -6,6 +6,8 @@ from sys import executable as python_cmd
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Prepend(CPPPATH = [
     '#include',
     '#src',
index 359fc1850fe476bb3df9b148262d35793b8c280c..16d1053ff2ddc8ac7b7b0ae9962018306d54ac15 100644 (file)
@@ -2,6 +2,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Prepend(CPPPATH = [
     '#include'
 ])
index 97ebfe638aeca58afc269ff703e3570242c9e6de..84a50684b97cc636a4b8c93b403fe8fb9ee5079e 100644 (file)
@@ -8,6 +8,8 @@ Import('*')
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Append(CPPDEFINES = [
     'MAPI_MODE_UTIL',
 ])
index 62e81ced1849a0b81905fed38f7954ca5c2e757c..d6ff0835445dd5c51cd9f9b87f48370a96b3785d 100644 (file)
@@ -10,6 +10,8 @@ from sys import executable as python_cmd
 
 env = env.Clone()
 
+env.MSVC2013Compat()
+
 env.Append(CPPPATH = [
     '#/src',
     '#/src/mapi',
index 84bd7a1e1c46f2922929bc6d5212f0d8cdbb5bfb..9e4d481f8386671b613ba43f1d31c69ca64bd333 100644 (file)
@@ -6,6 +6,8 @@ from sys import executable as python_cmd
 
 env = env.Clone()
 
+env.MSVC2008Compat()
+
 env.Prepend(CPPPATH = [
     '#include',
     '#src',