diff options
| author | bernard <[email protected]> | 2013-09-17 11:07:36 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2013-09-17 11:07:36 +0800 |
| commit | 0bf7ed76cff8071718f50ebeb68ba3bb2544a7cb (patch) | |
| tree | 81db6eaa0424dc1c10355b5b4c8fe56c763c1cfd /tools | |
| parent | 77096894f9d53cb0742adb5330fed4966e956cd1 (diff) | |
| parent | 47c152ee7fdcf8b101a08bacebbafb52d2c8d3a7 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/building.py | 7 | ||||
| -rw-r--r-- | tools/tools/clang-analyze.py | 69 |
2 files changed, 74 insertions, 2 deletions
diff --git a/tools/building.py b/tools/building.py index 56b4ebdc8d..65bd14d882 100644 --- a/tools/building.py +++ b/tools/building.py @@ -113,8 +113,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ AS = 'true',) env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_")) # only check, don't compile. ccc-analyzer use CCC_CC as the CC. - env['ENV']['CCC_CC'] = 'true' - env['ENV']['CCC_CXX'] = 'true' + # fsyntax-only will give us some additional warning messages + env['ENV']['CCC_CC'] = 'clang' + env.Append(CFLAGS=['-fsyntax-only', '-Wall', '-Wno-invalid-source-encoding']) + env['ENV']['CCC_CXX'] = 'clang++' + env.Append(CXXFLAGS=['-fsyntax-only', '-Wall', '-Wno-invalid-source-encoding']) # remove the POST_ACTION as it will cause meaningless errors(file not # found or something like that). rtconfig.POST_ACTION = '' diff --git a/tools/tools/clang-analyze.py b/tools/tools/clang-analyze.py new file mode 100644 index 0000000000..a966a7b56a --- /dev/null +++ b/tools/tools/clang-analyze.py @@ -0,0 +1,69 @@ +""" +Tool-specific initialization for Clang static analyzer + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. +""" + +__revision__ = "tools/clang-analyze.py 2013-09-06 grissiom" + +import os +import os.path + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Tool +import SCons.Util + +import rtconfig + +def generate(env): + assert(rtconfig.CROSS_TOOL == 'clang-analyze') + # let gnu_tools setup a basic env(learnt from SCons/Tools/mingw.py) + gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'm4'] + for tool in gnu_tools: + SCons.Tool.Tool(tool)(env) + + # then we could stand on the shoulders of gaints + env['CC'] = 'ccc-analyzer' + env['CXX'] = 'c++-analyzer' + env['AS'] = 'true' + env['AR'] = 'true' + env['LINK'] = 'true' + + env['CFLAGS'] = ['-fsyntax-only', '-Wall', '-Wno-invalid-source-encoding'] + env['LINKFLAGS'] = '-Wl,--gc-sections' + env['ARFLAGS'] = '-rc' + + # only check, don't compile. ccc-analyzer use CCC_CC as the CC. + # fsyntax-only will give us some additional warning messages + env['ENV']['CCC_CC'] = 'clang' + env['ENV']['CCC_CXX'] = 'clang++' + + # setup the output dir and format + env['ENV']['CCC_ANALYZER_HTML'] = './build/' + env['ENV']['CCC_ANALYZER_OUTPUT_FORMAT'] = 'html' + + # Some setting from the platform also have to be overridden: + env['OBJSUFFIX'] = '.o' + env['LIBPREFIX'] = 'lib' + env['LIBSUFFIX'] = '.a' + + if rtconfig.EXEC_PATH: + if not os.path.exists(rtconfig.EXEC_PATH): + print + print 'warning: rtconfig.EXEC_PATH(%s) does not exists.' % rtconfig.EXEC_PATH + print + return + env.AppendENVPath('PATH', rtconfig.EXEC_PATH) + +def exists(env): + return env.Detect(['ccc-analyzer', 'c++-analyzer']) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: |
