Linux 中 C++ 的静态代码分析器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8062624/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 07:06:31  来源:igfitidea点击:

Static Code Analyzer for C++ in Linux

c++linuxopen-sourcestatic-analysis

提问by Ajay

Possible Duplicate:
What open source C++ static analysis tools are available?

可能的重复:有
哪些开源 C++ 静态分析工具可用?

Does anybody know of an open source,good static code analyzer for C++ code in Linux ? The idea is to catch programming errors even before the code goes in to the code review state. It would be great to have the possibility to add rules the tool. Does anybody know of such tool?

有人知道 Linux 中 C++ 代码的开源、优秀的静态代码分析器吗?这个想法是在代码进入代码状态之前捕获编程错误。有可能为工具添加规则会很棒。有人知道这样的工具吗?

回答by LisztLi

回答by mitchnull

Take a look at clang's static analizer: http://clang-analyzer.llvm.org/

看看clang的静态分析器:http://clang-analyzer.llvm.org/

There are other tools like KLEEbased on llvm, might worth a look, too.

还有其他工具,如基于 llvm 的KLEE,也可能值得一看。

回答by Basile Starynkevitch

You can also customize GCC(4.6) by using plugins (coded in C) or MELT extensions(MELT is a high-level domain specific language to extend and customize GCC). This approach could be appropriate if you have your own coding rules that you want to check. However, it does take some work.

您还可以通过使用插件(用 C 编码)或MELT 扩展(MELT 是一种高级域特定语言来扩展和自定义 GCC)来自定义GCC(4.6 )。如果您有自己的编码规则要检查,这种方法可能是合适的。但是,这确实需要一些工作。

回答by fghj

you can give a try pvs-studio:

你可以试试 pvs-studio:

http://www.viva64.com/en/pvs-studio/(1)

http://www.viva64.com/en/pvs-studio/(1)

also there is (bla-bla-lint): http://www.gimpel.com/html/index.htm(2)

还有(bla-bla-lint):http: //www.gimpel.com/html/index.htm(2)

missed note about linux, FlexeLint for C/C++ from (2) has linux support, (1) only for windows, you can check it only if your product crossplatform.

遗漏了关于 linux 的注释,来自 (2) 的 C/C++ 的 FlexeLint 支持 linux,(1) 仅适用于 Windows,只有在您的产品跨平台时才能检查它。