问题标签 [splint]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
3068 浏览

c - 如何在 Linux Ubuntu 上为 C 程序使用夹板?

我知道夹板是发出有关 C 程序问题的警告消息。

我使用“sudo apt-get install splint”将它安装在我的 Ubuntu 上。

如何在一个或多个 C 程序上使用它?

0 投票
1 回答
286 浏览

c - splint alleged memory leak after closing file pointer within stucture

I'm trying to learn how to use splint for while also trying to relearn C. Safety First!

I have a structure with a file pointer within it. The file pointer is opened within a constructor function, and closed within a destructor function. It is annotated with /@only@/ in the structure type definition, and splint seems to recognize that the file pointer within the structure is the only pointer (see details below) to that memory.

In the destructor function, the file is closed as long as the file pointer is not null.

However, splint seems to be complaining that the file pointer is not released, leading to a memory leak, even though the file is closed as long as the filepointer != NULL.

Here is the code:

And that causes the following errors:

Second error: Why does splint think that filestruct->file has not been closed in File_close even though it has been via fclose?

0 投票
0 回答
256 浏览

c - 夹板警告未定义的存储。请检查健康?


我目前正在开发一款游戏,我在以下代码中遇到了夹板问题,以将新的敌人结构添加到我的链接列表中。

夹板给出警告:

第 57 行是函数中的最后一个返回值。

现在,我相当有信心我的代码不能返回未定义的值,因为我要么设置所有字段,要么不更改任何内容并退出。

在某些情况下,我错过了将未定义的东西发回的地方吗?如果没有,停止夹板发出此警告的最佳方法是什么?

0 投票
2 回答
799 浏览

mplab - 使用夹板在带有 MPLAB 的 windows 上进行静态代码分析如何避免系统文件解析错误

我在 windows 上使用 MPLAB X (3.26) 和 PIC32(XC32 v1.40 编译器)。作为审查的一部分,我正在尝试使用夹板对某人的代码进行静态代码分析。我已经对大多数编译器定义和搜索路径进行了排序,但是在避免 PIC32 std 包含文件中的解析错误方面有点难过。

我用来运行夹板的命令是

然后输出给出

最后一个导致事情停止。我试过 -skip-iso-headers 之类的东西,但没有运气。似乎它的 standard.lcd 文件和 xc32 std 文件存在问题

谁能告诉我

  • < Location unknown >: Field name reused:手段或可能指的是什么?
  • 解决由于 std 头文件引起的解析错误的方法?

到目前为止,解决头文件问题的唯一方法是定义类型,例如

0 投票
0 回答
263 浏览

c - 在 Splint 处理的代码中使用二进制常量(前缀 0b)

根据GCC 网站SDCC 手册§3.5.7,GCC 和 SDCC 都允许使用二进制常量,例如这个,其中十进制数 2 表示:0b0010

不幸的是,夹板似乎不能很好地处理这个导致解析错误,如下所示。

二进制常量.c

输出

使用 +gnuextensions 输出

是否有允许将此扩展到 C 的标志?

0 投票
0 回答
1124 浏览

c - 夹板:要求不要检查系统标题

有没有办法停止splint分析包括的系统头文件、POSIX、libc 等?我运行-warnposix -preproc

更新:

阅读夹板常见问题解答14后,我尝试消除非标准关键字:

在这种特殊情况下,声明__gnuc_va_list为非标准关键字无济于事。我觉得这splint是一个强大的工具,但它几乎需要注释它解析的每一个代码。我错了吗?

0 投票
1 回答
390 浏览

cmake - 我们如何使用夹板使用 cmake 进行大型项目

我正在尝试在使用 cmake 进行构建的中等大型项目上使用夹板。项目包含数百个分散在大型目录结构中的源文件。我没有找到任何关于将夹板与 cmake 一起使用的信息。

目录结构就像

谢谢。

0 投票
1 回答
71 浏览

c - 让夹板与 win32 整数后缀一起工作

Splint 遇到使用 Windows 编译器似乎使用的大小指定后缀的系统头文件的解析错误。所以夹板无法解析包含类似表达式的文件0xffui8(其中 ui8 表示 8 位的无符号整数)。如何配置夹板来解决这个问题?

更广泛的背景:我试图让夹板与 WinDDK 7600.16385.1 一起工作。带有示例的文件是intsafe.h.

0 投票
1 回答
218 浏览

c - Splint:定义前使用的局部变量

我知道局部变量在未设置时可以具有“随机”值,但是用指针设置局部变量的第一个值是不是很糟糕?例如:

其中 setValue 只设置并且从不读取引用变量的值。Splint 警告我 val 是“在定义之前使用的”,我对这个警告有点惊讶,因为我相信 val 的值是在 printf 执行和使用 val 之前设置的。夹板是否不够先进,无法识别用于设置初始值的参考?

0 投票
0 回答
16 浏览

splint - 夹板超出范围错误

我正在使用 Splint 3.1.2,并且在我的代码中执行 Splint 期间出现超出范围错误。我的代码有 2000 个 .C 文件,由于超出范围错误,我的执行每次都在某些 .c 文件中停止。谁能帮我解决这个问题???。