-
use the
%ENVVAR%
to insert the value of an environment variable in a.lnt
file
example:%TOPDIR%/tools/prolin/base.lnt
to include thebase.lnt
file
-
define a short 2 / int 4 / long 8 / pointer 8 memory model:
-sb8 -sc1 -ss2 -si4 -sl8 -sf4 -sld16 -sp8 -spD8 -spP8 -smp8 -smpD8 -smpP8 -sw8
-
syntaxes:
-e#
+e#
disable/re-enable warning
wildcards?
and*
can be used-e(#)
inhibit warning for the next expression
example:a = /*lint -e(413) */ *(char *)0;
--e(#)
inhibit warning for the entire expression before or within which it is placed
example:a = /*lint --e(413) */ *(int *)0 + *(char *)0;
-e{#}
inhibit warning for the next statement or declaration
example://lint -e{715} suppress "k not referenced"
void f( int n, unsigned u, int k )
{
…
}--e{#}
inhibit warning for the entire braced region in which it is placed
the inhibition is recorded in the statement tree
wildcards?
and*
can be used!e#
one-line message suppression
example://lint !e573 !e721
-
when the copy constructor and assignment operator are not defined and declared as private to avoid their use
class FooBar
{
public:
…
private:
FooBar( const FooBar &i_other);
/*lint -esym(1526,FooBar::FooBar)*/
FooBar operator=( const FooBar &i_other);
/*lint -esym(1526,FooBar::operator=)*/
} -
Header files
-
ProLint will generate 1053 errors if the same include file is included with two different paths
example: the source file contains (via the hierarchy of included files)#include "foo/bar.h"
#include "bar.h"-Ifoo
-
consider a file as a library header even if it is not included using angle brackets
/*lint +libh(VxDrawImage.h)*/
#include "VxDrawImage.h" -
kill a warning for an unused header file
/*lint -efile(766,iterator)*/
#include <iterator> // required for GCC3.3.2 on Linux
-
ProLint will generate 1053 errors if the same include file is included with two different paths
-
stdarg
problems on Linux:
create astdarg.h
in directory/my/path
#ifndef PROLINT_STDARG_H
#define PROLINT_STDARG_H
typedef int va_list;
#define va_start(a,b) ((void) ((a) = (int) ( & (b) + 1)))
#define va_arg(a,b) /*lint --e(416)*/ (*( (b *) ( ((a) += sizeof(b)) - sizeof(b) )))
#define va_end(a) ( (void) 0 )
#endif //PROLINT_STDARG_H-i/my/path
-
Same solution for the
sstream
problems on Linux:
#ifndef PROLINT_SSTREAM_H
#define PROLINT_SSTREAM_H
#include <string>
#include <iostream.h>
#include <streambuf.h>
class stringbuf : public streambuf
{
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
explicit stringbuf(int which=ios::in|ios::out);
explicit stringbuf(const std::string &s, int which=ios::in|ios::out);
std::string str() const;
void str(const std::string& s);
inline streampos seekoff(streamoff o, _seek_dir d, int mode=ios::in|ios::out);
inline streampos seekpos(streampos pos, int mode = ios::in|ios::out);
};
class stringstreambase : virtual public ios {
public:
std::string str() const;
void str(const std::string& s);
stringbuf* rdbuf();
};
class istringstream : public stringstreambase, public istream {
public:
istringstream(int which=ios::in);
istringstream(const std::string& s, int which=ios::in);
istringstream& seekg(streampos pos);
istringstream& seekg(streamoff off, _seek_dir dir);
streampos tellg();
};
class ostringstream : public stringstreambase, public ostream {
public:
ostringstream(int which=ios::out);
ostringstream(const std::string& s, int which=ios::out);
ostringstream& seekp(streampos pos);
ostringstream& seekp(streamoff off, _seek_dir dir);
streampos tellp();
};
class stringstream : public stringstreambase, public iostream {
public: stringstream(int which=ios::in|ios::out);
stringstream(const std::string &s, int which=ios::in|ios::out);
stringstream& seekg(streampos pos);
stringstream& seekg(streamoff off, _seek_dir dir);
streampos tellg();
stringstream& seekp(streampos pos);
stringstream& seekp(streamoff off, _seek_dir dir);
streampos tellp();
};
#endif // PROLINT_SSTREAM_H-i/my/path
-
ProLint is not able to understand complex templates (e.g. STL), see http://www.gimpel.com/Discussion.cfm?ThreadID=923#2 for a proposition.
On Linux, a quick ’n dirty hack is to create thestl_config.h
file:#define __STL_STATIC_TEMPLATE_MEMBER_BUG
#define __STL_NEED_TYPENAME
#define __STL_NEED_EXPLICIT
#define __STL_BEGIN_NAMESPACE
#define __STL_END_NAMESPACElist
s:Error 1036: ambiguous reference to constructor; candidates: '_List_iterator<basic_string<char,…
kill it with-efunc(1036,_List_iterator<*,*,*>::_List_iterator<*>)
-
Qt
-emacro(1511,Q_OBJECT) // Member hides non-virtual member
-emacro(1516,Q_OBJECT) // Data member hides inherited member
// the next one avoids the issue with the 'public slots:' declaration
-d"QUObject=QUObject/*lint --e{1736}*/" // Redundant access specifier
-
in order to use
prola
, you must be in the ProLint directory -
list the current licence usage
#> prola print
-
disable a user (to avoid using more licences than the number of bought ones)
#> prola disable -user=foobar
-
disable a user given his UID
#> prola disable -user="uid10288"
For the time being, this is trivial method:
#> grep -R -I -w lint | filter |
filter
is
#!/usr/bin/perl
|