Make wildcards work in -sem statements
Would allow single -sem statement for group of similarly named methods. Example:
//lint -sem(CTest::Pre*Post, pure)
class CTest
{
public:
int PreOnePost() const;
int PreTwoPost() const;
int PreThreePost() const;
};
Would cover all 3 methods in CTest.
A facility to achieve this effect is provided in the upcoming PC-lint Plus.
-
Magnus commented
We often have an Init function in our classes. So it would be great if
-sem(*::Init,initializer)
would work for Init menber functions called in Constructor to get rid of
"1566 member ’Symbol’ (Location) might have been initialized by a
separate function but no ’-sem(Name,initializer)’ was seen" -
Ralf Hain commented
The heartbeat-security-exploit currently making big waves in the press. My first tip:
/*lint -function(malloc,OPENSSL_malloc)*/
Probably also the wildcard-suggestion would not detect the bug, but the heartbeat-issue
rises the importancy of this feature: Custom memory its done in critical software; the good advice
form some lint-users comes too often too late.The suggestion would enable a line like this:
/*lint -function(malloc,*malloc) */
And, additionally to the original suggestion, I 'd suggest this line to be active by default!
Its simply too riksy to do without. -
Ralf Hain commented
// somewhat "speculative checking"
// to get rid of possible false positive messages:
//
-sem(Is*,pure) -sem(is*,pure)
-sem(has*,pure) -sem(Has*,pure)
-sem(get*,pure) -sem(Get*,pure)
//
// bug-hunter-officers task: strengthen the checking:
// lint without/with and examine differences;
// fix bugs/do individual suppressions;
// then remove the global suppressions. -
Ralf Hain commented
This would enable a "SpecialFunctionsWildcards.lnt":
-function(malloc,*malloc*)
-function(memcpy,*memcpy*)
-function(printf,*printf) // eg debug_printf()
-function(thread_lock,*_lock)
// ... all other function listed in PC-Lint.pdf,
// cap 11.1.1. Special FunctionsBackground:
I've seen often functions like this:
Your_company_name_malloc()
Project_name_malloc()When the "lint-officer" realizes this, its mostly too late
in the devlopment-cycle; development is done with lost warnings;
time has been wasted to fix the bugs the hard way.I'd wish there would come more "out of the box".
Of cause this is speculative and can lead to false results.
But I'd expect the benefit would exceed the harm.