Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ssproessig/PC-lint-json-compilation-database

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PC-lint (plus) invoker from JSON compilation databases

Big picture

To check existing codebases with PC-lint (plus) one has to:

  • (according to manual) prepare a local PC-lint setup
    • creating a lin.bat or lin.sh that invokes PC-lint (plus)
    • create a std.lnt that includes co.lnt and options.lnt
    • create a co.lnt that sets up the compiler being used
    • create an options.lnt that sets up the output format and
    • create a suppressions.lnt for project-specific suppressions
  • invoke lint with all include paths and defines per compilation-unit.

In order to integrate with existing build chains this tool can be used to execute PC-lint using the build job's JSON compilation database.

Usage

Invoke lint4jsondb.py

W:\> lint4jsondb.py --compilation-db commands.json --lint-path D:\pclp --lint-binary pclp64.exe --jobs 6 -- std.lnt

where

  • --compilation-db points to your build system's JSON compilation database
  • --lint-path points to you PC-lint root path (that contains the binaries and the lnt directory)
  • --lint-binary names the PC-lint binary you want to execute (either pclp32, pclp64 or lint-nt)
  • --jobs is the number of parallel PC-lint jobs to spawn (defaults to number of CPU core)
  • -- and everything after it will be passed to the PC-lint binary; use it to point to your std.lnt

Optionally you can control which files of the overall JSON compilation database SHALL be processed using

  • --include-only <regexp> will include only those files whose full file-path matches <regexp>
  • --exclude-all <regexp> will additionally exclude all those files whose full file-path matches <regexp>

Also, you can control if a file is to be treated as -library by PC-lint using

  • --treat-as-library <regexp> and e.g. pass the build directory where Qt moc generated files are stored

Additionally, you can control how PC-lint is invoked via --exec-mode

  • either once per file using each
  • or once per JSON compilation database using all

It is recommended to use all (the default) as this allows PC-lint to further track member usage inter-dependencies.

Further notes

  • might work with FlexeLint as well (I don't have one to test with)

Prerequisites

  • Python >= 2.7
  • Package ijson (for parsing JSON compilation databases on the fly)
  • Package mock (mocking calls, since Python 3.3 shipped with it)

JSON compilation database

The format specification for JSON compilation databases is available from LLVM.

...with CMake

Set CMAKE_EXPORT_COMPILE_COMMANDS to ON - or just pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON when invoking cmake.

For more information refer to the CMake manual.

...with make-based projects

Use Bear, see Bear on github.

...with qbs

Run qbs in generate mode and use the clangdb generator

$ > qbs generate -g clangdb

Refer to qbs manual on generators

About

A tool to execute PC-lint (plus) using JSON compilation databases

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.