Board index » cppbuilder » PC-Lint 7.50 and BCB4

PC-Lint 7.50 and BCB4

Hello, World!

Has anybody tried to use PC-Lint 7.50 with BCB4?

David
dchristen...@california.com

 

Re:PC-Lint 7.50 and BCB4


Hello, world!

Here's the answer from Gimpel:

From: support <supp...@gimpel.com>
To: David Christensen <dchristen...@california.com>
Date: Thursday, April 01, 1999 1:18 PM
Subject: Re: PC-Lint 7.50 #P51113 and Borland C++ Builder 4

Quote
>Alas, it is true that we do not support C++ Builder.  I've added
your name
>to the list of people requesting support.  We currently have no
anticipated
>date for support.

>Anneliese
>Gimpel Software
>3207 Hogarth Lane                           (610) 584-4261
>Collegeville  PA  19426                     (610) 584-4266 FAX
>USA

>www.gimpel.com

Re:PC-Lint 7.50 and BCB4


I use it, but with limitations.  Here is what I found regarding problems and
some solutions.

1) it doesn't work with any of the Borland language extensions (naturally).
2) its preprocessor doesn't act like other preprocessors.  I have code that
compiles on VC++, Borland, and G++, but gets syntax errors in lint due to
preprocessing.  Strangely enough, VC++ preprocessor, when run standalone,
produces output that will not compile, but if you directly compile the
original code, it does compile.  Obviously Microsoft has two different
preprocessor modes.  A macro expands incorrectly:

#define DefaultValue(x) =vector<x>
template <class T DefaultValue(int)> class foo{};

Lint expands the above to template<class T=vector<int>> with no space
between the >> and it looks like an operator.  Rogue wave does this in
several places and it causes problems, but can be fixed by manually adding
spaces yourself in the headers.

3) Borland has an interesting file lookup algorithm.  For long standard
filenames, such as #include <algorithm> PC-Lint simply looks in the include
path for an exact match of the filename, potentially with or without the .h
extension.  Borland, however, does some funny stuff, because all of their
standard headers are in 8.3 format.  <algorithm> is actually algorith.h and
<streambuf> is streambu.h, and so on.  Borland uses this lookup algorithm
(in pseudo code)

For the following statement:
#include <X>

Their preprocessor does potentially TWO searches, using this pseudo-code:

found = search include path for exact match of X
if not found
then
  set ext = file extension of X (without period)
  set filename = filename of X (without extension or period)

  if (length of filename > 8)
  then
    truncate filename to 8 chars
  endif

  if (ext is empty string)
  then
    ext = "h"
  endif

  set second_search_filename = filename + "." + ext

  found = search include path for exact match of second_search_filename
endif

if not found
then
  report error "file not found"
endif

(This is not officially from Borland, but is a result of my own
investigation, and may slightly vary from what they are doing, but it's very
very close if not completely correct.)

Anyway, to get around this, I made another #include directory under lint,
and for each long filename that got this mangled lookup, I put a file with
the long name in that directory, and the contents simply #included  the
appropriate Borland standard header, in it's 8.3 format.  That worked very
well.

4) BCB4 has template support that PC-Lint does not seem capable of handling.
After all of this was said and done, I got PC-Lint syntax errors in code
that is correct, inside Rogue Wave's headers that it was now linting.

5) My sad conclusion was that they simply are not technically able to handle
BCB4.  In talking with their tech support, they seemed completely
uninterested that PC-Lint was unable to lint ANSI C++, because they were so
closed minded to C++ Builder that they couldn't seem to understand that you
can write ANSI C++ with it.  So basically they ignored the fact that

#include <iostream>
main()
{
  std::cout << "Hello World" << std::endl;

Quote
}

Cannot be linted with PC Lint using the standard library supplied with BCB.
Even though the standard lib is from Rogue Wave, and is used on other
compilers, they still don't seem to care.

But PC Lint in general is a fantastic product.  We also have Flexelint,
which is an identical product for Unix, which works well with the exact same
source code, using the egcs headers.

Go figure.

Chris (TeamB)

Quote
David Christensen wrote in message <7dc0k9$oj...@forums.borland.com>...
>Hello, World!

>Has anybody tried to use PC-Lint 7.50 with BCB4?

>David
>dchristen...@california.com

Re:PC-Lint 7.50 and BCB4


On Tue, 6 Apr 1999 09:54:49 -0400, "Chris Uzdavinis (TeamB)"

Quote
<ch...@uzdavinis.com> wrote:
>1) it doesn't work with any of the Borland language extensions (naturally).

It should work for those extensions that did exist already in BC++5.

Cheers,                   Jochen

************************************
Hans-Jochen Trost, Ph.D.
MicroFab Technologies, Inc.
1104 Summit Ave., Suite 110
Plano, TX 75074, USA
Phone:  (1)(972) 578-8076
Fax:    (1)(972) 423-2438
E-mail: hjtr...@microfab.com
Company home page:
   http://www.microfab.com
************************************

Other Threads