pc-lint

conversion between a pointer to function and another type [MISRA 2012 Rule 11.1, required] | pclint 9074

走远了吗. 提交于 2021-01-27 19:20:45
问题 I am using an array of function pointers as below to avoid a switch statement in the code. void E_func1(void); void E_func2(void); void E_func3(void); void (*pfGetVal[3])() = { E_func1, E_func2, E_func3 }; But while running misra (pclint), I am getting the error below: conversion between a pointer to function and another type [MISRA 2012 Rule 11.1, required] Do I need to use typedef ? I tried as below but didn't work. void (*pfGetVal[3])(); pfGetVal[0] = E_func1; pfGetVal[1] = E_func2;

CMake and PC-Lint Plus - how do I pass CMake's include directory list to Lint?

霸气de小男生 提交于 2020-06-26 12:51:07
问题 I'm trying to incorporate PC-Lint Plus into my cmake project, mainly per PC-Lint needs a list of all include paths for the files to be scanned. How to get a list of all include paths recursively needed by a target in CMake?. PC-Lint is getting invoked, but ends up dying because not all the includes are in the PC-Lint invocation. I dumped the above link into a Lint.cmake, and included that in my top level CMake file. In my project file, I added: if(COMMAND add_pc_lint) add_pc_lint(moded ${SRC

PC-Lint needs a list of all include paths for the files to be scanned. How to get a list of all include paths recursively needed by a target in CMake?

爱⌒轻易说出口 提交于 2020-06-13 06:24:31
问题 I'm in a project where CMake is used for managing the build process. In the project there are several executables which depends on components and these components are built as static libraries. There are also dependencies between these components. For each executable or component, only their own local includes are specified and includes from dependencies are resolved by using target_link_libraries(<target> <dependencies>) . So far so good. The problem is when PC-Lint shall be integrated into

Any tips for speeding up static analysis tool PC-Lint? Any experiences using .LOB files?

我是研究僧i 提交于 2020-01-02 15:03:24
问题 I'm interested in learning the main factors which affect PC-lint-ing time. I'm aware of a few such as -passes(#) which will increase the time PC-Lint takes (increase linearly?) or that reducing the messages which are output does not affect the linting time. I'm hoping to verify my understanding of lint's performance by having one of you who is more experienced with lint list the main factors they've encountered that affect linting time. Also, do any of you have experience using .lob files

How do I suppress PC-Lint errors for C99-style initialization of structure members?

本小妞迷上赌 提交于 2019-12-24 17:46:41
问题 I am using PC-Lint 8.00x with the following options: +v -wlib(1) +fan +fas I receive a number of error messages from PC-Lint when I run code similar to the following: typedef union { struct { unsigned int a : 4; unsigned int b : 4; unsigned int c : 4; unsigned int d : 4; } bits; unsigned short value; } My_Value; int main (void) { My_Value test[] = { { .bits.a = 2, .bits.b = 3, //Errors 133 and 10 .bits.c = 2, .bits.d = 3, }, { .bits.a = 1, .bits.b = 1, //Errors 133 and 10 .bits.c = 1, .bits.d

Pc Lint, how to suppress err 613(Possible use of null ponter) for class with init()

空扰寡人 提交于 2019-12-11 09:13:33
问题 Tried to simplify the situation as much as possible. So I have a class: class C { int * field; public: C() : field(nullptr) {} void init(int* f) { field = f; } int getI1() { return *field; } int getI2() { return *field; } }; which generates 2 Lint warnings 613 (Possible use of null pointer 'C::i'...) I know that "field" won't be null when getI1() or getI2() are called. And unfortunately I cannot initialize it in constructor. So I want to suppress Lint warnings. I can do it like this class C {

Lint unable to recognizing std::string class

五迷三道 提交于 2019-12-08 02:22:09
问题 I am trying to lint my project. But it seems like Lint is unable to recognize the classes such as std::string , std::vector and std::queue . I am using lib-std.lnt config file as well but of no use, facing the errors like following. Error 40: Undeclared identifier 'queue' Error 40: Undeclared identifier 'string' Error 10: Expecting a structure or union Does any one know how to resolve the issue? for sample code :- #include<string> int main(void) { std::string str; return ; } =================

Any tips for speeding up static analysis tool PC-Lint? Any experiences using .LOB files?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 10:11:51
I'm interested in learning the main factors which affect PC-lint-ing time. I'm aware of a few such as -passes(#) which will increase the time PC-Lint takes (increase linearly?) or that reducing the messages which are output does not affect the linting time. I'm hoping to verify my understanding of lint's performance by having one of you who is more experienced with lint list the main factors they've encountered that affect linting time. Also, do any of you have experience using .lob files with PC-Lint. How much would you say it affected linting time? The main speedup I got was when I started

Lint unable to recognizing std::string class

半腔热情 提交于 2019-12-06 07:10:19
I am trying to lint my project. But it seems like Lint is unable to recognize the classes such as std::string , std::vector and std::queue . I am using lib-std.lnt config file as well but of no use, facing the errors like following. Error 40: Undeclared identifier 'queue' Error 40: Undeclared identifier 'string' Error 10: Expecting a structure or union Does any one know how to resolve the issue? for sample code :- #include<string> int main(void) { std::string str; return ; } =================================== and the out put is as following />lint-nt -iC:\ghs\comp_20121\ansi proj2.lnt snip

Does MISRA C 2012 say not to use bool

孤者浪人 提交于 2019-12-06 02:49:28
问题 I am in the early stages of framing stuff out on a new project. I defined a function with a return type of "bool" I got this output from PC-Lint Including file sockets.h (hdr) bool sock_close(uint8_t socket_id); ^ "LINT: sockets.h (52, 1) Note 970: Use of modifier or type '_Bool' outside of a typedef [MISRA 2012 Directive 4.6, advisory]" I went ahead and defined this in another header to shut lint up: typedef bool bool_t; Then I started wondering why I had to do that and why it changed