Current Entries | Archives   RSS

 


Introducing support for Borland/CodeGear C++ Builder in LintProject Professional

Wednesday 19th August, 2009


A couple of months ago I wrote about our long term plans with for support for non-Microsoft project file formats in both Visual Lint and LintProject Professional (see Non-Microsoft Platforms, Visual Lint and LintProject Professional. At the time, we presented as an example Texas Instruments Code Composer Studio 3.x (.pjt) project files, and described what we were doing to add support for them to LintProject Professional.

Since then we have been building on that foundation by implementing project file parsers for the various Borland/CodeGear C++ Builder project and project group (the C++ Builder equivalent of a Visual C++ workspace or solution) file formats.

The reasoning behind this is simple - although PC-lint can parse most C++ code without any issues, to do well so it needs to be given not only compiler/library options files but also indirect files containing preprocessor and additional include folder definitions for each project configuration to be analysed. In all but the most trivial cases, this requires that the project files be parsed - and since each compiler vendor has its own ideas about what such a project file should look like (and frequently changes them in subtle or not-so-subtle ways...) this is a decidedly non-trivial problem.

In the Visual C++ world PC-lint has for some time been able to handle basic project files (.dsp and more recently .vcproj) and generate the corresponding project indirect ("project.lnt") files for you. Having said that, when we were originally developing Visual Lint it quickly became apparent that this support was limited in some areas (e.g. it doesn't read for-loop compliance options or inherited property sheets files) and this led us to write parsers for these Visual C++ project file format. As a result, Visual Lint is able to generate far more accurate project indirect files than PC-lint alone - a fact that can in many cases easily be seen in the analysis results produced.

The same is true for C++ Builder. Although PC-lint can in fact read C++ Builder 5.0/6.0 project (.bpr) files, its ability to do so is quite limited. Furthermore, it cannot handle the newer C++ Builder 2007/2009 formats* at all.

* Being MSBuild based, these are far more complex than their predecessors - as is the the new `.vcxproj` project file format used by Visual Studio 2010. Again, this cannot be read by PC-lint itself - but LintProject Professional already has a parser for it.

As a result, the adoption of PC-lint within the C++ Builder developer community seems to have been marginal at best (I know I'm sticking my neck out here, but that's the distinct impression we get from speaking to C++ Builder developers who have tried to use it).

The good news is that this work has now borne fruit - from LintProject Professional 2.0.4.12 onwards the various C++ Builder project and project group file formats are directly supported:

The LintProjectPro help scree
The LintProjectPro help screen lists the supported project file formats.

We are pretty confident that this version should be able to handle the majority of C++ Builder project files, but of course any edge cases and oddities can be dealt with through the normal support/release cycle (as we already do for Visual C++ project files).

Note that we have not (yet!) tested this build with the forthcoming C++ Builder 2010, but as the file format for this version is (apparently) identical to that of C++ Builder 2009 we are not anticipating any significant issues in doing so.

In the longer term our plan is actually to be able to make a version of Visual Lint available which can handle C++ Builder projects directly - either as a standalone GUI (the most likely option, since it will let us target project file formats for embedded IDEs as well) or even (if resources permit) as a native C++ Builder plug-in. That's still some way off though, and in the meantime we hope that LintProject Professional will prove to be an effective way to use PC-lint static analysis with C++ Builder projects.

We look forward to working further with developers within the C++ Builder community. Our thanks in particular go to those who have helped us extensively in the development of this exciting new capability for LintProject Professional.

Posted by Anna at 12:44pm | Get Permalink