[Mesa-dev] [PATCH 1/4] scons: Use -Werror MSVC compatibility flags per-directory.

Brian Paul brianp at vmware.com
Wed Mar 4 06:49:28 PST 2015


Series LGTM.  Reviewed-by: Brian Paul <brianp at vmware.com>

On 03/04/2015 07:27 AM, Jose Fonseca wrote:
> Matching what we already do with autotools builds.
> ---
>   scons/gallium.py                        | 27 ++++++++++++++++++++-------
>   src/egl/main/SConscript                 |  2 ++
>   src/gallium/auxiliary/SConscript        |  4 ++++
>   src/gallium/drivers/llvmpipe/SConscript |  2 ++
>   src/glsl/SConscript                     |  2 ++
>   src/loader/SConscript                   |  2 ++
>   src/mapi/glapi/SConscript               |  2 ++
>   src/mesa/SConscript                     |  2 ++
>   src/util/SConscript                     |  2 ++
>   9 files changed, 38 insertions(+), 7 deletions(-)
>
> diff --git a/scons/gallium.py b/scons/gallium.py
> index c34468f..f839758 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'])
> diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
> index 399c020..b4e9b67 100644
> --- a/src/egl/main/SConscript
> +++ b/src/egl/main/SConscript
> @@ -6,6 +6,8 @@ Import('*')
>
>   env = env.Clone()
>
> +env.MSVC2013Compat()
> +
>   env.Append(CPPDEFINES = [
>       '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
>   ])
> diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
> index 6cb6b8c..d5fa880 100644
> --- a/src/gallium/auxiliary/SConscript
> +++ b/src/gallium/auxiliary/SConscript
> @@ -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',
> diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
> index 1bea611..3a51efc 100644
> --- a/src/gallium/drivers/llvmpipe/SConscript
> +++ b/src/gallium/drivers/llvmpipe/SConscript
> @@ -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')
> diff --git a/src/glsl/SConscript b/src/glsl/SConscript
> index 21c8266..26de455 100644
> --- a/src/glsl/SConscript
> +++ b/src/glsl/SConscript
> @@ -6,6 +6,8 @@ from sys import executable as python_cmd
>
>   env = env.Clone()
>
> +env.MSVC2013Compat()
> +
>   env.Prepend(CPPPATH = [
>       '#include',
>       '#src',
> diff --git a/src/loader/SConscript b/src/loader/SConscript
> index 359fc18..16d1053 100644
> --- a/src/loader/SConscript
> +++ b/src/loader/SConscript
> @@ -2,6 +2,8 @@ Import('*')
>
>   env = env.Clone()
>
> +env.MSVC2013Compat()
> +
>   env.Prepend(CPPPATH = [
>       '#include'
>   ])
> diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript
> index 97ebfe6..84a5068 100644
> --- a/src/mapi/glapi/SConscript
> +++ b/src/mapi/glapi/SConscript
> @@ -8,6 +8,8 @@ Import('*')
>
>   env = env.Clone()
>
> +env.MSVC2013Compat()
> +
>   env.Append(CPPDEFINES = [
>       'MAPI_MODE_UTIL',
>   ])
> diff --git a/src/mesa/SConscript b/src/mesa/SConscript
> index 62e81ce..d6ff083 100644
> --- a/src/mesa/SConscript
> +++ b/src/mesa/SConscript
> @@ -10,6 +10,8 @@ from sys import executable as python_cmd
>
>   env = env.Clone()
>
> +env.MSVC2013Compat()
> +
>   env.Append(CPPPATH = [
>       '#/src',
>       '#/src/mapi',
> diff --git a/src/util/SConscript b/src/util/SConscript
> index 84bd7a1..9e4d481 100644
> --- a/src/util/SConscript
> +++ b/src/util/SConscript
> @@ -6,6 +6,8 @@ from sys import executable as python_cmd
>
>   env = env.Clone()
>
> +env.MSVC2008Compat()
> +
>   env.Prepend(CPPPATH = [
>       '#include',
>       '#src',
>



More information about the mesa-dev mailing list