PVS-Studio command line tips

Evgeniy Ryzhkov
Articles: 111



As a lesser portion of our users utilize the command line version comparing to the VS IDE version, I would like to point attention to several aspects of using the command line version, as these could be not quite obvious at a first glance.

  • It is possible to obtain the analyzer's output from stdout in a specially formatted state, analogous to the compiler's errors. This could be handy for checking a single file to immediately get the analysis results, but it will be inconvenient if a large number of messages were generated. The 'new-output-format=no' option from configuration file or through command line should be used to enable the generation of compiler-like formatted diagnostic messages.
  • You could store the analyzer's output and manage it with Visual Studio IDE at a later time afterwards. This will allow you to utilize the convenient code navigation, access the documentation, use the message filtering and "Mark As False Alarm" functionality, etc., all through the "PVS-Studio Output" IDE tool window. That is, you will be able to use all PVS-Studio functionality normally available for Visual Studio projects without having to actually possess any such Visual C++ project files (vcproj/vcxproj). The downside is that, of course, Visual Studio IntelliSense navigation and auto-completion will not function without such project files as well. The "--output-file" command line option should be used to save the analyzer's output to a file. It then could be loaded into PVS-Studio Output IDE tool window as an "unparsed output" through the PVS-Studio->Open/Save->Open Analysis Report menu item (the "unparsed output" should be selected as a file type in the system dialog window). As such unparsed output contains a lot of duplicate lines, processing it at the first could take some time.
  • The detailed description of command line mode is available at documentation here.

Please contact us if you have any questions or suggestions towards the development of the analyzer and his command line version.



Use PVS-Studio to search for bugs in C, C++, C# and Java

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;

Evgeniy Ryzhkov
Articles: 111


Bugs Found

Checked Projects
344
Collected Errors
12 970