Questions tagged [pvs-studio]

PVS-Studio is a tool for detecting bugs and security weaknesses in the source code of programs, written in C, C++, C# and Java. It works in Windows, Linux and macOS environment.

PVS-Studio performs static code analysis and generates a report that helps a programmer find and fix bugs. PVS-Studio performs a wide range of code checks, it is also useful to search for misprints and Copy-Paste errors. Examples of such errors: V501, V517, V522, V523, V3001.

The main value of static analysis is in its regular use, so that errors are identified and fixed at the earliest stages. There is no point in wasting 50 hours looking for a bug that could be found with static analysis. So, let's point out that again - the main idea of static analysis is not to find one hidden bug on the day before the release, but to fix dozens of bugs day by day.

The analyzer can be run at night on the server and warn about suspicious code fragments. Ideally, these errors can be detected and fixed before getting into the repository. PVS-Studio can automatically be launched immediately after the compiler for the files that have been just modified. It works in Windows, Linux and macOS environment.

Quick start

PVS-Studio can integrate into Visual Studio development environment 2010-2017. If you use this IDE, then most likely you will just have to go to the menu of PVS-Studio plugin and choose "Check Current Project".

Often, it can be a more complicated process, and you will need to integrate PVS-Studio into a build system, even an exotic one. The topic of integration is too broad to describe it here. You can find all the information in the detailed documentation.

One more point to notice - PVS-Studio for Windows and Linux has special utilities, gathering information about the compiler launches. These tools allow doing a quick analysis of a project that gets compiled in any possible way. You can quickly try out the analyzer abilities, without wasting time on its integration with makefile or a build script. See the description of the utility Standalone (Windows) and pvs-studio-analyzer (Linux/macOS).

Official Q&A platform for free PVS-Studio version

As described in this post, PVS-Studio uses StackOverflow (with the pvs-studio tag) as the official Q&A platform for users of a free PVS-Studio version. Of course, the usual StackOverflow rules still apply. Bug reports and feature requests are not on-topic here on Stack Overflow.

Supported languages and compilers

  • Windows. Visual Studio 2010-2017 C, C++, C++/CLI, C++/CX (WinRT), C#
  • Windows. IAR Embedded Workbench, C/C++ Compiler for ARM C, C++
  • Windows/Linux. Keil µVision, DS-MDK, ARM Compiler 5/6 C, C++
  • Windows/Linux. Texas Instruments Code Composer Studio, ARM Code Generation Tools C, C++
  • Windows/Linux/macOS. GNU Arm Embedded Toolchain, Arm Embedded GCC compiler, C, C++
  • Windows/Linux/macOS. Clang C, C++
  • Linux/macOS. GCC C, C++
  • Windows. MinGW C, C++
  • Windows/Linux/macOS. Java

Additional links:

63 questions
0
votes
2 answers

C++: A2W macro deprecated for x64 - alternatives?

I am using PVS-studio in converting a program to x64 from x86. Upon the execution of an analysis run in PVS-Studio I get the following x64 related warnings for every use of the A2W macro defined in atlconv.h: V303 The function 'lstrlen' is…
10100111001
  • 735
  • 15
  • 31
0
votes
1 answer

PVS-Studio doesn't process header files

I've tried to do static code analysis on my project which basically is made up from .hpp files as everthing is "templated" there, but unfortunately I'm getting info from PSV-Studio that header files cannot be processed. That seems bit strange. In…
smallB
  • 16,662
  • 33
  • 107
  • 151
-2
votes
1 answer

V3022 False Positive

PVS Studio throws V3022: Expression 'list.Count > 1' is always false. Program.cs 20 public class Program { private static void Main() { var list = new List(); var keyvaluelist = new List<(string, string)>() { ("1",…
1 2 3 4
5