Commit Graph

384 Commits

Author SHA1 Message Date
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