diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-03-04 14:23:52 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-03-04 15:12:06 +0000 |
commit | 00faf9f00059370bc20ebeaf00884c2d8ef15a74 (patch) | |
tree | 413ad99d58123d206e133e1bd455b0cf94f6cf57 /scons | |
parent | 3acd7a34ab05b87521b74f626ec637e7fdcc6595 (diff) |
scons: Use -Werror MSVC compatibility flags per-directory.
Matching what we already do with autotools builds.
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'scons')
-rwxr-xr-x | scons/gallium.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/scons/gallium.py b/scons/gallium.py index c34468fb67..f839758690 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -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']) |