文章目录
- 网站
- Out of bound memory access (index is tainted)
- clang-analyzer-deadcode.DeadStores
- C-style and functional notation
- overrun-buffer-arg:
- Redundant pairs of parentheses should be removed
- Macros should not be #define'd or #undef'd within a block
- Functions should be declared explicitly
- Obsolete POSIX functions should not be used
- 左操作值是垃圾数据
- 使用#undef的时候要小心
- 删除空语句
- 局部变量初始化之后使用
- 自加自减的使用
- 魔数
- c++里的数据成员
- 结构体,枚举,联合体第一个大括号的位置
- 比特操作,重复表达式
- 宏定义加分号
- 条件判断嵌套太多层
- 函数名称的含义自包含
- 参数名含义自包含
- 函数声明
- 函数声明参数名称问题
- 假阳性
- none
- 返回值检查
- 不建议使用goto
- 声明不能为空,没有意义
- 不要再使用不安全的函数
- 119
- 120
- 125
- 170
- 398
- 457
- 467
- 476
- 563
- 570
- 571
- 628
- 682
- 685
- 686
- 687
- "if", "for", "while", "switch" and "try" 不要嵌套的太多层
- Return will never be executed
- Use constructors or assignment operators, ABC is not trivially copyable
- 经验性的问题
- 人工代码审查注意点
- shell 检查
- CID 1309755: (#1 of 1): Unused value (UNUSED_VALUE)
网站
https://cwe.mitre.org/data/definitions/686.html
https://www.sonarqube.org/
https://rules.sonarsource.com/c/RSPEC-959
http://cppcheck.net/ 静态代码检查
Out of bound memory access (index is tainted)
这里的tainted的意思是说,这个index被污染了,如果用了,就有可能导致非法越界访问。这个单词在内里insert 私有某块的时候也会用到。
比如:
int len = strlen(a);
char a = b[len-1];
这里,使用了a的长度来访问b,就属于这种情况。
clang-analyzer-deadcode.DeadStores
如果变量没有使用到,可能产生deadcode的分析结果。
warning: Value stored to ‘ret’ is never read [clang-analyzer-deadcode.DeadStores]
C-style and functional notation
[M