Giter Club home page Giter Club logo

pvs-studio-qmake-examples's Introduction

Examples of PVS-Studio integration in QMake (QtCreator)

For PVS-Studio analyzer integration into your project, you can use the PVS-Studio.pri module (Linux only).

A few examples in this repository will help you learn how to use the QMake module in your project properly.

  1. Connect the .pri module to your project;
  2. Add a new configuration, for example, "Analyze";
  3. In settings of the configuration "Build Steps" -> "Make arguments", add the name of the target (pvs_studio.target = this_name);
  4. Switch to the created configuration and run "Build All";
  5. See the results in the analyzer in the Issues Panel.

Analysis without integration (Linux only)

This utility requires the strace utility.

This can be built with the help of the command:

pvs-studio-analyzer trace -- qmake

You can use any other build command with all the necessary parameters instead of make, for example:

pvs-studio-analyzer trace -- qmake debug

After you build your project, you should execute the commands:

pvs-studio-analyzer analyze -o /path/to/project.log -e /path/to/exclude-path -j<N>
plog-converter -a GA:1,2 -t tasklist -o /path/to/project.tasks /path/to/project.log

Analyzer warnings will be saved into the specified project.tasks file.

If your project isn't CMake or you have problems with the strace utility, you may try generating the file compile_commands.json with the help of the Bear utility. This file will help the analyzer to check a project successfully only in cases where the environment variables don't influence the file compilation.

If you use cross compilers

In this case, the compilers may have special names and the analyzer will not be able to find them. To analyze such a project, you must explicitly list the names of the compilers without the paths:

pvs-studio-analyzer analyze ... --compiler COMPILER_NAME --compiler COMPILER_NAME ...
plog-converter ...

Also, when you use cross compilers, the directory with the header files of the compiler will be changed. It's necessary to exclude such directories from the analysis with the help of -e flag, so that the analyzer doesn't issue warnings for these files.

pvs-studio-analyzer ... -e /path/to/exclude-path ...

There shouldn't be any issues with the cross compilers during the integration of the analyzer into the build system.

pvs-studio-qmake-examples's People

Contributors

kulikovk avatar pauleremeeff avatar sviatoslavrazmyslov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pvs-studio-qmake-examples's Issues

Пример интеграции не работает.

Пример интеграции не работает с текущей версией креатора 4.12.4. В выводе ошибок только варнинги и ошибки GCC.
При сборке с Qt_5_15_0_MinGW_64.

Ошибка в макфайле:
C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/PVS-Studio/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/clipper.cpp.plog: C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/clipper.cpp PVS-Studio.cfg
mkdir -p 'C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/PVS-Studio/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper' && rm -f 'C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/PVS-Studio/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/clipper.cpp.plog' && pvs-studio-analyzer analyze --cfg 'PVS-Studio.cfg' --output-file 'C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/PVS-Studio/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/clipper.cpp.plog' --source-file 'C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/clipper.cpp' --platform linux64 --preprocessor gcc --cl-params -std=c++17 -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DBUILD_DATE=""Sun Jul 26 11:47:10 2020"" -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/forms/formsutil/ -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/excellon -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/file -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/gcode -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/gerber -IC:/Users/RedFox/Documents/GitHub/GERBER_X2/graphicsview $(CXXFLAGS) $(DEFINES) -DPVS_STUDIO $(INCPATH) 'C:/Users/RedFox/Documents/GitHub/GERBER_X2/G2G/C:/Users/RedFox/Documents/GitHub/GERBER_X2/clipper/clipper.cpp'

pvs_studio.target is missleading

Maybe I am too stupid but this was misleading for me:
3. In settings of the configuration "Build Steps" -> "Make arguments", add the name of the target (pvs_studio.target = this_name);
It would be better this way (for me anyway) :)
3. In settings of the configuration "Build Steps" -> "Make arguments", add the name of the target 'pvs' (default name in the example-1.pro file)
or something similar.
Because I made the most trivial use case: Ctrl+C Ctrl+V the 'pvs_studio.target = this_name' and it did not compile because of the spaces , ok I removed it the compilation finished successfully and I did not see any problem in the Issue tab and I thought that I am awesome!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.