Commit Graph

476 Commits

Author SHA1 Message Date
Daniel Marjamäki 1fe7cd348a exename: Set proper exename when cppcheck is executed from PATH and argv[0] does not contain path information 2022-03-21 18:35:53 +01:00
Daniel Marjamäki 10f93e31ef cli: in linux set proper exename value when cppcheck is executed from PATH and argv[0] does not have path information 2022-03-19 11:27:59 +01:00
Oliver Stöneberg 51371f7929
added CMake option USE_THREADS to be able to use threads instead of fork() / cleanups (#3852) 2022-02-23 09:04:35 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
orbitcowboy 9483ea4198 Fixed typo in CLI output. 2022-01-18 11:46:34 +01:00
Oliver Stöneberg cc24d6fcef
Fix #9162 (Invalid --project files do not give any error) (#3177) 2021-12-19 12:36:11 +01:00
Leon De Andrade 5b52f4946a
Implement support for passing multiple file filters (#3479) 2021-11-23 22:51:45 +01:00
Daniel Marjamäki ed4d2c21e6 Load cppcheck.cfg in FILESDIR if that is specified 2021-11-05 20:37:48 +01:00
Daniel Marjamäki b2f1a0aaa9 Loading cppcheck.cfg after --project to extend settings provided by project 2021-11-05 18:57:26 +01:00
Oliver Stöneberg 61a2b89034
streamlined message/error printing of CmdLineParser (#3524)
* cmdlineparser.cpp: removed message about deprecated --std=posix

* streamlined message/error printing of CmdLineParser

* test-helloworld.py: adjusted expected test result
2021-10-30 13:30:48 +02:00
Daniel Marjamäki 0a5b7b2af5 Make it possible to configure default addons in a cppcheck.cfg file.
Example:
{
    "addons":["cert"]
}

With that cppcheck.cfg file cppcheck will always run the "cert" addon. Explicit options such as --addon=cert will not be needed.
2021-10-13 20:02:48 +02:00
Ronald Hiemstra 2e682b1bf3
Update help text in cmdlineparser.cpp (#3464) 2021-09-22 20:06:42 +02:00
Daniel Marjamäki ca047e57bf Switch from http to https on our sourceforge webpage 2021-08-28 12:46:54 +02:00
Alfi Maulana aab5b39e2d
feat: add support for .ipp and .ixx extensions (#3383) 2021-08-09 10:46:56 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Paul Fultz II 8dc1fa7a59
Add colors to CLI reporting (#3304) 2021-07-08 21:21:35 +02:00
Daniel Marjamäki d2d2124238 Revert "Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again."
This reverts commit 207361b174.
2021-04-30 16:47:02 +02:00
Daniel Marjamäki 207361b174 Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again. 2021-04-21 18:59:48 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
Daniel Marjamäki 3502036b14 Usability: Fixed loading of platform file placed in same path as project file 2021-03-05 08:39:09 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS cf1937294a Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
2021-02-20 12:58:42 +01:00
Philipp Kloke ef82897af5 Refactorization: Use std::string::pop_back
Merged from LCppC.
2021-02-17 22:39:29 +01:00
Oliver Stöneberg 0df10c3cb5
enabled daca warnings in self-check (#3075) 2021-01-28 22:16:51 +01:00
Oliver Stöneberg 7c5015d54e
fixed --check-library not showing anything on its own (#3035) 2021-01-12 20:53:05 +01:00
Oliver Stöneberg ac7647fcd8
some self-check suppression cleanups (#3032) 2021-01-09 20:32:38 +01:00
Daniel Marjamäki e7c462b827 Refactoring; Avoid 'unsigned' 2020-12-27 21:05:31 +01:00
Daniel Marjamäki 1b0ca0811f Bug hunting; option to set function analysis max time 2020-12-18 19:59:10 +01:00
niooss-ledger 0dbff657ab
Add missing \n in help (#2941)
cppcheck --help printed:

    --project-configuration=<config>
                         If used together with a Visual Studio Solution (*.sln)
                         or Visual Studio Project (*.vcxproj) you can limit
                         the configuration cppcheck should check.
                         For example: --project-configuration=Release|Win32    --max-configs=<limit>
                         Maximum number of configurations to check in a file
                         before skipping it. Default is '12'. If used together
                         with '--force', the last option is the one that is
                         effective.

A "\n" was missing before option --max-configs, and the doublequotes did
nothing.
2020-12-12 08:30:10 +01:00
Georgy Komarov 4517c9aae6
Add Elbrus E1C+ platform (#2913) 2020-11-20 10:36:13 +01:00
Daniel Marjamäki 9c27ba835d astyle formatting 2020-11-19 21:25:49 +01:00
Lars Even Almaas 5d9b22635a
Added enhanced pic8 platform (#2910) 2020-11-19 12:13:19 +01:00
Lars Even Almaas 09140f4655
Added PIC and MIPS platforms. (#2909) 2020-11-19 08:11:59 +01:00
Daniel Marjamäki b7f812739c astyle formatting 2020-11-13 15:52:57 +01:00
Falital 2e2d4a0055
Added Hash to plist file names (#2898) 2020-11-13 15:52:24 +01:00
Daniel Marjamäki d615dba638 Write 'inconclusive:' in daca2 warnings 2020-09-26 11:02:10 +02:00
Oliver Stöneberg fb37137216
extended the --clang command-line option so you can specify a custom … (#2734) 2020-09-06 07:46:51 +02:00
Daniel Marjamäki da1de50deb Clang: The clang parser import should be considered to be an experimental feature for now. There are many problems to solve. 2020-09-04 18:30:29 +02:00
Daniel Marjamäki fac8e52379 Tweked --help output 2020-06-14 17:23:29 +02:00
Paul Fultz II eed2e829a7
Revert "Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list." (#2666)
This reverts commit 187cde183d.
2020-05-30 11:23:22 +02:00
PKEuS 187cde183d Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list. 2020-05-29 21:21:07 +02:00
Daniel Marjamäki 6b7b3eda2f Tweaked --help; added --bug-hunting 2020-05-28 08:38:53 +02:00
Daniel Marjamäki 47ee126aa9 Tweaked --help output 2020-05-28 08:33:50 +02:00
Daniel Marjamäki 299e11c991 Fixed Cppcheck warnings 2020-05-19 21:55:28 +02:00
PKEuS e92a95150a Refactorization: Use emplace methods in CLI 2020-05-19 08:35:12 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki 32cbbb09ed cli: publish the --clang option 2020-05-08 20:52:42 +02:00
Daniel Marjamäki 5a9e81897a ExprEngine: Document how it works 2020-04-30 12:18:49 +02:00
Daniel Marjamäki 6d7dd7400d Refactoring; Sort options alphabetically. Removed unused --check-diff functionality. 2020-04-26 10:22:12 +02:00
Daniel Marjamäki 05dcb9a435 Clang import; Allow Clang import without a Cppcheck build dir 2020-04-21 22:26:34 +02:00
Daniel Marjamäki 7921aa891a Thank you Z3 2020-04-20 20:34:47 +02:00
Daniel Marjamäki 5626d22835 Tweak message. --std=posix will be deprecated in 2.05 2020-04-19 21:25:20 +02:00
Lukas Grützmacher 095fd2bc62
add command line option to select single project configuration of loaded solution (#2523)
* add command line option to select single project configuration of loaded solution

* Update cmdlineparser.cpp

* Update manual.md

* fix initialization
2020-04-19 18:19:28 +02:00
Sam Lane 60f9fefcd4
Add Support For Configuring Addon Python Interpreter Version (#2591) 2020-04-05 10:57:28 +02:00
Daniel Marjamäki 7577bdb1df DACA: Try to avoid some crashes/hangs for the most crazy code so we can focus on most serious bugs first 2020-03-31 11:33:38 +02:00
Daniel Marjamäki cea17acd92 CLI: A --bug-hunting flag is needed for the tests 2020-02-12 16:30:18 +01:00
Daniel Marjamäki f31447943c CLI: Remove experimental --safe-classes, --safe-functions, --bug-hunting, --debug-bug-hunting 2020-02-10 20:27:25 +01:00
Daniel Marjamäki d2dd3930ae GUI: Generate Clang files 2020-02-02 11:05:30 +01:00
Daniel Marjamäki 632dc0f141 GUI: Select parser; Cppcheck or Clang 2020-02-02 10:45:42 +01:00
Daniel Marjamäki 0eccffe8e3 --clang; require that --cppcheck-build-dir. output files are needed. 2020-01-19 12:33:17 +01:00
Daniel Marjamäki 7820b5dbcc Rename 'Verification' to 'Bug hunting' 2020-01-14 21:17:07 +01:00
Daniel Marjamäki e78775fac3 astyle formatting
[ci skip]
2020-01-10 11:31:12 +01:00
fuzzelhjb fcd5cda97f Check selected files from project (#2378) 2020-01-10 08:57:37 +01:00
Daniel Marjamäki b03bdfaf72 Import Clang ast dump (experimental) 2020-01-05 15:12:53 +01:00
Daniel Marjamäki 48be067dd1 Verification; Added --verify-diff option 2019-12-31 12:05:08 +01:00
Daniel Marjamäki d16ea3293e Verification; Fix testing 2019-12-28 22:09:16 +01:00
Daniel Marjamäki 49ed1a82b4 Verification; save report in custom file 2019-12-27 19:25:06 +01:00
Daniel Marjamäki 4b4f7ea60b Verification; Updated report 2019-12-27 19:05:22 +01:00
Dmitry-Me 4a8ced29c4 Fix typo 2019-12-16 18:10:40 +03:00
Francesc Elies cbd9713006 [cli] help misses `--suppress-xml` description (#2436) 2019-12-09 19:01:15 +01:00
Adrien Chardon 91dd8d3b6f Improve cli --help (#2387) 2019-11-29 11:29:04 +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
Armin Müller 130ebe4b85 Typos found by running "codespell" (#2380) 2019-11-19 20:02:24 +01:00
Daniel Marjamäki 81fff2edf1 Fixed #9464 (Import compile database; only check given configuration) 2019-11-09 17:51:42 +01:00
Sebastian 3e4dd9b354
cmdlineparser.cpp: printHelp(): Replace deprecated option in example (#2290)
`--std=posix` is deprecated and will be removed in the future.
See commit cb06aebdab.
2019-10-22 15:07:30 +02:00
Daniel Marjamäki 40c3e68e07 ExprEngine: Add --debug-verify, fixed handling of global arrays 2019-09-29 15:00:54 +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 2d651b09fc ExprEngine: Add new experimental path-sensitive data flow analysis. Initially used for 'verification' but could possibly later be used as a complement in the normal analysis. The code is work-in-progress and hacky! 2019-09-17 21:00:59 +02:00
orbitcowboy 4f94e4fff8 cmdlineparser: Fixed typo inconlusive ==> inconclusive 2019-08-20 00:31:30 +02:00
Daniel Marjamäki d95f29b23a Fixed test/cli 2019-08-18 12:51:32 +02:00
Daniel Marjamäki 6431d1c58a cli: Change default --template format, Cppcheck will now use the gcc template by default. Added --template=cppcheck1 format. 2019-08-18 07:50:50 +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
amai2012 b0fbbb5aa7 Convert SHOWTIME_MODES to enum class 2019-07-31 22:35:51 +02:00
Daniel Marjamäki 45d1ca6f7c Safe checks: Clarify a warning message 2019-07-25 17:19:51 +02:00
Daniel Marjamäki c8bc88e7e2 Fix compiler error 2019-07-23 13:14:08 +02:00
Daniel Marjamäki 783f7f1648 Rename safeValues to unknownValues 2019-07-11 16:05:48 +02:00
Daniel Marjamäki 05d35b063d Function return: Extra check of safe function return values 2019-07-10 20:00:21 +02:00
Daniel Marjamäki c9906125de Safe functions: Check more possible function argument values 2019-07-10 16:59:05 +02:00
Daniel Marjamäki 45d874bf75 Fixed #8929 ('cppcheck -E' should output valid/compileable code) 2019-05-11 14:00:42 +02:00
Daniel Marjamäki fe04c15c9e CheckStl: Modernize the recommendations. string::starts_with is more intuitive than string::compare 2019-05-05 10:35:44 +02:00
Daniel Marjamäki 7260bdd6d8 Fixed Cppcheck shadowVar warnings 2019-04-30 21:01:18 +02:00
Daniel Marjamäki b94f4176f1 test/cli: execute addon 2019-04-14 15:00:03 +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 b04d1815ed Add -std=c++17 and allow semicolon in 'if ()' 2019-04-12 09:10:25 +02:00
Daniel Marjamäki cb06aebdab Removed --std=posix. From now on, if you use --library=posix then the posix checks will be enabled. 2019-04-12 06:47:28 +02:00
Daniel Marjamäki f6b410b469 GUI: add setting for 'checkHeaders', 'checkUnusedTemplates' and 'maxCtuDepth' to project 2019-04-10 16:49:24 +02:00
Daniel Marjamäki 58d88e149f Add --addon=<addon> command line option 2019-04-07 17:44:43 +02:00
Daniel Marjamäki 7ec8ce2ece --help: arguments should be written in alphabetical order 2019-04-07 13:20:23 +02:00
Daniel Marjamäki 111db91387 ImportProject: Import excluded paths properly 2019-04-07 12:31:52 +02:00
Daniel Marjamäki a3257349b9 astyle formatting
[ci skip]
2019-03-17 10:50:06 +01:00
Daniel Marjamäki c7155a8e08 Removed '--experimental-fast' flag 2019-03-17 08:19:56 +01:00
Sebastian 08d41ab8af
Load std.cfg before all other libraries (#1740)
- CLI: Save the libraries that should be loaded to a list and load them
after the std.cfg has been loaded.
- GUI: Load std.cfg (and windows.cfg / posix.cfg when applicable) before
setting other options and loading the other libraries.
In the project-file-dialog the std.cfg is searched first. If some
other library fails to load is is retried with first loading std.cfg.
- boost.cfg: Enable containers that depend on std containers.
2019-03-15 06:59:37 +01:00
Daniel Marjamäki fda0f52424 Add --remove-unused-templates flag to remove all unused templates 2019-03-05 14:58:02 +01:00
Daniel Marjamäki e4249d3811 Clarify help text for --remove-unused-included-headers 2019-03-04 20:07:11 +01:00
Daniel Marjamäki 3675318208 Added --remove-unused-included-templates option 2019-03-04 19:10:49 +01:00
Daniel Marjamäki f5c274b3b1 Added '--check-headers=no' option. 2019-03-02 19:52:15 +01:00
Daniel Marjamäki 6717f49f20 Try to give some credit to the 3rd party libraries we use. 2019-02-10 17:16:53 +01:00
Daniel Marjamäki 4f232e41dd Add --experimental-fast option 2019-02-09 14:40:50 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 437800f46d CLI: Added --max-ctu-depth 2019-02-03 17:51:36 +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
IOBYTE f0cfe03f7b template simplifier: add cli --debug-template option to print the parsed template information (#1598) 2019-01-14 08:29:32 +01:00
IOBYTE 24f2e288d5 Make --debug alias --debug-normal for backwards compatibility. (#1414) 2018-10-09 14:47:50 +02:00
orbitcowboy 361ae311f6 cmdlineparser: Stop processing in case an invalid path for --includes-file=<PATH> and --config-excludes-file=<PATH> is provided. 2018-09-04 16:37:43 +02:00
Kamil Dudka 0ca6ab1a71 ErrorLogger: add {cwe} (#1341) 2018-08-21 13:58:19 +02:00
Daniel Marjamäki 67e9a9cb25 naming convention conformance 2018-08-18 15:52:18 +02:00
Daniel Marjamäki 5ebfa035aa Updated variable names according to naming convention 2018-08-18 15:45:42 +02:00
Daniel Marjamäki ddbe4b89b5 Renamed --debug to --debug-simplified 2018-08-05 11:19:20 +02:00
firewave 01ceb9bae7 fixed issue 8661: Misleading error message when compilation database is not recognized 2018-07-25 16:26:25 +02:00
orbitcowboy f27baf0956 cli: stop processing in case an invalid or non-existant rule-file is provided. 2018-07-25 08:25:18 +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
Daniel Marjamäki cdf7ea0a33 daca2: remove {code} in results 2018-04-24 16:16:45 +02:00
Daniel Marjamäki cf4367d013 daca2: remove 'inconclusive' keyword 2018-04-24 11:06:25 +02:00
Daniel Marjamäki 7c5058a42d Refactoring. Rename methods 2018-04-23 12:39:47 +02:00
Daniel Marjamäki f058d9ad08 CLI: Added more fields for --template and added a new --template-location. The gcc predefined template now matches latest gcc better. 2018-04-23 12:21:18 +02:00
PKEuS b596b0d549 Refactorization: pass std::string directly to std::*fstream 2018-04-11 09:50:42 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
jrp2014 b813a6d407 Refactoring 2018-04-04 21:11:23 +02:00
jrp2014 07b5afcdc6 Improve constness 2018-04-04 21:02:13 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Daniel Marjamäki e9fefcac46 gcc 4.5 compatibility 2018-03-30 21:04:32 +02:00
Daniel Marjamäki 46307df9b6 Renamed method 2018-03-11 15:06:08 +01:00
Daniel Marjamäki 780bd7e63e More flexible loading of platform files, when using --platform it should not be necessary to provide the full path 2018-02-09 16:22:22 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
amai2012 2f2172e1a7 #8178 Remove all references to XML version 1 2017-11-22 10:49:59 +01:00
Daniel Marjamäki 9f306cf3aa Added C++14 option 2017-09-22 22:00:00 +02:00
Dmitry-Me b6c218b7af Resolve CID 1365360
Do not ignore failures to load windows.cfg
2017-08-22 18:09:02 +03:00
Ayaz Salikhov 3e7f4c214d minor code cleanup 2017-08-13 13:27:32 +02:00
orbitcowboy 61e47208eb Removed hard coded avr8 platform and moved it into a platform file (avr8.xml). 2017-08-09 11:58:27 +02:00
Daniel Marjamäki 91eb0f1fad Removed XML version 1 2017-07-29 18:56:22 +02:00
Daniel Marjamäki 1f48b082d1 CLI: Add --output-file flag so results can be written to file directly. 2017-05-30 15:04:28 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 0262020707 --template: Removed 'clang' and renamed 'cppcheck2' to 'daca2' 2017-05-25 05:24:42 +02:00
Daniel Marjamäki a3c0eecccf Added --template=cppcheck2 output format 2017-05-23 12:19:11 +02:00
orbitcowboy ffe6582e6b Added platform support for Atmel AVR 8 bit microcontrollers. 2017-05-22 14:46:19 +02:00
Daniel Marjamäki b53a2ff9eb Command line: Added --template=clang formatting 2017-05-19 17:09:49 +02:00
Daniel Marjamäki 6967d68137 Add --plist-output argument 2017-05-16 14:07:23 +02:00