Commit Graph

645 Commits

Author SHA1 Message Date
Daniel Marjamäki bdc621b7a3 Clang import; MaterializeTemporaryExpr 2020-01-20 21:27:49 +01:00
versat 0cf82d6d45 cppcheck.cpp: Fix reserved name "stderr"
Using "stderr" as variable name results in build errors on Windows.
2020-01-20 11:12:23 +01:00
Daniel Marjamäki 8ac2cdd9ff Clang import; If there are syntax errors then abort analysis 2020-01-19 17:30:57 +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 f7a30fc99f Rename Verification => Bughunting 2020-01-18 07:25:57 +01:00
Daniel Marjamäki 7820b5dbcc Rename 'Verification' to 'Bug hunting' 2020-01-14 21:17:07 +01:00
Daniel Marjamäki 1e207e42c5 CppCheck: Try to handle '"' properly in split() 2020-01-12 17:13:26 +01:00
Daniel Marjamäki 380cc78077 Clang; Run ValueFlow 2020-01-11 14:00:41 +01:00
Daniel Marjamäki 6b983a9587 Revert ValueFlow changes, there was unexpected problems in testrunner 2020-01-11 13:11:19 +01:00
Daniel Marjamäki 052eaba632 Clang; run ValueFlow analysis 2020-01-11 13:04:51 +01:00
Daniel Marjamäki 9c38a659a1 Clang import; Fixed CXXConstructExpr without child 2020-01-11 12:16:48 +01:00
Daniel Marjamäki 4c778e0999 Clang import; Rename files/namespace 2020-01-10 16:29:06 +01:00
Daniel Marjamäki 729fca8728 Clang import; handle locations better, only expand function bodies in source file 2020-01-10 14:59:34 +01:00
Daniel Marjamäki 34a26c7dd7 Clang import; Pass include paths to clang 2020-01-09 19:15:01 +01:00
Daniel Marjamäki 98e700e30d Clang import; Tweaks 2020-01-09 14:13:39 +01:00
Daniel Marjamäki 90e7a94ff4 Clang importer; Allow throw 2020-01-09 13:58:14 +01:00
Daniel Marjamäki 3d2d4c5cbd Clang import; Tweaks 2020-01-09 10:49:47 +01:00
Daniel Marjamäki c4c929a6a7 Clang import: StringLiteral, funcdecl3, determine includes with clang -v 2020-01-08 16:36:51 +01:00
Daniel Marjamäki 0b765cd253 Clang importing; Use ValueFlow 2020-01-05 19:21:13 +01:00
Daniel Marjamäki 211af1d4fe Clang import: debug output 2020-01-05 16:58:13 +01:00
Daniel Marjamäki bc17b9a1be Importing Clang ast dump: Run ValueFlow analysis 2020-01-05 16:23:02 +01:00
Daniel Marjamäki b03bdfaf72 Import Clang ast dump (experimental) 2020-01-05 15:12:53 +01:00
Daniel Marjamäki 4b4f7ea60b Verification; Updated report 2019-12-27 19:05:22 +01:00
Daniel Marjamäki caab1e61bb Fixed #9542 (Better error handling for --addon) 2019-12-17 12:00:01 +01:00
Maksim Derbasov 68a67a910e Remove .dump file after plugins execution (#2451) 2019-12-17 08:40:59 +01:00
Sebastian 95696ead23
Catch preprocessor errors possibly issued during loading files (#2430)
* Also catch preprocessor errors possibly issued during loading files

Currently only errors that are issued during preprocessing are caught.

* Bump simplecpp, implement suggestions

Use return value checking instead of catching an exception for calling
Preprocessor::loadFiles().
Handle new enum value simplecpp::Output::EXPLICIT_INCLUDE_NOT_FOUND
where the corresponding enum is used in Cppcheck.

* Use "noloc" location if an explicit include can not be opened
2019-12-09 19:16:55 +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
Daniel Marjamäki 81fff2edf1 Fixed #9464 (Import compile database; only check given configuration) 2019-11-09 17:51:42 +01:00
Oliver Stöneberg 9028b4a81d do not access static methods through instance (#2189) 2019-09-20 21:54:30 +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
Daniel Marjamäki a5ba82c2d3 Fixed #9260 (--template=gcc does not work correctly with -j) 2019-08-18 16:33:32 +02:00
Daniel Marjamäki d95f29b23a Fixed test/cli 2019-08-18 12:51:32 +02:00
Daniel Marjamäki 2d9a131817 Refactoring: Rename variables. Do not use leading _. Renamed 'col' to 'column' 2019-08-18 12:19:05 +02:00
Daniel Marjamäki a17f2a6f05 Compiling/Installing : The CFGDIR parameter was removed. Use FILESDIR instead. 2019-08-17 10:53:07 +02:00
Daniel Marjamäki 6a260929e2 CLI: error id from addon is <addon>-<id> 2019-08-10 07:43:47 +02:00
amai2012 b0fbbb5aa7 Convert SHOWTIME_MODES to enum class 2019-07-31 22:35:51 +02:00
Daniel Marjamäki d11d6f112e Detect shadowed arguments 2019-07-17 17:08:42 +02:00
Daniel Marjamäki 341406ab17 Fixed Cppcheck warning; ::AddonInfo::getFullPath can be static 2019-06-29 07:59:55 +02:00
Daniel Marjamäki c97dc79815 --addon: Use json for addon output 2019-06-24 19:29:43 +02:00
Daniel Marjamäki de9c999d79 Better handling of spaces in paths 2019-06-22 19:20:15 +02:00
Daniel Marjamäki 59c7be307c Travis: Fix test/cli testing 2019-06-16 19:11:12 +02:00
Daniel Marjamäki ba0a75881a Refactor AddonInfo::getAddonInfo 2019-06-16 15:46:20 +02:00
eivindt 44670005ea Record C/CPP/Posix Standard used for cppcheck in dump file / use this for misra checking (#1782)
* Add cmd parameter for choosing between C90 and C99

Misra specifies different requirements to the uniqueness of
macros/enums/variables depending on what C standard
that's being used.

* Add standards configuration to each dump file

Read standards config from misra addon to decide what rules to use.

* Posix as standard setting should be deprecated.  Don't include this in the xml

* Rewritten to use a switch
2019-06-14 12:06:57 +02:00
eivindt 5dd7dacfd7 Fix small error using correct name for addon script when specified in json file (#1881) 2019-06-13 14:11:21 +02:00
Daniel Marjamäki b3a46e72dc Fix and test syntaxError suppression 2019-05-01 11:54:13 +02:00
Daniel Marjamäki 2e694f38c8 Refactoring; Use const reference instead of const 2019-04-29 08:53:36 +02:00
Daniel Marjamäki 45e5edce16 Fixed Cppcheck shadowVariable warning 2019-04-28 12:04:44 +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 a18025c95d test/cli: tweaks for running it in windows 2019-04-14 15:53:32 +02:00
Daniel Marjamäki b94f4176f1 test/cli: execute addon 2019-04-14 15:00:03 +02:00
Daniel Marjamäki b1b5b27b4e addons: write column in error message(s) 2019-04-13 10:22:13 +02:00
Daniel Marjamäki 2015f25a84 addon: Fix parsing of addon output 2019-04-10 18:28:46 +02:00
Daniel Marjamäki cf6f886a68 Addons: try to create dump file in cppcheck build dir 2019-04-09 07:05:41 +02:00
Daniel Marjamäki 1f68e038be Addons: Describe running addons from cppcheck in the manual 2019-04-08 21:31:38 +02:00
Daniel Marjamäki 44dcbda88e Addons: Fixed handling of addon configuration 2019-04-08 19:42:16 +02:00
Daniel Marjamäki 4bb06eceeb astyle formatting
[ci skip]
2019-04-08 18:53:14 +02:00
Daniel Marjamäki 50a5763cf5 Addons: Make it possible to configure any addon with json 2019-04-08 18:07:23 +02:00
Daniel Marjamäki a508b2abfd Addons: Add same handling in Windows as in Linux 2019-04-07 19:53:34 +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 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
Daniel Marjamäki 3dc34f1515 Disable all simplified checks 2019-03-16 09:17:50 +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 23599428cb Clarify Cppcheck output 2019-02-03 19:49:27 +01:00
Daniel Marjamäki 437800f46d CLI: Added --max-ctu-depth 2019-02-03 17:51:36 +01:00
Daniel Marjamäki 04d3672bde Fixed #7203 (Better syntax error, handle array declaration with @) 2019-01-01 09:45:41 +01:00
Daniel Marjamäki 271763e680 CTU: Refactoring 2018-12-25 21:11:23 +01:00
Daniel Marjamäki c7993df4ff Refactoring; Use range for loops 2018-12-25 11:47:45 +01:00
Daniel Marjamäki d97851b9db change severity for 'unknown macro' to error for now. 2018-11-13 21:08:45 +01:00
Daniel Marjamäki 152be6df63 Report 'unknown macro' as information message with id unknownMacro 2018-11-13 20:14:56 +01:00
Daniel Marjamäki 307a19d17e Refactoring: Use range for loop 2018-11-05 09:49:28 +01:00
alex babafd75e3 Added support for -U option to the GUI. 2018-10-09 15:05:05 +02:00
orbitcowboy e25bf187ad Attempt to fix regression for pcre_free_study(). 2018-09-26 08:07:26 +02:00
orbitcowboy bdb136de02 PCRE: Fixed unintended message when HAVE_RULES=yes was set. 2018-09-24 09:00:09 +02:00
Daniel Marjamäki 3a007cbcbf astyle formatting
[ci skip]
2018-09-23 17:04:52 +02:00
orbitcowboy 29d7872440
Improvements for PCRE API usage (HAVE_RULES=yes) (#1384)
* PCRE: added pcre_study to improve regex matching speed.

* PCRE: catch return values from pcre_exec and return an error message in case it fails.

* Formatted the code. There are no functional changes intended.

* PCRE: decode internal PCRE error messages.

* Integrating comments from PR.

* PCRE: Use pcre_study() only in case PCRE_CONFIG_JIT is defined.

* PCRE: Fixed potential resource leak. In case prce_compile worked, but pcre_study() returns an error, the allocated resources by pcre_compile() can be freed.

* Make travis happy.

* PCRE: Improved output message format.

* PCRE: Attempt to be compliant to older PCRE versions and fix travis build.
2018-09-23 14:27:46 +02:00
Daniel Marjamäki 0dfedd977e CppCheck: Minor tweak. Do no clear internalErrorFound, instead ensure that it's not written upon suppression 2018-09-10 06:02:01 +02:00
Daniel Marjamäki 509cb35168 astyle formatting
[ci skip]
2018-09-08 15:19:32 +02:00
tam do thanh 7ad09b44c3 Ticket 7792: Suppression both exit_code and syntaxError when call cppcheck suppressions (#1345) 2018-09-08 11:09:49 +02:00
Kevin Kendzia c5ebf26f9f cppcheck.cpp: fix suppression of syntaxError (#1333)
* cppcheck.cpp: fix suppression of syntaxError

* test: add supression test for syntaxError while file read
2018-08-17 10:05:25 +02:00
Daniel Marjamäki 223a116f24 The checksum in analyzer info files will now depend on the suppressions 2018-08-09 09:27:26 +02:00
Daniel Marjamäki ddbe4b89b5 Renamed --debug to --debug-simplified 2018-08-05 11:19:20 +02:00
Daniel Marjamäki e962f57a99 Rename private member variables 2018-06-17 19:20:07 +02:00
Daniel Marjamäki fe0bd8ff6c Renamed exitcode to mExitCode 2018-06-17 07:43:25 +02:00
Daniel Marjamäki 6ff6f0ae45 Renamed cfg to mCurrentConfig 2018-06-17 07:40:13 +02:00
Daniel Marjamäki cb0bea1749 Renamed _simplify 2018-06-17 07:37:10 +02:00
Daniel Marjamäki b90d1bc020 Renamed member fileInfo to mFileInfo 2018-06-17 07:36:05 +02:00
Daniel Marjamäki c5e0576961 Renamed analyzerInformation 2018-06-17 07:31:34 +02:00
Daniel Marjamäki 54ba0e58c1 Renamed _useGlobalSuppressions 2018-06-17 07:29:07 +02:00
Daniel Marjamäki b992b4a4f0 Renamed _errorList 2018-06-16 23:31:16 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
orbitcowboy 33777c5b72 Improved const correcntess of local variables. 2018-05-29 13:24:48 +02:00
Daniel Marjamäki d7dfa29864 Preprocessor: only throw errors upon request. 2018-05-28 14:11:59 +02:00
Daniel Marjamäki 2ffbb37cee modernize cppcheck.cpp, use range for loops 2018-05-22 23:22:46 +02:00
Daniel Marjamäki 2b14b71c93 Updated output when Cppcheck fails to find valid configurations 2018-05-17 10:27:05 +02:00
amai2012 7062df5d78 #8585 --check-config aborts due to unhandled simplecpp::Output exception 2018-05-17 08:59:10 +02:00
Daniel Marjamäki 6bd4bdb0f9 Updated 'noValidConfiguration' message. It should not write this message when there is no code. It should be possible to see the preprocessor errors otherwise it is hard to fix the configuration. 2018-05-15 15:42:54 +02:00
PKEuS 3d860e6f36 Bump simplecpp 2018-05-14 13:00:22 +02:00
Daniel Marjamäki 1e7c1841f7 Fixed #8515 (Wrong info message about unmatched suppression) 2018-05-11 09:01:24 +02:00
Daniel Marjamäki c266688784 Fix syntax error 2018-05-08 10:21:03 +02:00
Daniel Marjamäki 315dc2ad8a only show information message when information messages are enabled 2018-05-08 09:47:14 +02:00
Daniel Marjamäki 0bff08ca44 Fixed #1378 (#error macro makes unrelated errors undetectable) 2018-05-06 22:02:23 +02:00
rebnridgway 995b496ddf Add suppressions to the XML dump (#1166)
* Added parsing suppressions from dump xml.

* Added code to dump suppressions to an xml file

* Added declaration for dump function

* Suppressions will now be written to the xml file when a dump is requested

* Fixed syntax error

* Removed excess whitespace

* Fixed indentation to be consistent

* Fixed indentation to be consistent

* Fixed indentation to be consistent

* Added missing include for ErrorLogger::toXml

* Fixed suggestions from pull request #1166

Switched to using ranged for loop to iterate through suppressions.
Made the line number attribute optional, rather than 0 if not specified.  This means when Python deserialises it it will be None, which is more pythonic.

* Implemented checking suppressions in reportError

This modification expects suppressions and a function to be called to write a line of output to be passed in.  The function checks if any of the suppressions match the warning (with the new Suppression.isMatch function) and if so returns None.  This change maintains the old behaviour of returning the warning text, but adds the possibility of returning None if the warning was suppressed.

* Fixed code quality warnings

* Removed more extraneous whitespace
2018-04-24 22:19:24 +02:00
Daniel Marjamäki 8cc7131ee9 Rename CppCheck::processFile to CppCheck::checkFile 2018-04-21 13:28:26 +02:00
PKEuS b596b0d549 Refactorization: pass std::string directly to std::*fstream 2018-04-11 09:50:42 +02:00
PKEuS b15cc3f236 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:54:39 +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
IOBYTE d68f07e50c Add purgedConfiguration to list of error ids. (#1087)
purgedConfiguration was not showing up in the GUI supression list.
2018-02-10 22:30:49 +01:00
Daniel Marjamäki db274e8308 Fix testrunner in cygwin 2018-02-10 15:34:49 +01:00
Daniel Marjamäki 71511f3131 Refactor f487182 2018-02-06 08:59:36 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ivan Maidanski 97ffec85c0 Fixed #7502 (Correct exit code if never used function is found) (#1026) 2018-01-12 08:24:01 +01:00
PKEuS b684e1f202 Updated AStyle to version 3.0.1 2018-01-08 20:20:33 +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
Ayaz Salikhov be2c65eb58 Simplify int vs bool 2017-10-08 07:54:39 +02:00
Daniel Marjamäki 5c7cf584ef bump simplecpp 2017-09-12 22:42:10 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
Daniel Marjamäki 9861240e79 ImportProject: Only expose Cppcheck Visual Studio defines for Cppcheck 2017-08-08 22:27:08 +02:00
Daniel Marjamäki 5fa7a4edc4 GUI: save dumpfiles in buildDir if possible 2017-08-03 22:54:38 +02:00
Daniel Marjamäki 61eccd7070 Fix dump 2017-08-03 18:03:59 +02:00
Daniel Marjamäki 1961d6d0f7 CppCheck: make sure preprocessor syntax errors are reported 2017-05-28 20:34:58 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
uburuntu d41d091c07 ENH: perfomance: seeking of one char is more efficiently 2017-05-27 04:15:54 +02:00
Daniel Marjamäki 899615c1e4 update simplecpp includes
[ci skip]
2017-05-18 22:26:07 +02:00
Daniel Marjamäki 9d08cbf4d2 Fix 'make checkcfg' 2017-05-18 22:10:08 +02:00
Daniel Marjamäki 340c687cbf Revert "Use 'Stringification => Tokenizer' until some issues have been fixed"
This reverts commit c2727691a4.
2017-05-18 21:53:25 +02:00
Daniel Marjamäki c2727691a4 Use 'Stringification => Tokenizer' until some issues have been fixed 2017-05-18 09:33:41 +02:00
Daniel Marjamäki bc12a0b21f Handle empty token list better (for instance when Preprocessor::validateCfg() see problem) 2017-05-17 22:30:20 +02:00
Daniel Marjamäki 1f4b84379d Fix for #pragma asm 2017-05-17 21:58:46 +02:00
Daniel Marjamäki 59335f80d2 Try to fix windows build. Reduce header dependencies 2017-05-17 15:38:31 +02:00
Daniel Marjamäki 6230919976 Skip 'Stringification => Tokenize' step 2017-05-17 14:57:54 +02:00
Daniel Marjamäki 6967d68137 Add --plist-output argument 2017-05-16 14:07:23 +02:00
PKEuS 3432257390 Removed deprecated command --append 2017-05-14 11:57:04 +02:00
Daniel Marjamäki b3b0a796b9 dump: fix xml format 2017-04-15 12:38:00 +02:00
Daniel Marjamäki e71b428740 dump: Add platform info and valueType info 2017-04-15 12:25:44 +02:00
Daniel Marjamäki 174bcc8d34 Misra: Add rule 16.3 2017-04-14 10:46:35 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
Daniel Marjamäki 6e0af5d01f MISRA 19 and 28 2017-04-09 10:11:54 +02:00
Daniel Marjamäki 70a7915173 CppCheck: Improve output when first configuration is not empty. 2017-04-06 19:52:21 +02:00
Daniel Marjamäki a8788d7fc7 Fix Cppcheck warning 2017-03-30 11:20:04 +02:00
Daniel Marjamäki cc3ef7bbe8 Fix so array access out of bounds for external arrays are detected again 2017-03-30 10:14:17 +02:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
Daniel Marjamäki e9d950d4f5 Cppcheck build dir: Better handling when --project is used 2016-12-08 22:46:44 +01:00
PKEuS 5344a5e098 Fixed race condition by properly constructing a local CheckUnusedFunctions instance in CppCheck::processFile(). Instantiating Checks is dangerous! 2016-11-18 21:09:41 +01:00
Daniel Marjamäki 1245f1d621 Unused Functions: Fix checking when --cppcheck-build-dir is used. 2016-11-07 21:49:58 +01:00
Daniel Marjamäki b607e83648 Try to fix travis 2016-11-05 21:45:31 +01:00
Daniel Marjamäki 350e5a7142 UnusedFunctions: Perform checking using analyzeinfo 2016-11-05 21:26:56 +01:00
Frank Zingsheim 19706b3464 Fix #7789 (Missing error messages in repeated check on compile_commands.json in cppcheck-gui) 2016-11-05 20:14:01 +01:00
Matthias Krüger 892a81055d CheckUnusedFunctions::analyzerInfo(): remove unused parameter 'filename'.
Was:

lib/checkunusedfunctions.cpp: In member function ‘std::__cxx11::string CheckUnusedFunctions::analyzerInfo(const string&) const’:
lib/checkunusedfunctions.cpp:292:67: warning: unused parameter ‘filename’ [-Wunused-parameter]
 std::string CheckUnusedFunctions::analyzerInfo(const std::string &filename) const
                                                                   ^~~~~~~~
2016-11-01 13:34:26 +01:00
Daniel Marjamäki e77d76525e CheckUnusedFunction: generate better analyzerinfo 2016-10-31 20:43:57 +01:00
Daniel Marjamäki 2c3232affa cppcheck-build-dir: Use settings and cppcheck version in checksum so results will be recalculated if cppcheck is upgraded or there is significant changes on the command line. 2016-10-29 22:40:44 +02:00
Daniel Marjamäki 9ff3e85899 Added --cppcheck-build-dir flag 2016-10-29 12:18:11 +02:00
Daniel Marjamäki 324f68ca36 rename function 2016-10-28 12:10:19 +02:00
Daniel Marjamäki 19c105cdf9 Fixed #7677 (skipping of configurations broken?) 2016-08-21 12:31:26 +02:00
Daniel Marjamäki 606e31602c Fixed #7177 (Support compile_commands.json) 2016-08-13 10:50:03 +02:00
Daniel Marjamäki c586ae8cbe Revert 'project' - it is not ready yet 2016-08-07 17:10:37 +02:00
Daniel Marjamäki 4dbdb50317 split 2016-08-07 15:35:41 +02:00
Daniel Marjamäki e0f4ce9358 vs 2016-08-07 13:55:27 +02:00
Daniel Marjamäki 57951a2681 one more fix for rules 2016-07-28 15:35:41 +02:00
Daniel Marjamäki 1a4ef60e7c Fixed #7639 (rule support partially broken since simplecpp was introduced) 2016-07-28 13:40:52 +02:00
PKEuS 13c11b8c1d Fixed compilation with HAVE_RULES 2016-07-26 17:10:05 +02:00
PKEuS 9a6569fde1 Always set ErrorMessage::file0 to ensure that the source file that cppcheck is checking when an error occurs can be identified
Removed unused function and unused includes from preprocessor.h/cpp
2016-07-26 16:28:40 +02:00
Daniel Marjamäki 2feb86a6af Preprocessor: set platform info 2016-07-25 14:52:23 +02:00
Daniel Marjamäki e9fef003ac Preprocessor: refactoring directives, they are now only set once for each file 2016-07-24 14:02:21 +02:00
Daniel Marjamäki b2f1b95e38 Bump simplecpp. Preprocessor: Warn about missing includes 2016-07-21 12:47:00 +02:00
Daniel Marjamäki e16f0e500c Preprocessor: Parse comments and then remove them 2016-07-21 07:48:17 +02:00
Daniel Marjamäki 4ceba79f7f Replace std::to_string, to hopefully make appveyor happier 2016-07-20 20:43:32 +02:00
Daniel Marjamäki 03d2829fb9 Merge simplecpp branch 2016-07-20 12:21:00 +02:00
Daniel Marjamäki 3eb0e9b6c0 astyle formatting
[ci skip]
2016-05-30 09:17:40 +02:00
Daniel Marjamäki 18fc288de9 Fixed #5582 (Crash when there is OOM) 2016-05-28 13:24:19 +02:00
Daniel Marjamäki cee67730b1 Fixed #5746 (Cppcheck returns error-exitcode when globally suppressed error is encounted when running with multiple jobs.) 2016-05-27 20:13:51 +02:00
amai2012 3dea23c99e Use new signature Tokenizer::createTokens 2016-05-09 17:14:51 +02:00
Roberto Martelloni d3645d874e Mapped toomanyconfigs ,AssignmentAddressToInteger
,AssignmentIntegerToAddress ,CastIntegerToAddressAtReturn
,CastAddressToIntegerAtReturn ,assertWithSideEffect ,assignmentInAssert
,uselessAssignmentArg ,uselessAssignmentPtrArg
,comparisonOfFuncReturningBoolError
,comparisonOfTwoFuncsReturningBoolError ,comparisonOfBoolWithBoolError
,incrementboolean ,comparisonOfBoolWithInt ,compareBoolExpressionWithInt
,negativeIndex ,pointerOutOfBounds ,arrayIndexThenCheck
,possibleBufferAccessOutOfBounds ,argumentSize
,arrayIndexOutOfBoundsCond ,noConstructor ,copyCtorPointerCopying
,noCopyConstructor ,uninitMemberVar ,operatorEqVarError
,unusedPrivateFunction ,memsetClassFloat ,mallocOnClassWarning
,operatorEq ,thisSubtraction ,operatorEqRetRefThis ,operatorEqToSelf
,useInitializationList ,duplInheritedMember ,assignIfError
,comparisonError ,multiCondition ,mismatchingBitAnd
,oppositeInnerCondition ,incorrectLogicOperator ,redundantCondition
,moduloAlwaysTrueFalse to their CWEs ids.
2016-02-26 23:53:52 +00:00
Daniel Marjamäki cef6b35bb8 Improve MAXTIME handling 2016-02-11 16:10:52 +01:00
amai2012 d25258359a #7251 Remove checks variableHidingTypedef and variableHidingEnum 2016-02-06 15:37:58 +01:00
Albert ARIBAUD (3ADEV) 38e70dfb74 Preprocessor directives for addons
This patch augments the XML dumps with a 'directivelist'
subnode which lists all raw preprocessor directives met
while reading the source code in each configuration.

Also, the addons/cppcheckdata.py file has been extended
to give easy access to the list of directives and to
provide Python support for the --template (or short -t)
option.

Finally, an new addon, addons/y2038/y2038.py, is created
to detect when a glibc symbol might be Y2038-sensitive,
based on whether and how _TIME_BITS and _USE_TIME_BITS64
are defined when meeting the symbol.
2016-01-15 12:36:35 +01:00
Daniel Marjamäki 79e663dd6f Settings: Remove '_' prefix for public member variables 2016-01-03 16:18:17 +01:00
Daniel Marjamäki 599327bfb1 cmdlineparser: Added -E option 2016-01-02 11:48:36 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 9acda09fa2 refactoring. combine 2 if to 1 2015-12-14 20:05:17 +01:00
Albert ARIBAUD (3ADEV) e7fdb1c825 Fix multiple config dumps
With multiple configurations, option --dump only dumps
the last configuration.

Fix it to dump every configuration.

Also update all Python addons so that they can handle
multiple-configuration dumps.

Additionally run autopep8 on addons/*.py.

The results of 'make test' before and after applying
this commit are identical.
2015-12-14 18:20:35 +01:00
Albert ARIBAUD (3ADEV) 58031147b2 Optimize tokenizing
Reorganize cppcheck.cpp to separate actual checking from
tokenizing and XML dumping. This implies splitting checkFile()
in three parts, checkRawTokens, checkNormalTokens() and
checkSimplifiedTokens().
2015-12-13 09:29:47 +01:00
Daniel Marjamäki 61da95010c Removed unused CppCheck::replaceAll() 2015-12-10 13:32:36 +01:00
Daniel Marjamäki 1f16e72b19 Removed --debug-fp. The reduce tool should be used instead. 2015-12-10 10:44:36 +01:00
Daniel Marjamäki a51df5f00d Removed unused CppCheck::analyseFile 2015-12-03 08:42:12 +01:00
PKEuS ac17541ca9 Refactorizations:
- Fixed a few more MSVC warnings by using correct types
- Store severity as enum instead of string in Settings::Rule
2015-11-28 12:30:21 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Miika-Petteri Matikainen acd8a092f8 Make syntaxError suppressable (fixes #5917 and #7076)
syntaxErrors were not suppressable, because they were treated as
InternalErrors which were thrown and catched during the checking,
and normal suppression rules were not applied for those.

We fix this by calling the normal reportErr() function that does
suppression matching.
2015-10-28 20:53:35 +02:00
Daniel Marjamäki 6545172d8c Revert "Add a dynamic rule enable/disable system"
This reverts commit 231b486e49.

There was regressions reported in tools/generate_and_run_more_tests.sh.
2015-10-09 21:56:19 +02:00
Albert Aribaud 231b486e49 Add a dynamic rule enable/disable system 2015-10-09 19:57:05 +02:00
PKEuS 92b867dd2c Fixed behaviour of --quiet/-q and its description 2015-07-25 17:55:12 +02:00
Simon Shanks 9910c1fa0c Fixed #6617 (preprocessor performance improvement) 2015-07-24 13:30:41 +02:00
Alexander Mai 2c73518e29 Fix platform-dependent test result, formatting and crash in whole program analysis 2015-06-28 17:54:48 +02:00
Alexander Mai d4550c763d Exit code shall indicate that an internal error (syntax error) has been found. Add some const. Run astyle 2015-05-25 21:15:55 +02:00
Thomas Jarosch ec21134817 Fix false negatives for local suppressions
Introduce a new bool setting jointSuppressionReport
that will be set by the analyseWholeProgram() code path.

When the flag is enabled, unmatched suppressions are
collected after running the final whole program analysis
to prevent false positives for the unusedFunction check.

The check functions in the unit test
for single / multi file suppressions were unified.
2015-01-20 18:47:30 +01:00
Thomas Jarosch c92d861b1e Fix typo in "internal error" message 2015-01-12 23:09:17 +01:00
Daniel Marjamäki 228f5960fc CheckIO: only report warnings when --enable=warning has been used 2015-01-06 15:08:25 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki 0b9d80c95d Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis 2014-12-02 06:41:18 +01:00
Daniel Marjamäki a002654c47 Reverted refactoring 828417c for now. It caused a major slowdown in the unused functions checking. 2014-11-24 06:37:08 +01:00
Daniel Marjamäki 828417c934 CheckUnusedFunction: Refactorings to use same infrastructure for whole program analysis as CheckUninitVar and CheckBufferOverrun 2014-11-15 18:44:23 +01:00
Daniel Marjamäki de7e9223b8 Fixed #6272 (Improve check: multifile checking in checkbufferoverrun) 2014-11-15 10:43:49 +01:00
PKEuS b48bf1dbad Fixed GUI bug: file test.cpp is loaded from file if scratchpad is empty.
The underlying problem was in lib and is fixed by changing the behaviour of CppCheck::check(). Checking is performed on empty content without attempt to load from file.
2014-10-03 10:40:48 +02:00
PKEuS a02712cb66 Some small refactorizations:
- Removed redundant calls to std::string constructor
- Use default parameters in some places
2014-10-03 10:02:46 +02:00
PKEuS 542cb1cd8e Reduce RAM usage: Avoid keeping a copy of the preprocessed source files content during checking. 2014-10-02 19:44:17 +02:00
PKEuS c3ac91eb42 Fixed ID of message about purged configurations. 2014-09-10 20:19:21 +02:00
PKEuS 4940da06c0 Calculate checksum only if necessary (#6129) 2014-09-05 11:05:21 +02:00
PKEuS bf2f76e70c Detect and purge duplicate configurations by calculating a checksum. 2014-09-02 22:35:52 +02:00
PKEuS e35329aba3 Fixed reporting of unmatched suppressions for unusedFunction (#4946) 2014-09-01 10:13:03 +02:00
PKEuS a1b7ab277b Changed handling of unhandled characters:
- Don't abort checking (reverts 42140b6488)
- Modified error message: New Id unhandledCharacter, removed redundant line information, improved message text
2014-08-08 09:49:09 +02:00
Daniel Marjamäki 8db5836e3f Fixed #5982 (Add xml dump) 2014-07-14 15:51:45 +02:00
PKEuS 0a0f1072c0 Attempt to fix travis and some more VS warnings 2014-06-04 19:18:27 +02:00
PKEuS d93d7401c6 Moved getSourceFilePath(), isC() and isCPP() from Tokenizer to TokenList
Conflicts:
	lib/tokenize.cpp
2014-06-04 18:36:25 +02:00
PKEuS 6aa88248ac Fixed timer name 2014-06-04 18:34:45 +02:00
Daniel Marjamäki 42140b6488 Preprocessor: set error flag when unhandled characters are found so checking can bailout 2014-06-01 11:24:10 +02:00
PKEuS adf38fcfd0 Further include cleanup 2014-05-24 12:50:04 +02:00
PKEuS 9bfc2b618b Fixed crashes random crashes in multithreading caused by useless creation of CheckUnusedFunctions instance per thread. 2014-04-13 11:56:38 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
PKEuS 7e4081f7f5 Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268) 2014-03-27 13:15:21 +01:00
Lauri Nurmi 70a67eaf85 Change some more 0 literals into nullptr. 2014-02-16 13:38:50 +02:00
Daniel Marjamäki fb5c2d4b48 use nullptr in lib/checkother.cpp 2014-02-15 08:46:28 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
PKEuS 55f68535b2 Set version to "1.64 dev"/1.63.99. Use version.h in cppcheck.cpp. 2014-01-04 10:41:13 +01:00
Daniel Marjamäki 6515691a47 1.63: Set version numbers 2014-01-04 09:32:37 +01:00
Alexander Mai ea10a722fc Fixed #5306 (Implement --showtime=top5) 2014-01-03 10:24:57 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki e446a28b3d Refactoring FileLister and Path so they don't depend on Library 2013-10-31 19:09:01 +01:00
Sam Truscott 6806fd8135 Extended Qt support through Library 2013-10-20 14:09:10 +02:00
PKEuS 4cd2fad2bf Set version to 1.63 dev 2013-10-13 09:53:56 +02:00
Daniel Marjamäki 21c537e8d7 1.62: Set versions 2013-10-12 12:22:52 +02:00
Daniel Marjamäki 6b260c481c CppCheck: Don't run preprocessor rules when --check-config is used 2013-08-31 18:38:52 +02:00
Daniel Marjamäki 997c9ce100 Refactor CppCheck::_fileContents to a function parameter 2013-08-31 10:28:21 +02:00
Daniel Marjamäki e6686dfb5b Cleanup CppCheck::dependencies() 2013-08-31 10:13:47 +02:00
Daniel Marjamäki ff71c94f6e Fixed #4949 (define symbol used in code => 'Analysis failed' message is written.) 2013-08-12 18:12:49 +02:00
PKEuS 219f6546d3 Set version to 1.62 dev 2013-08-03 19:54:39 +02:00
Daniel Marjamäki 2f7fba2087 1.61: Set versions 2013-08-03 08:04:38 +02:00
Daniel Marjamäki 44333f316a Added terminate() handling to get quicker response when the user wants to terminate 2013-07-24 13:06:59 +02:00
Daniel Marjamäki 8285510996 Rules: Make it possible to write rules that check #define macros 2013-07-12 16:09:00 +02:00
PKEuS 14c3b390a4 Fixed version number 2013-07-04 13:32:45 +02:00
Daniel Marjamäki 15c92384f4 Fixed #4851 (Preprocessor: problem when using #ifndef symbol in the code) 2013-06-15 12:08:18 +02:00
Daniel Marjamäki 47931372ff astyle formatting 2013-06-12 06:43:52 +02:00
Daniel Marjamäki 6900d4fb76 Travis: Fixed cppcheck style warning 2013-06-09 20:17:26 +02:00
Daniel Marjamäki 66f9e9b16f Rules: Allow that 'raw' tokens are checked. 2013-06-09 15:50:43 +02:00
Daniel Marjamäki 537166cf47 Rules: Make it possible run a rule on the 'normal' token list 2013-06-09 14:58:56 +02:00
Daniel Marjamki 4e09b06bc1 Fixed #4827 (allow checking multiple configurations when using -D by also using --max-configs or --force) 2013-06-08 16:46:54 +02:00
Daniel Marjamki c83bd7f00f 1.60.1: Set versions 2013-06-02 13:13:40 +02:00
Daniel Marjamäki d36d3d5469 1.60: set version 2013-06-01 15:17:07 +02:00
Daniel Marjamäki a7da65a40b Fixed #4618 (Unmatched suppression: don't show this information message unless --enable=information or --check-cfg is used) 2013-05-31 15:20:58 +02:00
Daniel Marjamäki 2f1050595d CppCheck: Added _simplify flag that can be used by clients to disable simplifications 2013-05-11 11:35:04 +02:00