General
14 results found
-
Option for output in "Serif" format
A couple of customers have asked for results in the "serif" format as specified at https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.pdf. Right now we are planning to try to do as much as we can in a post-processing step, but it would be incredibly convenient if we could just get that information out of the box.
5 votes -
Reinstate detection of unused headers
Messages 766, 964 and 966, for reporting where headers have been included in a module but not apparently used, have all been removed since PC-lint 9 and I can find no indication why on this site, nor in the PC-lint plus manual. This was a very useful feature. Can it be reinstated?
5 votes -
Value tracking arrives at incorrect conclusion when incrementing variables in loop conditions
Consider the following program:
#include <stdlib.h> #include <stdint.h> #define MAX_VAL (6) int main() { uint32_t val = 0; do { } while(++val != MAX_VAL); if(MAX_VAL == val) { exit(0); } return 0; }
This program is guaranteed to exit before reaching the
return
, however lint claims it is guaranteed to never execute the body of the theif
statement:
…info 774: boolean condition for 'if' always evaluates to 'false' (involving variable 'val') supplemental 831: binary operator yields 0 (line 15) supplemental 831: increment yields 1 (line 13) supplemental 831: initialization yields 0 (line 8) supplemental 831: integral conversion yields
1 vote -
Value tracking simultaneously assumes enums both can and cannot take any value
In the following snippet I've defined a basic assertion macro and an enum, with an external function that returns a value typed by that enum. I wish to verify that the returned value is a valid enumerated value.
Firstly, if we remove both assertions below then there are no warnings generated, despite the fact that an out of bounds access on the
printf
is possible.If you add both assertions then the warning described inline occur: a warning on the first assertion claims that the result can be predetermined. If we assume that enums can only take their enumerated values…
1 vote -
Relaxed parsing of *-e* inhibitions for multiple messages
Compare the parser requirement for separating commas [#...
-ecall(# [# ...], Function [,Function ...])
-emacro(# [# ...], Symbol [,Symbol ...])
-estring(# [# ...], String [,String ...])
-esym(# [# ...], Symbol [,Symbol ...])
-etype(# [# ...], Type [,Type ...])...vs. [,#...
-e(# [,# ...])
--e(# [,# ...])
-e{# [,# ...]}
--e{# [,# ...]}...which in my opinion makes usage a bit more difficult than necessary, as the two groups of inhibitions have slightly different requirements.
While there probably are good reasons for not requiring a separating comma for the first group of inhibitions, the second group could easily get relaxed parsing…
1 vote -
Support ARM compiler v6 for Keil
The PC-Lint Plus Configurator currently supports ARM compiler v5 for Keil. However, ARM v6 has been supported by Keil for some time, and so it would be useful if the Configurator did as well.
Note that ARM v6 is based on Clang, which is already supported by the Configurator for GCC installations. However, this doesn't set up the correct options for use with Keil. The options for Keil + ARM v5 seem to mostly (but not entirely) work with v6, but "official" support would be better.
6 votes -
Enable opt-in assumptions about the initial values of static variables
This condition doesn't seem to be detected by PC-lint Plus:
include <stdint.h>
include <string.h>
typedef struct
{
uint8t one;
uint8t two;
uint8t three[18];
} testt;static testt *mpdef;
static testt *mpabc;void
test (void)
{
// These manipulations should trigger a warning since both pointers are not initialized.
mpdef->one = 1;
mpabc->one = 2;
}1 vote -
Consider adding reporting capabilities to PC-LINT Plus
Most competing tools can generate MISRA compliance reports at the push of a button.
With PC-LINT 9.0L it is a rather tedious procedure, e.g. running with ++efreeze, parsing text output and generating a result.
Not up to date in 2017.19 votes -
Add an option to identify undefined behavior
The C99 standard (Appendix J) identifies almost 200 forms of undefined behavior (UB). For many, many reasons, UB is basically the most egregious form of coding error. It is totally preventable, and the effects can be most devastating.
Even though not all kinds of UB can be detected by a static analysis tool, many are, and other tools do this pretty well.
Piggy-backing onto this -- would also be nice to identify implementation-defined behaviors (e.g. bit position of bit-fields) and unspecified behaviors.
As these are all part of the standard, it doesn't seem too hard to do intellectually, it's just…
19 votes -
Preprocessor output for a specific code section
The "-p run just the Preprocessor" option is very handy, but for me it often generates too much information to pour though when I'm trying to diagnose a specific macro issue.
It would be great if the preprocessor output could be enabled for a section of code, and send the output to a file and/or standard out.
e.g.:
//lint -p+
SOMECOMPLEXMACRO(a,b,c,d,e);
//lint -p-4 votes -
Add support for pthread_mutex_trylock() semantics
As described in http://www.gimpel.com/Discussion.cfm?ThreadID=3793 this functionality is needed.
For example, this function results in lint warning 455 (A thread mutex that had not been locked is being unlocked):
bool IsLocked() { int retStat = pthread_mutex_trylock(&m_pthreadMutex); if (retStat == 0) { // Mutex was not locked, but is now. pthread_mutex_unlock(&m_pthreadMutex); return (false); } else if (retStat == EBUSY) { // Mutex is already locked. return (true); } return (false); }
17 votes -
to add a new warning to find use of an explicite cast from real to unsigned int.
Although an explicite cast looks like the programmer knew, the intended behaviour may need two casts.
I wanted to "infinitely" accumulate possibly small, possibly negative increments (float i) in a modulo counter consisting of an unsigned integer variable (uint32_t n) and a real variable (float f) for the fractional part.f += i;
n += (uint32t)f; // should read n += (uint32t)(int32t)f;
f -= (int32t)f;worked with several compilers for PC platforms (gcc, lcc32, VS C++) and with TI''s c6000 compiler for an OMAP L138, but the counter failed to decrease with TI's ARM5.1 compiler for…
1 vote -
Be able to suppress for derived classes
Sometimes it would be nice to suppress a message for all derived classes.
For example:
class X
{
virtual void f() = 0;
};class Y : public X
{
void f() {}
};class Z : public X
{
int i;
void f(){++i;}
};I would like to be able to put the following comment with the declaration of X:
//lint -esym(1961,[X]::f) //1961 - virtual member function 'Symbol' could be made constWhere I use [X] as syntax to define X and all classes derived from it.
So when a sub class dos not use the function f to…5 votes -
Find message inhibitions inside files that have no effect
Sometimes the following happens:
Code is created with a deliberate violation of a lint message.
The message in inhibited with a comment in the code.
However, it often happens comments are not updated with code.
So the reason for the inhibition may be removed and the inhibition stays.It would be nice to find such "broken" inhibitions, (that have no effect on the resulting messages even when all other inhibitions are disabled).
Maybe this search can be a result of executing pc-lint with a special flag.This way the code can be cleaned of old inhibitions.
48 votes
- Don't see your idea?