Problems with PC-LINT and gcc 4.8 / STL (on Ubuntu)

For the project, we switched the project from Windows to Linux, and while PC-LINT works fine with wine, I can't get PC-LINT to work with a simple test program. PC-LINT always complains about STL headers. I went through all the Gimpel documentation about gcc and I am using co-gcc.h and I created lint_cppmac.h, size-options.lnt and gcc-include-path.lnt. We are using PC-LINT version 9.00k and I tried with 9.00k4 as well. gcc is version 4.8.2 on Ubuntu 14.04 LTS.

So here's what I am doing:

lint-nt.sh -voip +b std.lnt /home/test/test.cpp

      

lint-nt.sh is just a helper script for running PC-LINT under Linux with wine and for converting the output (i.e. backslashes to slashes) and contains the following:

#!/bin/bash
DIR=`dirname $0`
# Options that are passed to PC-Lint before any other options.
# -fff: Under Linux, filenames are case-sensitive.
# +rw(__is_pod): __is_pod is a GCC toolchain-specific keyword.
PREOPTS="-fff +rw(__is_pod)"
wine ${DIR}/LINT-NT.EXE $PREOPTS "$@" | tr '\\\r' '/ ' 

      

test.cpp contains the following:

#include <iostream>

class Base {
public:
  Base(int i) : m_i(i), m_pi(new int[i]) { }
  ~Base() {}
  int get() { std::cout << m_i << std::endl; return m_i; }
private:
  int m_i;
  int *m_pi;
};

      

std.lnt just contains the following (default files from gimpel)

co-gcc.lnt        // gcc compiler options
lib-stl.lnt       // STL

      

So when I run I get these errors (snippet)

/home/test/test.cpp  11  Info 783: Line does not end with new-line 
                         _ 
  Base(int i) : m_i(i), m_pi(new int[i]) { } 
/home/test/test.cpp  5  Info 1732: new in constructor for class 'Base' which 
    has no assignment operator 
/home/test/test.cpp  5  Info 1733: new in constructor for class 'Base' which 
    has no copy constructor 
/home/test/test.cpp  5  Info 737: Loss of sign in promotion from int to 
    unsigned int 
           _ 
  ~Base() {} 
/home/test/test.cpp  6  Warning 1540: Pointer member 'Base::m_pi' (line 10) 
    neither freed nor zeroed by destructor 
/home/test/test.cpp  10  Info 830: Location cited in prior message 
                        _ 
  int get() { std::cout << m_i << std::endl; return m_i; } 
/home/test/test.cpp  7  Error 40: Undeclared identifier 'cout' 
/home/test/test.cpp  7  Info 701: Shift left of signed quantity (int) 
/home/test/test.cpp  7  Error 40: Undeclared identifier 'endl' 
/home/test/test.cpp  7  Warning 504: Unusual shift operation (left side unparenthesized) 
/home/test/test.cpp  7  Info 701: Shift left of signed quantity (int) 
/home/test/test.cpp  7  Warning 522: Highest operation, operator '<<', lacks side-effects 
/home/test/test.cpp  7  Info 1762: Member function 'Base::get(void)' could be made const 
_ 
}; 
/home/test/test.cpp  11  Info 1712: default constructor not defined for class 
    'Base' 

--- Wrap-up for Module: /home/tall/test.cpp 

Info 753: local class 'Base' (line 3, file /home/tall/test.cpp) not referenced 
 /home/test/test.cpp  3  Info 830: Location cited in prior message 
Info 766: Header file '/usr/include/c++/4.8/iostream' not used in module '/home/test/test.cpp' 

      

I tried to use std namespace and without it. I tried test files with help <string>

and it got worse.

I appreciate every hint to get this job done . Thank you in advance

+3
c ++ gcc stl ubuntu pc-lint


source to share


No one has answered this question yet

See similar questions:

1
Lint cannot recognize std :: string class

or similar:

1938
Why doesn't GCC optimize a * a * a * a * a * a to (a * a * a) * (a * a * a)?
783
What is the difference between g ++ and gcc?
529
How to install JDK on Ubuntu Linux
414
Why does the order in which libraries are linked sometimes cause errors in GCC?
405
What's the difference between "STL" and "C ++ Standard Library"?
401
How do I get rid of the 'obsolete conversion from string constant to' char * 'warning in GCC?
346
Why doesn't the C ++ STL provide any "tree" containers?
296
GCC Option -fPIC
287
How do I install boost on Ubuntu?
0
Error trying to use pthread on Ubuntu



All Articles
Loading...
X
Show
Funny
Dev
Pics