问题标签 [pc-lint]
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.
c++ - 开关盒标签上的 PC-lint:违反 MISRA C++ 2008 所需规则 5-0-12
//定义了一些静态常量变量
//一些开关盒
// 现在 PC-lint 投诉此“注释 1960:违反 MISRA C++ 2008 要求的规则 5-0-12,不允许在案例标签中使用非数字值”
所以问题是为什么 PC-lint 不将静态 const 成员视为数值?
显式键入强制转换案例标签(应该解决这个问题)是个好主意吗?
案例标签需要类型转换为什么类型?会uint8_t
做吗?
其他一些方法可以免除这个 Lint 问题?
c++ - What am I doing wrong in this lint error suppression attempt? And is there a better way?
I have the following line of code:
And lint (PC-lint via Visual Lint, specifically) gives me a message 1924 on it ("C-style cast -- More Effective C++ #2").
FT_BITS_8 is #defined in a third party header file, and there's where the cast is:
And UCHAR is a typedef from another third party header file:
The thing it's being assigned to (ftDCB.ByteSize) is a BYTE, which is also a typedef for an unsigned char:
I don't really want to modify the third-party headers, so I tried to suppress the message in my code:
But I get the same 1924 message.
What am I doing wrong here? And is there a cleaner way to do what I want to accomplish (other than modifying the third-party header)?
c++ - 使用模板时出现 PC Lint 错误
当我为下面提到的代码运行 PC lint 应用程序时,出现错误:
第 (1) 行的错误是
错误 129:需要声明,忽略标识符 '__created'
错误 10:需要标识符或其他声明符
错误 129:需要声明,忽略标识符 'typename'
我怎样才能摆脱错误?
c - 禁止 lint 消息 9007
根据 MISRA 规则 13.5,逻辑 && 或 || 的右手操作数 运算符不应包含持久的副作用。我们的代码使用 PC-Lint 检查,消息 9007 ( http://gimpel-online.com/MsgRef.html#9007 )。
我们有表格的代码
if((GET_SIGNAL1() < CONST_1) || (GET_SIGNAL2() == CONST_2) )
{
dostuff();
}
GET_x 是宏,好吧,通过一些错误处理来获取信号 x,后者会导致预期的副作用。给出了对 MISRA 13.5 的规则偏差,现在的问题是如何抑制相应的消息。
到目前为止的努力:由于这是自动生成的代码,我不能直接放入 lint 注释,通过生成器放入注释虽然并且主要是难以追踪的。
宏定义中的 --e{(9007))} 可以工作,但我们也有类似的代码
foo = GET_SIGNAL1();
会导致函数范围的停用。
也考虑过 -ecall,但它只是检查调用本身,而不是宏的上下文(如我所愿)。
编辑:
我不能影响模型和工具链。只有我能影响的部分是 lint 配置或“胶水代码”,如宏定义
macros - LINT 从评估中排除宏
我正在使用 LINT 检查自动生成的 C 源文件。在这些源文件中使用了这些宏(简化):
在代码中,这些宏的使用方式如下:
我的 LINT 分析给了我以下信息:
LINT Note 9007: side effects on right hand of logical operator
由于我的宏正在向全局变量写入值,因此 LINT 消息本身是合理的。但是,由于架构原因,我知道我可以忽略此消息 - 因此,我想从检查 Note 9007 中排除宏。由于我使用自动代码生成,我很难注入我的 LINT-注释(禁用 Lint 消息)到源文件的正确位置。一种更简洁的方法是,将宏从我的 LINT-Ruleset 的检查中排除。所以我尝试将以下行添加到我的 LINT 规则集中:
但是,这并不能解决问题,因为这会从检查中排除宏本身的代码,但它不包括逻辑运算符&&
,因此它仍然给我注 9007。有什么办法可以禁用该错误对于所有与我的宏有关的消息?
c++ - PC-LINT 和 gcc 4.8 / STL 的问题(在 Ubuntu 上)
对于一个项目,我们将一个项目从 Windows 切换到 Linux,而 PC-LINT 在 wine 上运行得很好,但我无法通过简单的测试程序运行 PC-LINT。PC-LINT 总是抱怨 STL 标头。我浏览了所有关于 gcc 的 Gimpel 文档,我使用 co-gcc.h 并生成了 lint_cppmac.h、size-options.lnt和gcc-include-path.lnt - 我们使用的是 PC-LINT 9.00k版,我试过了也有9.00k4。gcc 是 Ubuntu 14.04 LTS 中的 4.8.2 版本。
所以这就是我正在做的事情:
lint-nt.sh 只是一个帮助脚本,用于在 Linux 下使用 wine 运行 PC-LINT 并用于输出转换(即反斜杠到斜杠......),包含以下内容:
test.cpp 包含以下内容:
std.lnt 仅包含以下内容(文件是 gimpel 的默认文件)
所以在运行时我得到这个错误(片段)
我尝试使用命名空间 std 和不使用。我尝试了测试文件,<string>
它变得更糟。
我很感激每一个提示让这个工作。先感谢您
c++ - PC Lint 未检测到在静态成员指针变量上可能使用空指针
在单例类的静态成员函数中,我没有使用 getInstance(),而是直接使用了静态指针成员变量。
我没有对它进行空检查,它在运行时为空,因此是空指针异常。
PC lint 没有通知我这一点。通常它会通知我作为 Prio 2 警告:可能使用空指针。
为什么没有通知我?
c - MISRA 错误:字段类型应为 int、unsigned int 或 signed int
我在我的程序中使用了以下代码,在运行 PC-Lint 时会引发以下错误:此行的多个标记 - (lint:46) 字段类型应为 int、unsigned int 或 signed int [MISRA 2004 Rule 6.4,必需] - (lint:960) 违反 MISRA 2004 要求的规则 6.4,位字段必须显式签名 int 或 unsigned int
有人可以告诉我如何解决这个问题吗?
c - PC-Lint: Ignore Library errors
I'm using PC-Lint to lint a C project. I want to ignore errors and warnings in third party libraries, but I'm not able to get this. Reading the manual, I check all #include files specified with angle brackets are considered as libraries.
[...] and you want this header to be regarded as a library header use angle brackets as in: #include <\include\graph.h>
Or for example, using the -libh command to indicate that header file is a library.
Using the option -vf, I've verified that my library files are being included as libraries. So everithing is OK.
The problems is that I'm receiving lot of errors from these files. I thought that since these files are considered as libraries, errors would be ignored.
How can ignore errors in library files? I've tried with -wlib(0), but this option ignore errors in header files too. In addition, generates an umcofortable warning:
Warning 686: Option '-wlib(0)' is suspicious because of 'the likelihood of causing meaningless output'; receiving a syntax error in a library file most likely means something is wrong with your Lint confinguration
Any suggestion? Thanks in advance
c++ - 如何在 PC-lint 中禁用对 static_asserts 的评估
我正在使用 C++ 的 static_assert 功能在编译时检查通常应该通过的东西,例如:
在该代码上运行 PC-lint(版本 9.00k)会发出注释 948:“运算符 '<' 始终计算为 True”,这对于 static_asserts 来说毫无意义。
我知道我可以将 a 添加//lint !e948
到每个 static_assert (这是我现在所做的)或全局禁用 948,但这也会在其他任何地方隐藏合法错误。
是否可以告诉 PC-lint 不评估/检查 static_asserts 中的表达式?