cppcheck是一个个检测源码的工具,对编译工具的一个补充,mark

Cppcheck - A tool for static C/C++ code analysis

Syntax:
cppcheck [OPTIONS] [files or paths] If a directory is given instead of a filename, *.cpp, *.cxx, *.cc, *.c++, *.c,
*.tpp, and *.txx files are checked recursively from the given directory. Options:
--append=<file> This allows you to provide information about functions
by providing an implementation for them.
--check-config Check cppcheck configuration. The normal code
analysis is disabled by this flag.
-D<ID> By default Cppcheck checks all configurations. Use -D
to limit the checking to a particular configuration.
Example: '-DDEBUG=1 -D__cplusplus'.
-U<ID> By default Cppcheck checks all configurations. Use -U
to explicitly hide certain #ifdef <ID> code paths from
checking.
Example: '-UDEBUG'
--enable=<id> Enable additional checks. The available ids are:
* all
Enable all checks
* style
Enable all coding style checks. All messages
with the severities 'style', 'performance' and
'portability' are enabled.
* performance
Enable performance messages
* portability
Enable portability messages
* information
Enable information messages
* unusedFunction
Check for unused functions
* missingInclude
Warn if there are missing includes. For
detailed information, use '--check-config'.
Several ids can be given if you separate them with
commas. See also --std
--error-exitcode=<n> If errors are found, integer [n] is returned instead of
the default ''. '' is returned
if arguments are not valid or if no input files are
provided. Note that your operating system can modify
this value, e.g. '' can become ''.
--errorlist Print a list of all the error messages in XML format.
--exitcode-suppressions=<file>
Used when certain messages should be displayed but
should not cause a non-zero exitcode.
--file-list=<file> Specify the files to check in a text file. Add one
filename per line. When file is '-,' the file list will
be read from standard input.
-f, --force Force checking of all configurations in files. If used
together with '--max-configs=', the last option is the
one that is effective.
-h, --help Print this help.
-I <dir> Give path to search for include files. Give several -I
parameters to give several paths. First given path is
searched for contained header files first. If paths are
relative to source files, this is not needed.
--includes-file=<file>
Specify directory paths to search for included header
files in a text file. Add one include path per line.
First given path is searched for contained header
files first. If paths are relative to source files,
this is not needed.
-i <dir or file> Give a source file or source file directory to exclude
from the check. This applies only to source files so
header files included by source files are not matched.
Directory name is matched to all parts of the path.
--inconclusive Allow that Cppcheck reports even though the analysis is
inconclusive.
There are false positives with this option. Each result
must be carefully investigated before you know if it is
good or bad.
--inline-suppr Enable inline suppressions. Use them by placing one or
more comments, like: '// cppcheck-suppress warningId'
on the lines before the warning to suppress.
-j <jobs> Start [jobs] threads to do the checking simultaneously.
--language=<language>, -x <language>
Forces cppcheck to check all files as the given
language. Valid values are: c, c++
--max-configs=<limit>
Maximum number of configurations to check in a file
before skipping it. Default is ''. If used together
with '--force', the last option is the one that is
effective.
--platform=<type> Specifies platform specific types and sizes. The
available platforms are:
* unix32
bit unix variant
* unix64
bit unix variant
* win32A
bit Windows ASCII character encoding
* win32W
bit Windows UNICODE character encoding
* win64
bit Windows
-q, --quiet Only print error messages.
-rp, --relative-paths
-rp=<paths>, --relative-paths=<paths>
Use relative paths in output. When given, <paths> are
used as base. You can separate multiple paths by ';'.
Otherwise path where source files are searched is used.
We use string comparison to create relative paths, so
using e.g. ~ for home folder does not work. It is
currently only possible to apply the base paths to
files that are on a lower level in the directory tree.
--report-progress Report progress messages while checking a file.
--std=<id> Set standard.
The available options are:
* posix
POSIX compatible code
* c89
C code is C89 compatible
* c99
C code is C99 compatible
* c11
C code is C11 compatible (default)
* c++
C++ code is C++ compatible
* c++
C++ code is C++ compatible (default)
More than one --std can be used:
'cppcheck --std=c99 --std=posix file.c'
--suppress=<spec> Suppress warnings that match <spec>. The format of
<spec> is:
[error id]:[filename]:[line]
The [filename] and [line] are optional. If [error id]
is a wildcard '*', all error ids match.
--suppressions-list=<file>
Suppress warnings listed in the file. Each suppression
is in the same format as <spec> above.
--template='<text>' Format the error messages. E.g.
'{file}:{line},{severity},{id},{message}' or
'{file}({line}):({severity}) {message}'
Pre-defined templates: gcc, vs, edit.
-v, --verbose Output more detailed error information.
--version Print out version number.
--xml Write results in xml format to error stream (stderr).
--xml-version=<version>
Select the XML file version. Currently versions and
are available. The default version is .
Example usage:
# Recursively check the current folder. Print the progress on the screen and
# write errors to a file:
cppcheck . > err.txt # Recursively check ../myproject/ and don't print progress:
cppcheck --quiet ../myproject/ # Check test.cpp, enable all checks:
cppcheck --enable=all --inconclusive --std=posix test.cpp # Check f.cpp and search include files from inc1/ and inc2/:
cppcheck -I inc1/ -I inc2/ f.cpp For more information:
http://cppcheck.sf.net/manual.pdf
cppcheck: error: could not find or open any of the paths given.

Cppcheck - A tool for static C/C++ code analysis的更多相关文章

  1. The Ultimate List of Open Source Static Code Analysis Security Tools

    https://www.checkmarx.com/2014/11/13/the-ultimate-list-of-open-source-static-code-analysis-security- ...

  2. Top 40 Static Code Analysis Tools

    https://www.softwaretestinghelp.com/tools/top-40-static-code-analysis-tools/ In this article, I have ...

  3. 问题:Custom tool error: Failed to generate code for the service reference 'AppVot;结果:添加Service Reference, 无法为服务生成代码错误的解决办法

    添加Service Reference, 无法为服务生成代码错误的解决办法 我的解决方案是Silverlight+WCF的应用,Done Cretiria定义了需要在做完Service端的代码后首先运 ...

  4. 二十五、详述 IntelliJ IDEA 提交代码前的 Code Analysis 机制

    在我们用 IntelliJ IDEA 向 SVN 或者 Git 提交代码的时候,IntelliJ IDEA 提供了一个自动分析代码的功能,即Perform code analysis: 如上图所示,当 ...

  5. 十四、详述 IntelliJ IDEA 提交代码前的 Code Analysis 机制

    在我们用 IntelliJ IDEA 向 SVN 或者 Git 提交代码的时候,IntelliJ IDEA 提供了一个自动分析代码的功能,即Perform code analysis: 如上图所示,当 ...

  6. IntelliJ IDEA 提交代码时出现:Code analysis failed with exception: com.intellij.psi......

    IntelliJ IDEA 提交代码时出现:Code analysis failed with exception: com.intellij.psi...... 错误原因: 当我们勾选Perform ...

  7. DEA使用git提交代码时,点了commit之后卡死在performing code analysis部分,或者performing code analysis结束后没有进入下一步操作。

    把"Perform code analysis" 和 "Check TODO" 复选框前面的勾去掉就好了. 这个可能是因为所分析的目标文件太大了,造成一直分析不 ...

  8. IDEA使用git提交代码时,点了commit之后卡死在performing code analysis部分,或者performing code analysis结束后没有进入下一步操作

    把"Perform code analysis" 和 "Check TODO" 复选框前面的勾去掉就好了. 这个可能是因为所分析的目标文件太大了,造成一直分析不 ...

  9. A python tool to static sim.log duration time

    When working ALU IMS Patch team, we need to static the SU duration to add it to the patch report, th ...

随机推荐

  1. python2.7使用requests时报错SSLError: HTTPSConnectionPool(host='b-ssl.duitang.com', port=443)

    import requests url='https://www.duitang.com/napi/blog/list/by_search/?kw=%E6%A0%A1%E8%8A%B1&sta ...

  2. gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now

    [root@Gris- FMIS2600bak]# tar -zxvf /home/oradata/FMIS2600DMP.tar.gz gzip: stdin: not in gzip format ...

  3. Kali Linux 更新源 操作完整版教程

    一.查看kali系统的更新源地址文件 命令: vim /etc/apt/sources.list 上面这是kali官方的更新源: 拓展知识: 一个完整的源包括:deb 和 deb-src:上图源地址是 ...

  4. Ado.net之存储过程的使用【三】

    重点是红色标记区域的代码,设置本次执行的是存储过程,如果不设置,默认操作的是sql语句 private void LoadData() { string constr = @"databas ...

  5. windows与linux换行符

    我一次linux上写的脚本,利用vim进行脚本编写,然后下载下来在nodepad++上面打开,在nodepad上面新建了一个文件将原来文件内容复制过去,保存后下载复制文件在linux上面进行运行,发现 ...

  6. 人脸识别最新开发经验demo分享

    本来打算做个C#版demo,但没用成功,基于虹软的免费人脸识别技术 过程如下: 1. 传入一张单人脸照片: 2.调用检测人脸函数ASFDetectFaces,成功返回人脸信息的指针: 3.使用 Mar ...

  7. bubbo调用Failed to invoke remote method异常解决

    bubbo调用服务异常: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote method: getPlanFlowInfo, pr ...

  8. 02-python-垃圾回收机制

    转载自 https://www.cnblogs.com/Xjng/p/5128269.html 加以整理,方便记忆 1垃圾回收机制 Python中的垃圾回收是以引用计数为主,分代收集为辅.引用计数的缺 ...

  9. Codeforces 994 C - Two Squares

    C - Two Squares 思路: 点积叉积应用 代码: #include<bits/stdc++.h> using namespace std; #define fi first # ...

  10. Codeforces 801B - Valued Keys

    B. Valued Keys 题目链接:http://codeforces.com/contest/801/problem/B time limit per test 2 seconds memory ...