summaryrefslogtreecommitdiff
path: root/scons
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-04-14 14:31:02 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-04-16 11:44:21 +0100
commitd3c0e236f23e66cb2b4a75f5161282b2d15ff73f (patch)
treec964c28fc459b05069f844dee78dc9416e7b2b76 /scons
parentf81305c0cbb0e233435a26f5e2a8a38dd752c25e (diff)
scons: Add an analyze option.
For Clang static code analyzer, the scan-build script will produce more comprehensive output. Nevertheless you can invoke it as CC=clang CXX=clang++ scons analyze=1 For MSVC this is the best way to use its static code analysis. Simply invoke as scons analyze=1 Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'scons')
-rwxr-xr-xscons/gallium.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/scons/gallium.py b/scons/gallium.py
index 42e8f7c547..e873c658ad 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -467,6 +467,18 @@ def generate(env):
env.Append(CCFLAGS = ['/MT'])
env.Append(SHCCFLAGS = ['/LD'])
+ # Static code analysis
+ if env['analyze']:
+ if env['msvc']:
+ # http://msdn.microsoft.com/en-us/library/ms173498.aspx
+ env.Append(CCFLAGS = [
+ '/analyze',
+ #'/analyze:log', '${TARGET.base}.xml',
+ ])
+ if env['clang']:
+ # scan-build will produce more comprehensive output
+ env.Append(CCFLAGS = ['--analyze'])
+
# Assembler options
if gcc_compat:
if env['machine'] == 'x86':