To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (an extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at

If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

Using PVS-Studio analyzer together with…

Using PVS-Studio analyzer together with Microsoft Visual Studio 2010 incremental assembly

Jun 20 2011

One among newest features in the latest versions of MSBuild/Visual Studio for Visual C++ compilers is the new minimal rebuild system (also known is an incremental assembly), which is based on tracing of dependencies between compiler's input and output data. It allows performing the rebuilding only for the files untouched by modifications or lacking output object files tied to them.

This note is obsolete. Please read "PVS-Studio's incremental analysis mode" in documentation.

In comparison to the old method of minimal rebuild which was based on compiler state files generated by the cl.exe (idb-files, Minimal Rebuild Dependancy Database, /Gm command line switch) and had several shortcomings (among them are the difficulty of performing parallel builds due to the file access conflicts and the lack of direct tracing for output object files), the new system is independent from build tools being used (it can be used together with the compiler as well as with the linker) and possesses an open API. This new feature in the latest version of Visual Studio 2010 allowed us to integrate PVS-Studio source code verification into C/C++ development process with incremental rebuilding. This feature was added in PVS-Studio 4.30.

One of the major problems with regular verification of actively developed large-scale projects by the static analyzer is the necessity to invest huge amounts of time into the analysis of project's files after each modification. In spite of the fact that the verification of the entire project could be (and should be!) performed regularly, for example during night builds, the maximum benefit from using the analyzer can be obtained only by detecting and correcting any detected errors as soon as possible, as the earlier you manage to detect the error, the less code you have to modify in the end. Thereby the most effective way of using the static analyzer is the verification of source code immediately after its creation. Such a use case is undoubtedly complicated by the necessity of constant manual launching of the analysis for every source file being modified and waiting for the completion of this analysis. All of this is of course incompatible with the intense development and debugging of new source code.

The usage of PVS-Studio analyzer together with MSBuild incremental building system allows us to solve all aforementioned issues. The activation of such incremental analysis mode could be done through PVS-Studio/Incremental Analysis After Build menu item (Only for Visual Studio 2010). The incremental analysis in Visual Studio 2010 can also be used with previous versions of Visual C++ compiler by setting Platform Toolset of the corresponding version for the projects required.

After activating the incremental analysis mode PVS-Studio will automatically start to commence the verification of all modified files in background every time after the completion of project's minimal rebuild. It should be noted however that the analysis is only possible for files which are free of syntax errors, therefore in case of compiler errors being generated during the build, the analysis will not be launched. The errors during building steps following the compilation (the linking errors for instance) do not affect the operation of PVS-Studio.

In case the analyzer detects errors in source code during incremental analysis, the number of detected errors will be reflected in the name of PVS-Studio toolwindow tab which will be opened in background. You can then star working with them without waiting for the analysis to be completed. But for the error list not to be filled with useless and senseless messages, one should always remember that after first full project's verification it is necessary to review all of the diagnostic messages for all the files, to correct the errors found in source code and mark the rest of the remaining messages as false alarms, or to disable the detection of errors' codes or analyzers' types which are not relevant for the project entirely. Only then the incremental analysis will allow you to detect defects immediately after writing new source code and assembling it successfully for the first time.

In fact this new PVS-Studio mode brings our tool's usability close to the /analyze key of various Visual Studio versions. Now you can simply engage in developing the source code and compiling it, simultaneously receiving messages containing potential source code issues from the analyzer. As the analyzer operates in background (and the number of processor's cores being used for the analysis can be configured), the usage of PVS-Studio becomes a lot more comfortable. This means that our tool can be easily installed on workstations of a large part (or even everyone) of the developers in the department to allow the detection of source code issues immediately at their emergence.

UPDATE: Incremental Analysis feature available for all versions of Microsoft Visual Studio (2005/2008/2010) in PVS-Studio 4.33.

Popular related articles
The way static analyzers fight against false positives, and why they do it

Date: Mar 20 2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: Oct 22 2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
The Last Line Effect

Date: May 31 2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →