Commit Graph

153 Commits

Author SHA1 Message Date
Oliver Stöneberg 2c1e36e63e
cleaned up includes based on include-what-you-use (#2600)
* cleaned up includes based on include-what-you-use

* check.h: trying to work around Visual Studio 2012 bug

* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
Daniel Marjamäki a9f55f4985 CLI: add -isystem include paths when running Clang 2020-02-02 16:35:42 +01:00
Daniel Marjamäki 216698c164 Fix cppcheck project import for Clang parser setting 2020-02-02 12:15:23 +01:00
Daniel Marjamäki 632dc0f141 GUI: Select parser; Cppcheck or Clang 2020-02-02 10:45:42 +01:00
Daniel Marjamäki fb38e87bf4 astyle formatting
[ci skip]
2020-01-31 14:13:52 +01:00
fuzzelhjb 074d08e39e
Check specific Visual Studio configurations (#2503) 2020-01-31 07:08:38 +01:00
fuzzelhjb d82da987e5
Support clang tidy (#2486) 2020-01-30 07:14:17 +01:00
Aleksandr Serbin 11993ed999 Ticket 5607: Allow to exclude folders with glob pattern (#2498) 2020-01-24 07:06:09 +01:00
Sebastian c990d10ffa
Check for JSON error when parsing addon .json files + fixes (#2374)
* cppcheck.cpp: Check for JSON error when parsing addon .json files

This fixes that errors in JSON files given via `--addon=*.json` are
silently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().

* naming.json: Fix missing comma

* CLI: Fix naming violations detected by addon naming.py via naming.json

* Addon naming: Add argument for validating names of constants

* LIB: Rename functions/variables so they are valid, loosen naming rules

* GUI: Fix naming violations
2019-11-20 15:37:09 +01:00
Oliver Stöneberg eac040a00b Various clang-tidy fixes (#2192)
* use range loops

* removed redundant string initializations

* use nullptr

* use proper boolean false

* removed unnecessary continue from end of loop

* removed unnecessary c_str() usage

* use emplace_back()

* removed redundant void arguments
2019-09-25 15:25:19 +02:00
Oliver Stöneberg de9f489b08 use range loops / constness (#2181)
* use range loops / constness

* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
Daniel Marjamäki 8855978f8a Import project: Ignoring paths better 2019-09-12 09:32:24 +02:00
Daniel Marjamäki 0fbbe2ff23 Refactor load/write of cppcheck project. Reuse same string constants in cli and gui. 2019-08-09 21:15:02 +02:00
Daniel Marjamäki 3ec45acc43 astyle formatting
[ci skip]
2019-07-24 08:22:12 +02:00
Daniel Marjamäki 680fbfe612 Fix Cppcheck warning, unused value 2019-07-23 14:10:34 +02:00
Daniel Marjamäki 681bd0a911 GUI: Better settings for extended safe checks 2019-07-23 11:54:38 +02:00
Daniel Marjamäki c97dc79815 --addon: Use json for addon output 2019-06-24 19:29:43 +02:00
Daniel Marjamäki d69f002757 Fixed Cppcheck shadowVar warning 2019-04-30 20:19:21 +02:00
Daniel Marjamäki ece13033b2 dmake: use -isystem for externals to avoid compiler warnings 2019-04-19 14:52:49 +02:00
Daniel Marjamäki f26b15e5b5 astyle formatting
[ci skip]
2019-04-16 19:07:44 +02:00
bbennetts 7287ffe781 Handle 'arguments' sections in compile_commands.json (#1797)
* Handle 'arguments' sections in compile_commands.json

Previous code assumes 'commands' exists and ill assert if t does not.

* Correct typo checking for "arguments" rather than "commands"

* Use ostringstring rather than stringstream

* Add test deominstrating graceful degradation

* Add test for parsing "arguments" rather than "commands"
2019-04-15 20:03:42 +02:00
Daniel Marjamäki 83f8d7fab9 test/cli: Improved proj2 testing. fixed bug for relative path when vs-solution is imported with relative path 2019-04-15 19:00:57 +02:00
Daniel Marjamäki 15eba39963 test/cli: better handling of absolute ignored paths 2019-04-15 08:48:58 +02:00
Daniel Marjamäki 0cc2b5ca14 Fix wrong assignment 2019-04-14 07:27:23 +02:00
Daniel Marjamäki a0dd853642 analyzing one vs config (first debug config that matches platform) 2019-04-13 20:01:40 +02:00
Daniel Marjamäki dfe417c369 msvc compatibility: /constexpr/const/ 2019-04-11 21:06:37 +02:00
Daniel Marjamäki c9172b169a Improved handling of paths when importing cppcheck gui project 2019-04-11 21:02:49 +02:00
Daniel Marjamäki 7ede0feb2c Better handling for excluded paths 2019-04-11 18:46:57 +02:00
Daniel Marjamäki e27b54664e appveyor: /constexpr/const/ 2019-04-10 19:15:56 +02:00
Daniel Marjamäki 42fdb1f826 ImportProject: checkHeaders, checkUnusedTemplates, maxCtuDepth 2019-04-10 17:04:18 +02:00
Daniel Marjamäki bf9006737a Addons: Adding support in Cppcheck CLI to execute addons 2019-04-07 17:01:59 +02:00
Daniel Marjamäki 6d7ec98dd6 Import Project: import suppressions from gui project 2019-04-07 13:15:25 +02:00
Daniel Marjamäki 111db91387 ImportProject: Import excluded paths properly 2019-04-07 12:31:52 +02:00
Daniel Marjamäki 3701db96a3 Refactoring; use range for loop 2019-04-07 11:58:42 +02:00
Daniel Marjamäki 4a45655bc2 astyle formatting
[ci skip]
2019-03-27 18:15:12 +01:00
Oliver Stöneberg 88dc74929a Add defines set by compiler options when using compilation database (#1763)
* Add defines set by compiler options when using compilation database

sets __cplusplus and __STDC_VERSION__ based on -std and the defines for -municode, -fpie, -fPIE, -fpic and -fPIC

* Fixed merge
2019-03-27 10:23:04 +01:00
Daniel Marjamäki 7c6f21a158 astyle formatting 2019-03-26 20:51:04 +01:00
firewave ce11778a20 fixed parsing of -std= in compilation database 2019-03-26 19:02:08 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 8925299947 Attempt to fix MSVC compile issue 2019-02-01 00:09:07 +01:00
Daniel Marjamäki 53967c83e9 Fixed compile error 2019-01-31 23:52:48 +01:00
Daniel Marjamäki 961f66baff Fixed #8820 (import GUI project)
This has basic handling of GUI projects. But further work will be needed to handle addons etc, the plan is that we will be able to run addons from the command line soon.
2019-01-31 20:40:21 +01:00
Daniel Marjamäki 91435310cb Fixed #8925 (compile_commands.json: False positives in .mm (Objective-C++) files, that file type should maybe just be ignored) 2019-01-21 06:36:31 +01:00
Daniel Marjamäki c6b48b67f9 astyle formatting
[ci skip]
2019-01-11 16:37:12 +01:00
juremenart 45def06d59 fix trailing / from CMAKE JSON file and update unittests to cover both (w and w/o cases) (#1592)
* fix for CMake compile_commands.json input - director does not include trailing / which makes include directories wrong - so add it if it doesnt exist

* fix the bugfix for trailing / in the directory name of CMAKE JSON file, add also new test case to see if it works in both cases (with and without trailing /)

* revert adding accidental new line
2019-01-11 16:36:55 +01:00
Daniel Marjamäki ea0232653f Fixed #8563 (CPPCheck not able to locate file through compilation database) 2019-01-05 23:11:43 +01:00
Daniel Marjamäki 5f5c33baf2 Json: Use simple json library picojson to read compile databases 2019-01-05 17:45:07 +01:00
Daniel Marjamäki 86f9fb778b Fixed #8864 (compile commands: handle define with string value) 2018-11-25 15:09:23 +01:00
Daniel Marjamäki c7e5176284 Fixed #8061 (Problems with handling of --project argument) 2018-08-31 16:06:52 +02:00
Daniel Marjamäki a30941d885 Refactoring; Use range for loops 2018-08-19 17:27:41 +02:00
firewave 01ceb9bae7 fixed issue 8661: Misleading error message when compilation database is not recognized 2018-07-25 16:26:25 +02:00
amai2012 f947b3b025 Fix some doxygen warnings 2018-06-07 08:33:32 +02:00
bwoester 9b28499412 Import BCB6 projects (#1245)
* added support for reading borland c++ builder 6 projects

* add: fetch sysdefines from project
add: start providing bcb6 predefines (WIP)

* configure all the internal defines for BCB6

* make sure define strings don't start with ';'

* improvements on bwoesters BCB6 project support

- improved `*.bpr` XML handling by reducing the number of loops
- added `const` where aplicable
- optimized compiler argument parser performance
- reformatted code with provided astyle config

* - undo looping (keep it the same as the other implementations)
- keep parsing of cflags simple and separate from the synonym cleanup (no need for micro optimization in this place)
- move input validation to FileSettings::setDefines
- re-run astyle

* use [] instead of at() when comparing characters
2018-05-20 18:19:20 +02:00
PKEuS d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki 4836df9b1d Fix Token::Match pattern 2018-04-05 15:47:25 +02:00
Daniel Marjamäki e5db23fff3 project: import compile_commands.json generated by compiledb-generator 2018-04-05 15:40:59 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Matthias Krüger f009cfc845 fix some typos found by codespell. 2018-02-04 20:53:43 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 4a7f923fca astyle formatting
[ci skip]
2017-12-26 22:12:30 +01:00
baltth 6cbd69bf2d Fix define parsing from compile_command.json (#1013)
* Define value parsing from compile_commands.json

* Handle escaping in defined values

* Added test for importCompileCommands

* Added used defines for imported projects

* Fixed unnecessary string literals
2017-12-26 13:04:27 +01:00
Daniel Marjamäki cbb23f14d2 astyle formatting
[ci skip]
2017-11-11 11:13:45 +01:00
BNT cc4c9032de Support relative paths in Visual Studio projects properties (#995)
* transform relative paths with the help of the project dir to absolute
paths so the actual checker can resolve include paths defined in
property sheets

* fix coding style (one-line if)

* add existing importproject testfile to visual studio project to appear
when loading solution

* also explicitly export struct from within class to enable linking in
testrunner
2017-11-11 11:13:18 +01:00
Daniel Marjamäki 30e6a05aa0 ImportProject: Macro names in visual studio solutions/projects are case insensitive 2017-09-24 22:36:20 +02:00
Dmitry-Me 017e72d145 Read attribute once, better variable name 2017-08-28 19:11:04 +03:00
Dmitry-Me 61e290750e Read attribute once, better variable name 2017-08-24 18:28:52 +03:00
Dmitry-Me 3bcfc33014 Break loop early 2017-08-24 18:26:53 +03:00
Gennady Feldman 1c71c789d6 Stop parsing a define with value at the '='. (#937) 2017-08-09 20:02:25 +02:00
Daniel Marjamäki c0890b5255 ImportProject: Improve cppcheckDefines() 2017-08-08 22:57:11 +02:00
Daniel Marjamäki 9861240e79 ImportProject: Only expose Cppcheck Visual Studio defines for Cppcheck 2017-08-08 22:27:08 +02:00
Nekto89 729af993fe Fix absolute pathes import from vcxproj (#934)
Fixed importing vcxproj that contains files with absolute pathes.
2017-08-07 23:51:12 +02:00
Daniel Marjamäki ccea0b17b3 ImportProject: Read system includes and standard from compile database 2017-08-03 20:33:56 +02:00
Daniel Marjamäki 4eb43a5557 Fixed some recent regression in ImportProject for vcxproj projects 2017-08-02 22:51:22 +02:00
Daniel Marjamäki 60f819dbe7 Refactoring, use continue in loop 2017-08-02 08:00:52 +02:00
Daniel Marjamäki 5abf39503a Fix issue detected by Coverity, in case solution does not specify platform configuration the platform will be uninitialized 2017-08-02 07:59:25 +02:00
Daniel Marjamäki 05cdda3f4c Fix issue detected by Coverity, XMLElement::Attribute might return null 2017-08-02 07:56:22 +02:00
Daniel Marjamäki 0c8a899f59 Fix issue detected by Coverity, there was dead code because the wrong variable was used in condition 2017-08-01 11:45:51 +02:00
rsBNT fb7230ce05 importSln: Handle absolute paths for vcxproj 2017-07-10 11:12:48 +02:00
x29a 15b0eb42bd import solution: Support system environment variables 2017-06-27 12:41:25 +02:00
x29a b3a747d606 fix brainfart 2017-06-22 16:53:13 +02:00
x29a cde17935ea only use each include path once 2017-06-22 16:49:36 +02:00
Daniel Marjamäki 5efb2e3be0 Visual Studio: Skip unknown platforms (ARM, ARM64) 2017-06-01 13:13:23 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 1faca91c1d Added 'endsWith' utility function. This will make compiling the democlient easier. 2017-04-01 18:14:18 +02:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
bug22 3bb6a27988 Fixed #7791 (Cppcheck does not expand Visual Studio macros):
--project option will now accumulate defines/includes of all applicable
item definition groups, and will push back FileSetting items per project
configurations only
2016-12-07 18:03:46 +02:00
PKEuS 718fcfda46 Several small refactorizations 2016-12-06 20:02:43 +01:00
PKEuS 6dfbddef43 Avoid std::string::pop_back() as long as travis uses an ancient standard library version 2016-12-05 22:55:57 +01:00
PKEuS d665641a76 Refactorizations:
- use std::string::pop_back() and std::string::back()
- pass argument as const std::string&
- Moved iterator into for loop head
2016-12-05 14:50:01 +01:00
Daniel Marjamäki 1137c1e6b8 --project: fixing vcxproj load 2016-12-04 19:15:04 +01:00
Daniel Marjamäki 8b18b6229e --project: refactorings 2016-12-04 18:50:59 +01:00
orbitcowboy 4a439b9308 It is more efficient to provide a character instead of a string when searching for a single character. This has been fixed in various places. 2016-11-30 12:01:22 +01:00
Daniel Marjamäki 8be50fd822 --project: loading props when relative paths are given 2016-11-24 08:11:51 +01:00
Daniel Marjamäki 9043436e67 Visual Studio: Improved --project handling. 2016-11-20 22:44:50 +01:00
Daniel Marjamäki ee56fbe3a1 Fixed #7791 (Cppcheck does not expand Visual Studio macros) 2016-11-13 12:16:09 +01:00
Daniel Marjamäki 621c1e59c6 --project: handle SolutionDir and ProjectDir. This is a partial fix for #7791. custom build macros are still not handled. 2016-11-11 16:22:14 +01:00
amai2012 7cc2124176 Fix crash in parsing solution/project 2016-08-24 12:17:54 +02:00
Daniel Marjamäki bea35ee04c GUI: Select configuration that is checked 2016-08-21 15:57:38 +02:00
Daniel Marjamäki fe2fa4d343 GUI: Only check current platform when checking sln/vcxproj file 2016-08-20 13:47:25 +02:00