Search code examples
c++static-analysislintpc-lint

Per-project options in Visual Lint?


I've used Visual Lint (as a frontend for PC-lint) in the past and somehow configured it to use a different options.lnt file for different projects. My recollection, which might be incorrect, is that it was configured to automatically pick up anything called "options.lnt" in any project's directory - i.e. I didn't have to configure this for each project individually.

So for example I might have two projects, ProjX and ProjY, and I might have different options.lnt files in each of them:

C:\MyProjects\ProjX\options.lnt
C:\MyProjects\ProjY\options.lnt

Possibly those might refer to certain sets of general options stored in other files; for example I have C:\MyProjects\Lint\options.lnt for very general things, and then more specific options files for things related to certain packages; for example I have C:\MyProjects\Lint\options_boost.lnt for use by projects that use Boost. So if ProjX uses Boost, C:\MyProjects\ProjX\options.lnt will contain (at least) the lines:

C:\MyProjects\Lint\options.lnt
C:\MyProjects\Lint\options_boost.lnt

Whereas perhaps ProjY doesn't use Boost, and so its options.lnt would have the "general" line, but not the Boost-specific line.

This was all working fine, but I've migrated to a new computer, and I can't seem to get it working again. When I run Visual Lint against ProjX, it shows messages that should be suppressed by (for example) entries in C:\MyProjects\Lint\options_boost.lnt.

I have gone into Visual Lint's "Tools / Options", and under the "Analysis" tab, I have set "Preferred Analysis method" to "Per project". I have the Professional edition, which I believe is required for this functionality. I am using version 5 (whereas the previous machine, on which this was working, was version 4).

Am I perhaps missing some additional configuration I need to set up in order to get Visual Lint to pay attention to the project's options file?


Solution

  • Answering my own question:

    In Visual Lint, go to Tools / Options / PC-lint. In there, there's a "Configuration" field, containing the name of a *.lnt file (like C:\Lint\std.lnt) that applies to anything you do in PC-lint via Visual Lint. Edit that file to contain the line:

    options.lnt
    

    Without specifying a full path. That seems to make it pick up the copy of options.lnt from the project's directory, and that file can then contain the more specific lines as shown in the question, such as:

    C:\MyProjects\Lint\options.lnt
    C:\MyProjects\Lint\options_boost.lnt