4

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

So here is what I am doing:

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

lint-nt.sh is just a helper script to run PC-LINT under Linux with wine and for output transformation (i.e. backslash to slash...) 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 (files are the default from gimpel)

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

So when running I get this 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 with using namespace std and without. I tried test files with <string> and it get's even worse.

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

Jahn
  • 103
  • 1
  • 8
  • 1
    Did you already found a solution for this issue? I am currently having the nearly the same issue, with FlexeLint 9.0L, Ubuntu 15.10, C++. There are similar posts like this, see [here](http://stackoverflow.com/questions/14837125/lint-unable-to-recognizing-stdstring-class?rq=1) – orbitcowboy Apr 25 '16 at 13:25
  • 1
    Also having the same issue here using flexelint 9.0L C++ on Ubuntu 14.04. Did anyone made any progress with this? Thanks – User55412 Feb 22 '18 at 12:09

0 Answers0