The news about the possibility of
free source verification using PVS-Studio has finally stimulated me to implement source verification in Eclipse CDT. And then for CLion / QtCreator / etc
it was written as , but purple was bypassed :) For the experiments we used: Eclipse IDE for C / C ++ Developers, Version: Neon.1a Release (4.6.1), Build id: 20161007-1200 and PVS-Studio 6.11.20138.1. And that's what happened.
To begin, let's wrap the analyzer's call into the script (about it later) and we will call it as an external utility. In the configuration, specify the working directory:
External Tools Configurations / Main And turn on the checkbox "Allocate console":
External Tools Configurations / Common The disadvantage of this method is that the output will not be understood by the Eclipse parser, and it can be seen only in the console:
')
If this method does not suit you, you can embed the check into an external utility for assembly. The method is not suitable for all projects, but if it suits, then go to the project properties and configure the External Builder parameters for the current configuration:
- We select External builder as Build type
- Uncheck “Use default build command”
- In the field "Build command" enter our script
- Check "Generate Makefiles automatically"
The "-k" key Eclipse adds itself. Accordingly, when building a project, our script will be called with the "-k all" keys, while clearing, with the "-k clean".
As a result, we will receive an automatic check of the project during the assembly, plus the output that Eclipse understands and, as a result, navigation through the sources in the Problems window:
Well, now the script itself:
For now. On real projects, nothing has been driven yet, maybe some shortcomings will come out there. But the general scheme is clear in principle.