Commit Graph

7358 Commits

Author SHA1 Message Date
Daniel Marjamäki b86c2689b3 TestPreprocessor: Fix output 2016-08-06 13:28:24 +02:00
Robert Reif cdfe92b753 Fixed #7657 (False positive: Function parameter 'c' should be passed by reference.) 2016-08-06 10:27:00 +02:00
Daniel Marjamäki cbfeae0ff7 bump simplecpp 2016-08-04 22:53:10 +02:00
Daniel Marjamäki 7d6c587580 Fixed #6113 (Tokenizer::simplifyFunctionPointer: wrong simplification of usage 'return (*f)();') 2016-08-04 19:10:08 +02:00
PKEuS 084fcc936c Rephrased syntaxError message for empty configurations to improve readability:
Old: Invalid number of character 'c' when these macros are defined: ''.
New: Invalid number of character 'c' when no macros are defined.
2016-08-04 16:28:11 +02:00
Daniel Marjamäki 9711064b74 Fixed #6646 (False positive uninitvar - loopvariable initialized inside loop) 2016-08-04 14:39:54 +02:00
Daniel Marjamäki fe3abd678f Revert "Fix potential null pointer dereference"
This reverts commit 6ca76ff965.
2016-08-04 10:40:07 +02:00
Daniel Marjamäki 2566fd09da Fixed #5803 (False positive: Same iterator is used with different containers - insert() from range of different container) 2016-08-04 09:35:16 +02:00
Robert Reif 55b3f0bf38 Fixed #752 (SymbolDatabase: Does not match function if redundant keywords mismatch (C++)) 2016-08-04 09:06:32 +02:00
Dmitry-Me 6ca76ff965 Fix potential null pointer dereference
This was CID 1360399
2016-08-03 18:44:15 +03:00
Robert Reif b40edca62f Fixed #7387 (SymbolDatabase: Wrong overloaded function is picked) 2016-08-02 23:34:11 +02:00
Robert Reif b9030bcfcd Fixed #7650 (SymbolDatabase: Wrong Token::type(), enum and class with same name) 2016-08-02 23:30:46 +02:00
Daniel Marjamäki 5e78dae143 Use TODO_ASSERT_EQUALS instead of TODO comments 2016-08-02 19:38:36 +02:00
Robert Reif b44f448acc Fixed #7649 (SymbolDatabase: Wrong overloaded function is picked for char and wchar_t) 2016-08-02 18:54:01 +02:00
Daniel Marjamäki f23287544a Fixed #7196 (Improve check: deem sizeof(thing) as using the thing's members) 2016-08-02 18:50:04 +02:00
Daniel Marjamäki cc62259103 Tokenizer: don't set varid on c++11 'template using' type. 2016-08-02 15:04:07 +02:00
Daniel Marjamäki 2187e8ba02 CheckUninitVar: Fixed FP when dereferencing multidimensional arrays. Refactoring of testing. The FP was spotted when looking at #7092 2016-08-02 14:27:51 +02:00
Daniel Marjamäki 864cef2fd2 astyle formatting
[ci skip]
2016-08-02 09:03:03 +02:00
Robert Reif 891e21b478 Fixed #7458 (SymbolDatabase: Wrong overloaded function is picked) 2016-08-02 08:58:11 +02:00
Daniel Marjamäki 41526ef3a8 Fixed #6147 (FP unreadVariable: variable assignment in function call argument list) 2016-08-02 08:50:04 +02:00
Daniel Marjamäki 31484133c0 Fixed #7158 (Tokenizer::createLinks2(): does not set links for < > in 'enum { value = boost::mpl::at_c<B,C> };') 2016-08-01 22:26:11 +02:00
Daniel Marjamäki e784901303 Fixed #6971 (False positive duplicateExpressionTernary - cast ignored) 2016-08-01 21:53:43 +02:00
Daniel Marjamäki 695b1f0ef3 Fixed #5692 (Preprocessor: ifdef symbol used indirectly in code leads to 'analysis failed') 2016-08-01 20:09:41 +02:00
Daniel Marjamäki 09b6568ea2 Fixed #7646 (podtypes do not get proper valuetype) 2016-07-31 19:47:34 +02:00
Daniel Marjamäki d89a646ed9 TestPreprocessor refactorings 2016-07-30 20:22:07 +02:00
Daniel Marjamäki 66d0d7a0ad Fixed #7553 (False positive with 1.74 'returning an integer in a function with pointer return type' when no integer is used) 2016-07-29 21:53:58 +02:00
Daniel Marjamäki 5611a71820 Fixed #7543 (False positive boolean result used in bitwise operation) 2016-07-29 18:46:43 +02:00
Daniel Marjamäki 89be630156 Fixed #7543 (False positive boolean result used in bitwise operation) 2016-07-29 17:24:22 +02:00
Daniel Marjamäki a65ae3ce2e Token: Allow dollar sign in identifiers 2016-07-29 13:42:11 +02:00
PKEuS 92e3e802fb Attempt to fix travis build and testrunner failure 2016-07-28 20:59:09 +02:00
PKEuS 452ecc7ceb Improved check: Detect passedByValue even for arguments that are not declared as "const" 2016-07-28 19:37:10 +02:00
Daniel Marjamäki 0777ecd071 Fixed #7640 (Preprocessor::getConfigs: -U is not honored) 2016-07-28 19:22:59 +02:00
PKEuS 3f4fe8f578 Refactorized CheckBufferOverrun:
- Removed redundant code
- Apply non-simplified checking in test suite
2016-07-27 17:28:43 +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 71f62950ed Tokenizer::findGarbageCode: Make it less picky about 'UNKNOWN_MACRO if ..' 2016-07-26 14:35:11 +02:00
PKEuS fc1603eb9b MathLib, ValueType: Support integer suffix "i64" 2016-07-26 13:19:53 +02:00
Daniel Marjamäki 7ff9545b10 Fixed #7637 (FP syntax error assignment in switch) 2016-07-26 12:15:55 +02:00
PKEuS 5c92c231b8 windows.cfg: SendMessage must not be <leak-ignore/> 2016-07-26 11:57:46 +02:00
Daniel Marjamäki 9082c097c8 Fixed testing of #7615. The code is not garbage so move it from TestGarbage to TestSymbolDatabase 2016-07-26 09:10:10 +02:00
Daniel Marjamäki fd19ab4ed1 fix garbage code handling 2016-07-26 08:50:00 +02:00
Matthias Krüger 6fd8edd6e5 Symboldatabase::sizeOfType: fix crash; fixes #7615 2016-07-26 01:18:47 +02:00
Daniel Marjamäki 2feb86a6af Preprocessor: set platform info 2016-07-25 14:52:23 +02:00
Daniel Marjamäki 90faa80590 Preprocessor: Cleanup unused functions 2016-07-25 14:29:02 +02:00
Daniel Marjamäki 7ef02a7469 Cleanup Tokenizer 2016-07-25 12:12:11 +02:00
Daniel Marjamäki adf16fae8b Remove handling of ##, __FILE__, __LINE__ from tokenizer 2016-07-25 07:58:03 +02:00
Daniel Marjamäki 0767284ca1 Fixed #7630 (FP: dead store, modifying array, index var modified) 2016-07-25 07:35:33 +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
PKEuS 2e2800f5bd Fixed several MSVC warnings 2016-07-24 12:36:36 +02:00
Daniel Marjamäki ed4a47de45 Tokenizer: Improve syntax checking of switch,if,while 2016-07-22 16:54:24 +02:00
PKEuS 12e3cf584c Visual Studio solution:
- Fixed include paths
- Export simplecpp to cppcheck-core.dll
- Added /Zc:rvalueCast
2016-07-21 20:38:58 +02:00
Daniel Marjamäki 99307846cf Preprocessor: simplecpp optimisations 2016-07-21 19:42:26 +02:00
Dmitry-Me 0aac71efd1 Unify and simplify addresses computation 2016-07-21 15:48:48 +03:00
Daniel Marjamäki f50f024873 Revert "Resolve CID 1357639"
This reverts commit e3b0c3a974.

It's not a proper fix. I want that Cppcheck detects this bug also. I want to keep the CID open until Cppcheck can detect it.
2016-07-21 09:52:51 +02:00
Dmitry-Me e3b0c3a974 Resolve CID 1357639 2016-07-21 10:34:07 +03:00
Daniel Marjamäki e16f0e500c Preprocessor: Parse comments and then remove them 2016-07-21 07:48:17 +02:00
Daniel Marjamäki 8a1936d5c9 update AdditionalIncludeDirectories in vcxproj files 2016-07-20 22:17:23 +02:00
Daniel Marjamäki 03d2829fb9 Merge simplecpp branch 2016-07-20 12:21:00 +02:00
Daniel Marjamäki a68da1a725 ValueType: Set valuetype for sizeof argument 2016-07-20 09:39:48 +02:00
Daniel Marjamäki 3eef225b36 Revert preprocessor fix for struct tag macros. There are performance problems. 2016-07-19 18:59:58 +02:00
Daniel Marjamäki 4cc4ebd5cd Travis: run slow unit test on travis that is too slow to run on development machines 2016-07-19 17:10:49 +02:00
Mavik 3e86c7b637 Fixed #5700 (Defect: False positives due to failure to expand struct tag macros) 2016-07-19 16:52:53 +02:00
Daniel Marjamäki ca929f0f1b Try to fix #7608 (Assertion failed in test/testvarid.cpp at line 1988) 2016-07-19 11:59:37 +02:00
Daniel Marjamäki 83b982064d Fixed #7579 (varid not set properly in 'int b[] = { m * a[0] };') 2016-07-18 15:27:08 +02:00
Daniel Marjamäki 0ddeac0429 refactor (use ast) and improve CheckOther::checkRedundantAssignment (warn about global variables unless they are volatile, handle arrays in lhs better) 2016-07-18 12:43:23 +02:00
Daniel Marjamäki 72ead10d93 cleanup tests 2016-07-18 10:52:38 +02:00
Daniel Marjamäki b9443771fb cleanup tests 2016-07-18 10:42:03 +02:00
Daniel Marjamäki 4f051bf9dd Fixed #7599 (valueFlowAST: handle && and || better) 2016-07-17 21:51:20 +02:00
Daniel Marjamäki 45ee29d5dc Fixed #7604 (simplifyCalculation: expression '0 && x[2]' is not simplified properly) 2016-07-17 15:52:53 +02:00
PKEuS 801fd8f96a Support trailing return types (C++11) 2016-07-17 15:47:50 +02:00
Daniel Marjamäki 91e38f3eb9 Fixed #7582 (false positive: Division by result of sizeof(). strncpy() expects a size in bytes) 2016-07-17 15:22:14 +02:00
Daniel Marjamäki 6e3d5dc0d1 Fixed #7580 (False positive when using logical operator keywords 'and', 'or') 2016-07-16 20:21:31 +02:00
PKEuS 0afecd8fee Do not simplify name "CALLBACK" away on non-windows platforms (#7554) 2016-07-16 10:43:28 +02:00
Robert Reif 768c26805c Fixed false positive: %Ld in format string (no. 1) requires 'long long' but the argument type is 'long long' (#7601). 2016-07-16 10:33:46 +02:00
PKEuS f869f7ebde Fixed false positive reademptycontainer when end() is called (#7560) 2016-07-10 10:48:21 +02:00
PKEuS ded8d80b23 Library: Support arguments with default value. Fixed default value handling for <container> tags broken in last commit. 2016-07-09 12:44:17 +02:00
Robert Reif c1594bedbb Fixed creation of SymbolDatabase for some template code (#7594) 2016-07-09 09:22:52 +02:00
PKEuS 44a19b527e Use ValueFlow and SymbolDatabase to detect buffer overflows with new and malloc, improving support for enums (#7576) 2016-07-08 20:53:08 +02:00
Robert Reif eca805ba3b ValueFlow: Fixed constant folding of sizeof(enum) and sizeof(enumerator) (#7564) 2016-07-08 20:39:34 +02:00
PKEuS a808549af0 Support lambdas in simplifyCompoundAssignment (#7571) 2016-07-08 20:10:33 +02:00
Daniel Marjamäki a87b4368cb Revert "Preprocessor: Start replacing our Preprocessor code with simplecpp"
This reverts commit 9820783b60.

There was Travis errors I'll need to look more at.
2016-07-07 23:45:42 +02:00
Daniel Marjamäki 9820783b60 Preprocessor: Start replacing our Preprocessor code with simplecpp 2016-07-07 22:58:56 +02:00
PKEuS 644a216394 Fixed two false positives related to char arrays initialized by a literal:
- Run check for writing to string literals on non-simplified token list (#7283)
- Run buffer overrun checking for string literals on non-simplified token list (https://sourceforge.net/p/cppcheck/discussion/general/thread/2c33dfc5/)
2016-07-07 19:38:15 +02:00
PKEuS 3bdcf68990 Fixed false positive in CheckUnusedVar::checkFunctionVariableUsage(): Bailout when break; is encountered
See also: https://sourceforge.net/p/cppcheck/discussion/general/thread/1c169dc5/
2016-07-07 18:27:31 +02:00
Simon Martin 40eacb19b1 Ticket #7565: Handle numbers with several C++14 integer separators. 2016-07-01 23:24:28 +02:00
umanamente 0f11007c19 Fixed #7083 (false positive: typedef and initialization with strings) 2016-06-21 22:42:46 +02:00
PKEuS dde6f5eaea Do not warn about alloca() in C89 mode (#7558) 2016-06-20 09:30:41 +02:00
PKEuS 721bc32b2d Fixed crash in CheckVaarg::va_list_usage() (#7559) 2016-06-20 09:24:23 +02:00
Bartlomiej Grzeskowiak a5cfa2b12c - #7522 and #7428 revisited. ((a&7)>7U) is always false and ((X|7)>=6) is correct (X can be negative). 2016-06-17 12:12:53 +02:00
Daniel Marjamäki d1f06ff47c Fixed #7175 (False positive performance warning (buffer overwritten before its old content has been used)) 2016-06-13 15:46:43 +02:00
PKEuS 53e2cabdbb Properly support "break" in CheckVaarg::va_list_usage() (#7533)
Ran AStyle
2016-06-07 19:28:32 +02:00
Simon Martin 3c10b25b3e Ticket #7117: Properly detect if a const ternary operator is in a template parameter list. 2016-06-05 14:13:32 +02:00
Robert Reif 583b340034 enum: set the return type of derived class functions returning enums defined in a base class. 2016-06-05 14:08:33 +02:00
Simon Martin 3095f47a7b Ticket #7137: Properly detect C++14 digit separators. (#802)
Add an optional extended description…
2016-06-04 22:55:55 +02:00
PKEuS 3916cd628e windows.cfg: Fixed configuration of _tfopen_s/_wfopen_s ( 2016-06-02 09:41:01 +02:00
PKEuS 9a61559eca Fixed false positive va_list_usedBeforeStarted (#7527) 2016-06-02 09:32:45 +02:00
Daniel Marjamäki c24a4b9189 Removed enum mismatch checker. Ticket #6960. 2016-05-29 18:00:37 +02:00
Robert Reif f4dd43a71a Fixed #7523 (Scope::findEnumerator(): does not find enum constant from other enum type) 2016-05-29 14:45:45 +02:00
Simon Martin 12a298b9cd Ticket #7445: Properly represent integer types smaller than int in CheckIO::ArgumentInfo. 2016-05-28 15:36:13 +02:00
Daniel Marjamäki 2b2f12bcd5 Fixed #6758 (Preprocessor: handle #__VA_ARGS__) 2016-05-28 11:27:45 +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