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

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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
Author:

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
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…
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…
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…
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…
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…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
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…
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 ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…

Comments (0)

Next comments

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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 →
Accept