我怎样才能使 Clang 的“扫描构建”与 SCons 一起工作?
我有一个使用 SCons 构建的项目,我正在尝试使用 Clang 静态分析器 来分析代码。然而,运行
scan-build scons
SCons 时似乎会忽略 scan-build
引入的设置。我怎样才能做到这一点?
I've got a project built with SCons and I'm trying to use the Clang Static Analyzer to analyze the code. However, when running
scan-build scons
SCons seems to ignore the settings introduced by scan-build
. How can I make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
scan-build 的工作方式是设置构建系统(例如 make)通常使用的各种环境变量来控制构建的发生方式。其中一些是:
CC
- 用作 C 编译器的程序名称CXX
- 用作 C++ 编译器的程序名称CCC_*
- 各种控制 Clang 静态分析器行为的环境变量SCons 通常会在运行构建之前清理环境(这是一个功能)。为了使上述环境变量生效,请在
SConstruct
中执行以下操作:The way
scan-build
works is it sets up various environment variables that are usually used by build systems (such asmake
) to control how the build happens. Some of these are:CC
- name of program to use as C compilerCXX
- name of program to use as C++ compilerCCC_*
- various environment variables that control the behaviour of Clang's static analyzerSCons normally cleans out the environment before running a build (this is a feature). In order to make the above environment variables take effect, do something like this in
SConstruct
: