False positives suppression in PVS-Studio

Andrey Karpov
Nov 5 · 1 min read

Any analyzer issues a certain number of false positives in addition to useful information. PVS-Studio provides several ways to suppress false alarms. You can suppress a specific warning for one line using a short message to the analyzer in comments, or you can use a special command to do so. It’s available in the PVS-Studio context menu. PVS-Studio also allows you to create a special configuration file (.pvsconfig) for the analyzer, which stores comments that suppress the analyzer warnings.

There are cases when a certain type of diagnostics is irrelevant for the analyzed project. In this case, PVS-Studio has the group warnings suppression option. It includes group suppressions by the warning’s code (number), text of a warning, and disabling analysis for some parts of a project. Another feature is a mass suppression mechanism. It might be useful in case, when it’s unreasonable to be distracted by errors in the old code base and you have to track warnings for the newly written code.

The documentation section “Suppression of false alarms” covers various ways of warnings suppression. We recommend reading this section before you start to regularly use the analyzer in your work.

Andrey Karpov

Written by

Microsoft C++ MVP, passionate sotware engineer. Founder and developer of PVS-Studio static code analyzer for C, C++ and C#.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade