Commit Graph

329 Commits

Author SHA1 Message Date
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
Daniel Marjamäki b6bcdf2936 Fixed #4520 (segmentation fault of cppcheck (preprocessing)) 2013-05-09 18:50:24 +02:00
PKEuS b180e92b4c Set version to 1.60 dev
Use WiX 3.7
2013-03-30 19:04:01 +01:00
Daniel Marjamäki c733928505 1.59: Set versions 2013-03-29 18:06:13 +01:00
PKEuS c62233643a Set version to 1.59 dev 2013-01-12 17:49:09 +01:00
Daniel Marjamäki 3057078571 1.58: Set versions 2013-01-12 14:49:58 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki bfb82fe3e1 Cppcheck: Show single 'too many configurations' message if --enable=information hasn't been used and there are too many configurations. 2012-12-26 18:35:49 +01:00
Daniel Marjamäki 9e58714bb1 Cppcheck: Only show 'Too many configurations' and 'Interrupted checking' information messages when information severity is enabled 2012-12-23 08:23:52 +01:00
PKEuS dc3eba964b Incremented version to "1.58 dev" (1.57.99) 2012-11-04 15:49:18 +01:00
Daniel Marjamäki 3a44a5ca3c 1.57: Setting version 2012-11-04 13:50:23 +01:00
Daniel Marjamäki 10c11ec9dd more java/c# cleanup 2012-10-03 19:51:09 +02:00
Daniel Marjamäki 2f7032a0e6 Cppcheck: Removed redundant code. 2012-09-15 16:00:46 +02:00
PKEuS dcf997007b Incremented version numbers to 1.57 dev 2012-09-01 13:04:09 +02:00
Daniel Marjamäki b8db27fcd1 1.56: Set versions 2012-09-01 10:54:15 +02:00
PKEuS c8e40773f1 Fixed cppcheck messagesa about functions that can be const/static:
- Made Tokenizer::getErrorMessages static - Avoids creation of unnecessary instance of Tokenizer
- Changed Tokenizer::removeExceptionSpecifications to common style for simplification functions. In contrast to the comment, this function doesn't call itself recursivly - fixed comment.
- Made Tokenizer::IsScopeNoReturn static.
2012-08-01 12:04:47 -07:00
Daniel Marjamäki 17cf24ed34 Fixed #3643 (Preprocessor: Invalid configuration (macro is used in code)) 2012-07-10 20:29:04 +02:00