Daniel Marjamäki
c0da6c1541
simplifyCalculations: handle '(4%1<<1&4!=1)' better. must combine '!' '=' before constant folding. fixed the operator precedence for comparison operators. ( #4931 )
2015-11-28 09:04:22 +01:00
Daniel Marjamäki
1bf547c716
Fixed #4931 (Wrong calculation for '2|0*0&2>>1+0%2*1')
2015-11-27 15:02:49 +01:00
Daniel Marjamäki
1977a18a1e
simplifyNumericCalculations: Don't fold negative constants in shift/bitmask calculation. Behaviour is not well defined.
2015-11-27 14:16:49 +01:00
PKEuS
3b4160600d
Fixed crash in CheckMemoryLeak::functionReturnType() for unary operator:: ( #7172 )
2015-11-27 11:18:40 +01:00
PKEuS
0ba3d25917
CheckMemoryLeak: Correctly detect new char[...]() as array allocation ( #7164 )
2015-11-27 11:04:18 +01:00
Frank Zingsheim
1d7fac3ca9
Added testrunner test to cmake. #7098
2015-11-26 21:01:07 +01:00
Frank Zingsheim
70c20515a9
Cmake object linkage. Fix #7128 : (cppcheck 1.70 doesn't report any warnings)
2015-11-26 20:25:09 +01:00
Daniel Marjamäki
2737f63f71
Wrong calculation of constants (simplifying: +,<<,% operations)
2015-11-25 16:46:39 +01:00
orbitcowboy
f84af529af
Extended windows.cfg and posix.cfg about missing functions, found by using --check-library on some projects.
2015-11-25 11:02:32 +01:00
Alexander Mai
a7ab5ecf08
Fix some compiler in MathLib::characterLiteralToLongNumber + some small refactoring
2015-11-23 20:41:21 +01:00
Daniel Marjamäki
e8182395f7
Fix 'make checkcfg' by adding inline suppressions when obsolete functions are used.
2015-11-22 17:52:47 +01:00
Alexander Mai
b7030fcfa1
Fix compiler error (VS2010) and warning
2015-11-22 16:56:44 +01:00
Daniel Marjamäki
d93cf96a29
Fixed #6769 (false positive: Uninitialized struct member: epoch.integer)
2015-11-22 16:20:46 +01:00
Alexander Mai
63b7700660
Use clang/gcc-conforming encoding of multicharacter literals
2015-11-22 14:20:36 +01:00
PKEuS
f516de8633
Moved a few checks from CheckOther to CheckFunctions
2015-11-22 13:49:10 +01:00
Alexander Mai
9ca6704c81
#7162 Support multicharacter char literals.
2015-11-22 13:31:31 +01:00
Matthias Krüger
8db72994fb
make checkcfg / runtests.sh: be verbose (set -x)
2015-11-22 11:03:10 +01:00
Alexander Mai
b1385dd951
Run dmake to update Makefile etc.
2015-11-22 10:40:48 +01:00
PKEuS
57d1196386
Replaced CheckNonReentrantFunctions and CheckObsoleteFunctions by generic CheckFunctions which is based on Library ( #6529 )
2015-11-22 09:18:07 +01:00
Alexander Mai
517922feb6
MathLib::characterLiteralToLongNumber now reports more specific error messages for unsupported unicode literals (see #7162 )
2015-11-22 07:38:38 +01:00
Alexander Mai
714579401f
#7160 Internal error: Unhandled char constant '\1'. Correct MathLib::toLongNumber. Create new utility function MathLib::characterLiteralToLongNumber
2015-11-21 22:35:58 +01:00
Daniel Marjamäki
5f68f3ddf6
Fixed #6264 (FP: gimp: struct initialized via pointers to member variables)
2015-11-21 19:31:18 +01:00
Daniel Marjamäki
fb0477affd
CheckUninitVar: Fixed false negatives when there are conditions
2015-11-21 10:00:21 +01:00
PKEuS
12af125fd3
Fixed false positive stlIfStrFind for function call inside condition.
...
Removed unnecessary suppressions in .travis_suppressions
2015-11-20 20:08:53 +01:00
Daniel Marjamäki
8fd62e0cf9
Fixed #4931 (Wrong calculation of constants (simplifying: +,<<,% operations))
2015-11-20 19:43:11 +01:00
Daniel Marjamäki
79a70c1277
MathLib::toLongNumber: Better handling of '\x12' and '\000' char constants
2015-11-20 18:57:48 +01:00
Daniel Marjamäki
4abc0b7c1f
Partial fix for #4931 (Wrong calculation of constants (simplifying: +,<<,% operations))
2015-11-20 16:09:47 +01:00
PKEuS
c0e33e20b4
Reimplemented CheckStl::readingEmptyStlContainer() based on Libraries
2015-11-20 15:53:14 +01:00
PKEuS
53b2eca983
Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries
2015-11-20 15:53:14 +01:00
Daniel Marjamäki
0022ce8075
Refactor handling of char constants
2015-11-20 10:10:38 +01:00
PKEuS
c5b21d12cf
Removed lots of redundant tests from testmemleak.cpp, added some missing types to gtk.cfg
2015-11-19 18:51:32 +01:00
PKEuS
2e7c5d37df
Refactorizations in checkmemoryleak.cpp:
...
- Rely more on <alloc> declarations in Libraries
- Removed unreachable debug message
- Simplified code
2015-11-19 17:34:17 +01:00
PKEuS
0d25a43a5d
checkmemoryleak.cpp: Refactorized CheckMemoryLeakNoVar::check() and replaced a redundant whitelist by CheckMemoryLeakInFunction::test_white_list()
2015-11-19 17:34:17 +01:00
Daniel Marjamäki
40851a12ef
Fixed #4627 (Tokenizer::setVarId: function declaration in function body)
2015-11-19 16:27:16 +01:00
PKEuS
ab171fc027
Fixed false negatives in CheckMemoryLeakStructMember::checkStructVariable():
...
- Use generic detection of allocation/deallocation (#4770 )
- Make the checker usable for C++ by checking for destructors
- Reduced unit test duplication
2015-11-19 16:10:26 +01:00
PKEuS
db6174bb60
Refactorization: Support Types that consist of more than a single token in CheckMemoryLeakNoVar::checkForUnsafeArgAlloc
...
Removed obsolete comments
2015-11-19 16:10:26 +01:00
Daniel Marjamäki
4d3e231bd0
Fixed #3948 (False positive: variable not initialised - used in multi-condition if-clause)
2015-11-19 13:09:45 +01:00
PKEuS
87d3ed91ab
Refactorization:
...
- Improved and cleaned up CheckMemoryLeak::functionReturnType()
- Cleaned up whitelist from functions declared as <leak-ignore/> in std.cfg
2015-11-18 22:09:27 +01:00
PKEuS
1566b72c5b
Fixed broken AST for simple expressions with delete operator.
...
Fixed cppcheck internal warning
2015-11-18 21:37:37 +01:00
PKEuS
e990cfb76b
Fixed setVarId() for destructors
2015-11-18 21:13:58 +01:00
PKEuS
6ee4cf80dc
Improved detection of new operator in checkmemoryleak.cpp, fixed TODO unit test
2015-11-18 20:33:39 +01:00
Daniel Marjamäki
0f9d90d2be
Changed Copyrights. Removed my name.
2015-11-18 20:04:50 +01:00
Daniel Marjamäki
04ecbba361
Fixed #7135 (ValueFlow: Wrong pointer alias set for 'p = &p[x];')
2015-11-15 23:38:23 +01:00
Alexander Mai
435a980ce2
Convert wrong test result for #7133 to TODO_ASSERT_EQUALS and add more test cases
2015-11-15 20:14:20 +01:00
Daniel Marjamäki
71bf0f076f
CheckAutoVariables: Handle 'x-y' better in isAutoVarArray
2015-11-15 19:34:36 +01:00
Alexander Mai
65666a1ba4
Makefile: explicit list directories which should be used with ctags. Run astyle.
2015-11-15 19:03:18 +01:00
amai2012
f0bf749621
#7133 crash: Variable::declarationId().
2015-11-15 19:01:29 +01:00
Daniel Marjamäki
ca8b15cd6b
Fixed #7124 (int32_t etc are recognised as fundamental types, but std::int32_t etc are not)
2015-11-15 17:51:27 +01:00
PKEuS
25749ab19f
Fixed another crash in clang test suite and let two times two functions in std.cfg share same configuration
2015-11-15 14:55:30 +01:00
Daniel Marjamäki
4e578af603
CheckAutoVar: Improved usage of AST and ValueFlow
2015-11-15 14:48:13 +01:00
PKEuS
481d800d5a
Fixed crash in clang test suite.
2015-11-15 14:40:31 +01:00
PKEuS
3f255e7685
Use Library information in Tokenizer::sizeOfType()
2015-11-15 14:37:02 +01:00
Daniel Marjamäki
c10a10c26f
CheckAutoVariables: use ValueFlow to detect more errors when pointer aliases are used
2015-11-15 12:10:35 +01:00
Alexander Mai
835c234e18
#7131 crash: Tokenizer::setVarId()
2015-11-14 21:22:53 +01:00
Alexander Mai
af2ada9258
#6692 False positive: Hidden member variable - parent class with same name in different namespace. Add regression test for FP which got fixed in 1.70 already
2015-11-14 14:44:27 +01:00
Daniel Marjamäki
b10110b5ac
CheckClass: Removed noExplicitCopyMoveConstructorError after discussion in http://sourceforge.net/p/cppcheck/discussion/general/thread/b2ce9d3d/ .
2015-11-13 12:48:26 +01:00
PKEuS
f9bc229d4b
Support varids in nested classes that are declared outside of outer class ( #7127 )
2015-11-13 10:07:57 +01:00
Daniel Marjamäki
595f1e1a27
ValueFlow: set value for char literals
2015-11-12 16:38:58 +01:00
Daniel Marjamäki
34dbc3c00c
ValueFlow: Improved handling of a[i]
2015-11-12 16:14:27 +01:00
Daniel Marjamäki
4ec333dbb6
Fixed #7007 (ValueFlow: value is not known, modified by subfunction)
2015-11-12 14:59:35 +01:00
PKEuS
1589841cb6
Fixed crash in clang test suite with member variable pointers
2015-11-11 18:26:59 +01:00
PKEuS
36c5815ddb
Fixed false positive about redundant variable assignment in try-scopes if the variable is read in catch block ( #6555 )
2015-11-11 17:21:55 +01:00
PKEuS
a8cf63239a
Fixed false positive autovarInvalidDeallocation if deallocting result of member function ( #6551 )
2015-11-11 16:59:31 +01:00
Daniel Marjamäki
b9b0964dab
Fixed #7006 (False positive Mismatching assignment and comparison (variable is changed in loop))
2015-11-11 13:45:28 +01:00
PKEuS
ee00925dc5
setVarId: Support throw() in constructor implementations ( #7123 )
2015-11-11 11:01:49 +01:00
Alexander Mai
869334acf5
#6554 False positive eraseDereference - erase in while() loop. Add regression test for bug fixed in 1.70
2015-11-10 19:03:35 +01:00
PKEuS
03d52de74b
Treat "class" keyword similar to "struct" or "union" on C++ code ( #6696 )
2015-11-10 17:03:27 +01:00
PKEuS
cc9a1f4375
Fixed setVarId() for template in initializer list ( #7122 )
2015-11-10 16:14:53 +01:00
PKEuS
feae241fc0
Fixed simplification of pointers ( #6829 )
2015-11-10 14:45:24 +01:00
PKEuS
6336372fb4
Apply same heuristics in CheckMemoryLeakNoVar::checkForUnusedReturnValue() as in CheckOther::checkIgnoredReturnValue(): Ensure that a defined function has non-void return value. ( #6693 )
2015-11-10 14:19:45 +01:00
Daniel Marjamäki
459a4e0cbe
Fixed #7121 (False positive 'Uninitialized variable' converting pointer to reference)
2015-11-10 10:18:24 +01:00
PKEuS
5cd36d6f8a
Refactorization: Use varid instead of variable name in CheckClass::initializeVarList() and fixed issue in setVarId().
...
Fixed internal warning.
2015-11-09 23:00:14 +01:00
PKEuS
49a9b011eb
Fixed handling of this-> and (*this). in setVarId()
2015-11-09 21:43:40 +01:00
PKEuS
db342ea910
Handle alias variables in CheckClass::initializeVarList() ( #6921 )
2015-11-09 21:02:06 +01:00
PKEuS
aca8a69f5e
Skip over lambdas in CheckClass::checkPureVirtualFunctionCall() ( #4992 )
2015-11-09 20:15:26 +01:00
PKEuS
f15f8514f6
Fixed crash on garbage code ( #7120 )
2015-11-09 17:25:20 +01:00
PKEuS
389d30fe44
Fixed crash on garbage code ( #7118 )
2015-11-09 11:21:07 +01:00
Daniel Marjamäki
5074c11b53
CheckBufferOverrun: Fixed FP when accessing string that contains '\0'. Refactoring address-of.
2015-11-09 10:30:39 +01:00
Daniel Marjamäki
ef5be435c7
Fixed #7113 (False positive arrayIndexOutOfBounds - using pointer alias with cast)
2015-11-08 17:21:32 +01:00
Daniel Marjamäki
fc564d779e
Fixed #7112 (crash: CheckBufferOverrun::checkGlobalAndLocalVariable (invalid code))
2015-11-08 14:21:12 +01:00
Daniel Marjamäki
37dbebb093
Fixed #7049 (valueflow: value is not known after case)
2015-11-08 14:08:47 +01:00
Alexander Mai
ab296fa93f
7111 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses
2015-11-08 13:45:55 +01:00
PKEuS
32f0cbb6ad
Fixed false positive eraseDereference with range-based for-loops ( #7106 )
2015-11-08 09:42:55 +01:00
Daniel Marjamäki
7d6e1974eb
Fixed #7104 (False positive arrayIndexOutOfBounds)
2015-11-08 09:30:23 +01:00
PKEuS
fdb596fa05
Do not set "pure" flag if function is declared as "= default" ( #7101 )
2015-11-07 22:21:50 +01:00
Matthias Krüger
dc823c65fa
testrunner: add testcase for crash which was fixed in previous 2 commits.
2015-11-07 20:48:52 +01:00
Daniel Marjamäki
9c7271a5e9
CheckBufferOverrun: The simplifyKnownVariables() has been reduced, use ValueFlow instead
2015-11-07 18:12:01 +01:00
Daniel Marjamäki
f7a7a8a95c
Fixed #6934 (False positive returnLocalVariable - assigning local array to function argument)
2015-11-07 15:07:26 +01:00
PKEuS
9a879fc828
Fixed false positives with pointerSize being shown even if no sizeof() is used ( #7100 ).
2015-11-07 13:19:06 +01:00
Alexander Mai
2554674f4b
Add regression test for previously fixed #6064 , and TODO test for #6081
2015-11-07 11:17:44 +01:00
PKEuS
49f6231756
Fixed two issues in CheckSizeof::checkSizeofForPointerSize()
2015-11-07 09:35:30 +01:00
PKEuS
b20a7e3192
Refactorization: Moved two tests to testgarbage.cpp
...
Fixed wrong comment in testcppcheck.cpp (forgotten in previous commit)
2015-11-06 21:58:49 +01:00
PKEuS
61b16909bd
Fixed false negative pointerSize with member variables.
...
Fixed wrong comment in testcppcheck.cpp
2015-11-06 21:48:56 +01:00
PKEuS
7a90b763f6
Tokenizer::simplifyLabelsCaseDefault(): Do not insert ; between two cases.
2015-11-06 19:59:23 +01:00
PKEuS
95a0c0f14c
Limit the number of cases created by Tokenizer::simplifyCaseRange().
2015-11-06 19:21:56 +01:00
PKEuS
1fe1d7ea4a
Extended Tokenizer::simplifyCaseRange() to support also ranges of chars.
2015-11-06 18:46:43 +01:00
PKEuS
41b1b9d850
Support case ranges (gcc extension, #6490 )
2015-11-06 18:39:03 +01:00
PKEuS
2ac8da0497
Fixed #6548 also for noexcept
2015-11-06 18:00:59 +01:00
PKEuS
be36539ad7
Fixed AST generation for C++11-style initialization ( #6528 )
2015-11-06 17:34:26 +01:00
PKEuS
62bc827eb0
Fixed createLinks2() when inheriting from a template ( #6601 )
2015-11-06 10:44:37 +01:00
PKEuS
eb2b0fa0d0
Fixed wrongly detected unconditional scope with C++11-style initialization in SymbolDatabase ( #6581 )
2015-11-06 10:16:44 +01:00
PKEuS
eefea507b9
Use ValueFlow in CheckIO::checkWrongPrintfScanfArguments() ( #6563 )
2015-11-06 09:52:22 +01:00
Alexander Mai
3177d73fb0
#7089 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1. Refactor some functions to accept argument as refernce instead of pointer
2015-11-05 19:00:08 +01:00
PKEuS
83a816b109
Fixed crash on garbage code ( #7085 )
2015-11-04 10:26:55 +01:00
PKEuS
6c20f4b2a2
Fixed crash on garbage code ( #7090 )
2015-11-04 10:10:20 +01:00
PKEuS
8374e8414b
Fixed use-after-free in clang test suite introduced recently ( #7087 )
2015-11-03 19:24:19 +01:00
PKEuS
b97f9e576d
Fixed crash in clang test suite introduced by previous commit.
2015-11-02 22:53:05 +01:00
PKEuS
b049050792
Fixed wrong parsing of ^{}
2015-11-02 22:14:41 +01:00
PKEuS
4f565ba90f
Fixed crashs on garbage code ( #7082 )
2015-11-02 21:30:28 +01:00
PKEuS
23e6e5a568
Fixed crash on garbage code ( #7081 )
2015-10-31 18:11:56 +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
PKEuS
963008089d
Fixed false positive with range-based for-loop ( #7078 )
2015-10-28 16:37:46 +01:00
PKEuS
4ee56d2306
Fixed simplifyAssignmentInFunctionCall for complex expressions ( #6927 )
2015-10-27 20:01:40 +01:00
PKEuS
7866990d04
Fixed false positive with range-based for-loop ( #7075 )
2015-10-27 14:47:18 +01:00
Daniel Marjamäki
bfd8a69e74
Fixed #6243 (False positive: uninitialized variable, looping with goto)
2015-10-27 12:40:52 +01:00
Daniel Marjamäki
4b0625c570
Fixed #6239 (Possible null pointer dereference after pointer is modified by a function template)
2015-10-27 12:33:46 +01:00
PKEuS
24882fb53a
Fixed VarId accidentially assigned to case labels.
2015-10-26 21:24:53 +01:00
PKEuS
dfdc0f6b99
Support range-based for-loop in SymbolDatabase
2015-10-26 19:20:42 +01:00
PKEuS
5add1d8901
Set VarId in range-based for-loops
2015-10-26 19:03:23 +01:00
PKEuS
a5f577d179
Support range-based for-loop in CheckClass::checkConst() ( #5514 )
2015-10-26 18:48:01 +01:00
Alexander Mai
7d8b62e615
Add regression test for #6669 Return value of malloc is reported not stored, while it is.
2015-10-26 18:24:49 +01:00
PKEuS
636bf75799
Fixed crash on garbage code ( #7074 )
2015-10-26 13:29:47 +01:00
PKEuS
0370c66e41
Fixed broken function Token::getCharAt() ( #7073 )
2015-10-26 11:51:05 +01:00
PKEuS
297f2c78bd
Fixed false positives variableHidingTypedef ( #5624 , #6507 )
2015-10-26 10:06:52 +01:00
PKEuS
ee58587706
Fixed false positive unreachableCode when ternary operator is used ( #6664 )
2015-10-26 08:29:43 +01:00
amai2012
116c10c7d6
Merge pull request #700 from simartin/ticket_6998
...
Ticket #6998 : Properly handle "typedef unsigned T;" constructs.
2015-10-24 15:24:27 +02:00
Simon Martin
5d40a3ab66
Ticket #6998 : Properly handle "typedef unsigned T;" constructs.
2015-10-24 12:27:26 +02:00
PKEuS
e989d4b11b
Support C++11 array initialization in CheckUninitVar ( #7010 )
2015-10-24 12:06:40 +02:00
Daniel Marjamäki
fc2bf2ef08
Fixed #7065 (AST: More explicit handling of lambda functions, generate ast for ';new Fred;')
2015-10-20 23:55:29 +02:00
Alexander Mai
3b1d849476
Correct template syntax check which got introduced by an attempt fix #6865 . Disable test for #6865 , adjust some modified tests and add new regression tests
2015-10-19 20:03:33 +02:00
Daniel Marjamäki
b856ac51dd
Fixed #7064 (Tokenizer: Wrong simplification of 'a.public:')
2015-10-19 10:01:57 +02:00
Philipp Kloke
06c20252fa
Added dot at end of stringLiteralWrite message
2015-10-19 09:01:21 +02:00
Philipp Kloke
7060c7c87d
Refactorization: Reduced code duplication in testlibrary.cpp
2015-10-19 09:01:20 +02:00
Philipp Kloke
a837cc48e0
Refactorization: Simplified code in tokenlist.cpp, token.cpp and testthreadexecutor.cpp
2015-10-19 09:01:20 +02:00
Alexander Mai
8667184f12
#7062 Remove unnecessaryQualification check
2015-10-18 17:00:09 +02:00
Daniel Marjamäki
9be284e80f
AST: proper operator precedence for c++11 initializer {} and ::
2015-10-18 16:58:15 +02:00
PKEuS
52be380ef0
Fixed fix for #7042 - support hexadecimal digits
2015-10-18 16:37:33 +02:00
Alexander Mai
21efa992e3
#6865 TemplateSimplifier::expandTemplate doesn't terminate on invalid code. Add some another syntax check on templates to avoid problems later on.
2015-10-18 15:47:37 +02:00
Daniel Marjamäki
9bb2af1893
Fixed #7059 (AST: handle C++ initialization with {} better)
2015-10-18 13:43:39 +02:00
Alexander Mai
8f07b2e440
#6922 valueFlowForward does not terminate: xorg/driver/xf86-video-neomagic : src/neo_driver.c (invalid code). Add regression test for previously fixed bug.
2015-10-18 11:52:25 +02:00
Daniel Marjamäki
fe4fac7eb2
Fixed #7058 (Tokenizer::simplifyTypedef: wrong simplification of enum constant 'AB::A' if AB is a struct typedef)
2015-10-18 04:55:04 +02:00
Daniel Marjamäki
ec87b09d89
Fixed #7056 (iscast does not handle '(ulong)~0' properly, Tokenizer::simplifyCalculations wrongly simplifies '(ulong)~0' to 'ulong~0')
2015-10-17 18:58:13 +02:00
Daniel Marjamäki
30af2fcd73
iscast: handle '(ulong)~0' better
2015-10-17 18:25:27 +02:00
Daniel Marjamäki
c88297c971
Fixed #7054 (AST: handle C++ initialization with {} better)
2015-10-17 17:03:24 +02:00
Alexander Mai
8e3e981323
#7050 segmentation fault (invalid code) in isVariableChanged
2015-10-15 21:27:55 +02:00
Daniel Marjamäki
6cf25825de
Fixed #7030 (Tokenizer::simplifyTypedef: Label)
2015-10-15 16:56:22 +02:00
PKEuS
46bfa62aad
Execute prepareTernaryOpForAST earlier ( #7048 )
2015-10-15 10:31:54 +02:00
Alexander Mai
600641c4c5
#7043 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl
2015-10-14 20:34:55 +02:00
PKEuS
d0cc97a4cf
Fixed wrong syntax error ( #7045 )
2015-10-14 16:01:48 +02:00
PKEuS
a97f6f973f
Support C++14 digit separators ( #7042 )
2015-10-14 12:00:54 +02:00