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
Daniel Marjamäki
60f8982999
Fixed #7039 (ValueFlow: bitand calculation '16&15')
2015-10-14 10:44:04 +02:00
Daniel Marjamäki
a04e072976
Fixed #7040 (False positive syntaxError False positive syntaxError)
2015-10-13 20:31:17 +02:00
PKEuS
3971f8625f
Fixed false positive seekOnAppendedFile if FILE* is reused ( #6566 )
2015-10-13 15:32:13 +02:00
PKEuS
05b5275110
Improved AST:
...
- Fixed TODO for ternary operator. Add parantheses between ? and : where necessary as a preparation for createAst()
- Improved AST validation:
-- Better message for binary operator with only one operand
-- Ensure ? has : as second operand (#7035 )
2015-10-12 19:21:48 +02:00
Daniel Marjamäki
97326fce13
Fixed #6992 (argument name of function typedef conflicts with local variable name)
2015-10-12 10:15:02 +02:00
Daniel Marjamäki
ac9cb87e04
ValueType: Handle bit operations, sizeof better. Use ValueType in astIsFloat().
2015-10-11 12:20:40 +02:00
Daniel Marjamäki
5b082aa799
ValueType: struct member
2015-10-11 10:48:08 +02:00
Daniel Marjamäki
9738cc66eb
ValueType: function return type
2015-10-11 08:42:31 +02:00
Daniel Marjamäki
cf179f82b6
ValueType: Better handling of wide strings
2015-10-11 08:13:30 +02:00
Daniel Marjamäki
0849ad4707
ValueType: Better handling of const
2015-10-10 08:32:45 +02:00
PKEuS
2eb8492993
Fixed crash on garbage code #7034
2015-10-09 13:49:17 +02:00
PKEuS
7d624f2e21
Fixed crash on garbage code #7033
2015-10-09 13:06:52 +02:00
PKEuS
70dce7701a
Refactorization: Reduced code duplication in testpreprocessor.cpp
2015-10-09 12:27:39 +02:00
Daniel Marjamäki
a500f6f703
Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better.
2015-10-08 19:50:10 +02:00
PKEuS
856e4c414d
Refactorization: Reduced code duplication in testsymboldatabase.cpp
2015-10-08 12:53:56 +02:00
PKEuS
3645e3c16b
Fixed two TODO unit tests by delaying arraySize simpification until createLink2 is executed
2015-10-08 12:52:28 +02:00
PKEuS
0a34b206e8
Refactorization: Reduced code duplication in test suite
2015-10-08 11:35:51 +02:00
Philipp Kloke
4ac6623875
Moved a few tests out of testtokenize.cpp; refactorized them
2015-10-07 22:45:38 +02:00
Daniel Marjamäki
2fd27ff729
ValueType: Test promotions
2015-10-07 19:50:33 +02:00
PKEuS
0fa3b8806c
Refactorization: Use '\x..' syntax to avoid cast and "#pragma warning".
2015-10-07 19:41:54 +02:00
Daniel Marjamäki
604a9acb48
ValueType: Handling constness
2015-10-07 19:08:26 +02:00
PKEuS
b7f2f826a4
Refactorization: Removed some redundant code
2015-10-07 18:40:04 +02:00
PKEuS
3a5cef8a7e
Refactorization: Improved usage of Settings instances in test suite
2015-10-07 18:40:03 +02:00
Daniel Marjamäki
db31e22316
ValueType: Improved signedness
2015-10-07 18:10:48 +02:00
PKEuS
f1bbcfe32d
Refactorization: Avoid loading std.cfg multiple times in testautovariables.cpp
2015-10-07 14:40:09 +02:00
PKEuS
93dbfb72d1
Improved REGISTER_TEST() macro to support several occurrences within a single file
2015-10-07 14:30:01 +02:00
PKEuS
07b661ef62
Refactorization: Improved handling of preprocessor in test suite
...
- Set Preprocessor::macroChar to '$' once in the beginning to avoid problems when changing the order of tests
- Removed Preprocessor usage from where it is not required
- Fixed a TODO in testuninitvar.cpp
2015-10-07 14:18:57 +02:00
PKEuS
50ed47c725
Fixed crash on garbage code ( #7022 )
2015-10-07 13:52:06 +02:00
Daniel Marjamäki
f5d9ba9cf3
Rewrote the charvar checker. It now uses valueflow also to limit false negatives.
2015-10-06 17:30:51 +02:00
amai2012
88b3d90505
#7023 segmentation fault (invalid code) in astIsIntegral. Avoid crash, unfortunately there is no syntax error yet detected.
2015-10-06 11:21:31 +02:00
Daniel Marjamäki
b77203a277
CheckIO: Handle AST pointer type better
2015-10-05 19:59:15 +02:00
Daniel Marjamäki
b9036c2ca8
AST types: Fix for 'long long' handling
2015-10-05 19:20:42 +02:00
Daniel Marjamäki
8f6bd7fd0d
Fixed #7014 (False positive for printf("%c", "hello"[0]))
2015-10-05 10:12:30 +02:00
Daniel Marjamäki
f35c24d4af
SymbolDatabase: Better handling of valuetypes in AST
2015-10-04 23:27:58 +02:00
Daniel Marjamäki
9b253612ca
SymbolDatabase: Add type information in AST
2015-10-04 19:42:58 +02:00
Frank Zingsheim
3bc21b8138
Fixed #6996 (ValueFlow: known and possible values)
2015-10-04 10:33:43 +02:00
Daniel Marjamäki
f5bd00f153
Library: return true from Library::isnullargbad() for format string arguments. Related with #7012 .
2015-10-03 20:51:45 +02:00
Daniel Marjamäki
a574fda8a9
Fixed #6935 (Wrong duplicate expression)
2015-10-03 14:56:24 +02:00
Alexander Mai
27f72d7ae0
#7020 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #7021 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-10-03 10:47:23 +02:00
Simon Martin
0f7e20c11d
Ticket #7017 : Properly interpret operator= return type for template classes in CheckClass::operatorEq.
2015-10-02 23:23:44 +02:00
amai2012
fde59242bb
#7018 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-10-02 15:33:23 +02:00
Martin Ettl
2fbb25e9bc
test/std.cfg: Added more test cases and comments.
2015-10-01 20:18:06 +02:00
Martin Ettl
dc051f077d
#6667 : Added a regression test to testgarbage.
2015-09-30 21:55:32 +02:00
Martin Ettl
12b4bf75e0
std.cfg: Fixed false negatives regarding uninitialized variable usage and added test cases.
2015-09-30 13:10:31 +02:00
Martin Ettl
0b782853fe
Imroved std.cfg and added more test cases.
2015-09-30 12:45:40 +02:00
Martin Ettl
4fcd324ccd
Improved testing of std.cfg regarding <arg nr=any> configured functions and added more test cases.
2015-09-30 12:18:56 +02:00
Martin Ettl
c64f9cf9b1
#7012 : Fixed FP in std.cfg by explicitly definining the first parameter of snprintf.
2015-09-29 21:33:39 +02:00
Martin Ettl
69b1e21560
Improved testing of std.cfg and added more test cases for snprintf(). There is a FP (according to #7012 ).
2015-09-29 21:14:22 +02:00
PKEuS
e6467703b2
Support cast to ** in Tokenizer::simplifyCasts() ( #7005 )
2015-09-28 16:08:14 +02:00
PKEuS
590f1f1d66
Fixed handling of __asm...__endasm ( #6970 )
2015-09-28 15:43:48 +02:00
Thomas Otto
7ba69cfd0a
sizeofCalculation: skip if void-casted inside a macro ( #6888 )
2015-09-28 14:33:29 +02:00
Daniel Marjamäki
bd243a4748
Fixed #6903 (ValueFlow: Fix FP in ?:)
2015-09-27 13:29:28 +02:00
Dmitry-Me
6304a4dddb
Fix FP for members of temporaries
2015-09-25 13:57:11 +03:00
Dmitry-Me
da15efb3f6
Fix FN for distinct structs with identical members
2015-09-24 18:29:08 +02:00
Martin Ettl
7476f0d1c2
std.cfg: Added support for wmemcmp() and corresponding test cases.
2015-09-23 22:46:36 +02:00
Alexander Mai
c27fc31fcf
#6997 segmentation fault (invalid code) in CheckUninitVar::checkIfForWhileHead. Detect invalid syntax.
2015-09-23 10:33:55 +02:00
orbitcowboy
3bc4ea4e51
Merge pull request #687 from Dmitry-Me/tellIfItsStructOrUnion
...
Tell if it's struct or union
2015-09-22 21:14:30 +02:00
Martin Ettl
34dcf1182c
test/cfg: Deactivated a test case in std.cpp, which tests std::string::find (three parameter version). It cases the travis build to be failing.
2015-09-22 20:54:25 +02:00
Dmitry-Me
0b991f5560
Tell if it's struct or union
2015-09-22 17:38:23 +03:00
Martin Ettl
10da5d6d2f
std.cfg: Added configuration for std::string:find.
2015-09-21 23:01:51 +02:00
Martin Ettl
f2fae9836b
test/cfg: Another attempt to fix travis build.
2015-09-21 21:51:19 +02:00
Martin Ettl
55ccaea4a5
std.cfg: Added more functions from <cuchar> and corresponding test cases.
2015-09-21 13:40:56 +02:00
Martin Ettl
39622417b1
Improved std.cfg and added coressponding test cases to test/cfg.
2015-09-18 23:57:20 +02:00
Martin Ettl
841ad5462d
test/cfg: Improved std.cfg and added corresponding test cases.
2015-09-18 23:02:51 +02:00
Martin Ettl
fc4b9d320d
test/cfg: Improved testing of std.cfg about std::stod().
2015-09-18 16:25:05 +02:00
Daniel Marjamäki
305760f143
Uninitialized variables: Fix FP for struct array
2015-09-16 14:42:55 +02:00
Daniel Marjamäki
af233efcce
Uninitialized variables: tweaked checking of arrays / allocated buffers
2015-09-14 09:03:21 +02:00
Daniel Marjamäki
ad007ca2d7
Uninitialized variables: better checking of arrays
2015-09-13 16:32:16 +02:00
Frank Zingsheim
1fd9ba0cc4
Fixed #6988 (incorrect nullPointer error for string)
2015-09-13 10:53:05 +02:00
orbitcowboy
fd81ee9804
test/cfg: Improved testing of std.cfg regarding uninitialized and nullPointer checks.
2015-09-11 16:50:59 +02:00
orbitcowboy
3187a2b972
test/cfg: Improved testing of std.cfg regarding null pointer dereferences.
2015-09-11 16:29:39 +02:00
orbitcowboy
7ae7cdd17b
test/cfg: Added test cases for std::string find, that demonstrate false negatives in case of uninitialized variable ( #6991 ).
2015-09-10 17:03:50 +02:00
orbitcowboy
5e50166135
Improved testing of std.cfg.
2015-09-10 16:45:14 +02:00
orbitcowboy
bf53065d17
Added a comment, no functional changes [ci-skip].
2015-09-10 13:23:34 +02:00
orbitcowboy
66b9d8bf38
Improved testing of std.cfg and posix.cfg.
2015-09-10 11:50:47 +02:00
orbitcowboy
2b416419de
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-09 16:59:26 +02:00
orbitcowboy
52090f5725
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-09 16:32:52 +02:00
PKEuS
fbbdfa85ca
Revert "Fixed false negative #5815 "
...
This reverts commit dc6c278d83
.
2015-09-09 14:46:47 +02:00
orbitcowboy
2f5fd66d00
#6577 : Added test cases to test/posix.c. They demonstrate that there is still a false negative.
2015-09-09 08:53:12 +02:00
orbitcowboy
e929e9e7d9
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-08 16:08:43 +02:00
orbitcowboy
60770a8fdc
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-08 15:43:22 +02:00
orbitcowboy
7d229f082c
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-08 11:45:13 +02:00
orbitcowboy
03495360d8
test/cfg: Improved testing of std.cfg regarding uninitialized variables.
2015-09-07 16:57:34 +02:00
Daniel Marjamäki
d88dc3ed3e
Reverted 00c54df07c
(don't remove enum declarations) because it caused unexpected false positives
2015-09-06 18:37:22 +02:00
Daniel Marjamäki
00c54df07c
Tokenizer: Don't remove enum declarations
2015-09-06 17:44:49 +02:00
PKEuS
5c348890b2
Preserve varId in simplifyArrayAccessSyntax ( #6523 )
2015-09-05 13:14:08 +02:00
Martin Ettl
8ffa96975a
test/cfg/: Removed invalid test case.
2015-09-05 09:44:43 +02:00
Alexander Mai
890343dad0
Add regression tests for #678,#6834 - crashes on garbage code
2015-09-05 08:38:50 +02:00
Martin Ettl
bcb7dce97e
Fix Travis build.
2015-09-04 23:50:50 +02:00
Martin Ettl
6304eb35f9
Improved testing of std.cfg regarding uninitialized variables.
2015-09-04 23:45:31 +02:00
Martin Ettl
27b3461e84
Fixed #6974 - false negative: uninitialized variable not detected (signal).
2015-09-04 22:48:00 +02:00
PKEuS
1aa958d60c
Updated VS solution with VS2015 as default. Added flags /Zc:inline and /Zc:throwingNew.
2015-09-04 14:30:54 +02:00
orbitcowboy
5428813534
Improved testing of std.cfg regarding uninitialized variables.
2015-09-04 11:59:19 +02:00
orbitcowboy
c955fafd84
Improved testing of std.cfg regarding uninitialized variables.
2015-09-04 11:26:43 +02:00
PKEuS
b49c5d7193
Merge pull request #665 from simartin/todo_condition
...
Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool.
2015-09-03 22:53:33 +02:00
Simon Martin
f273323cd0
Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool.
2015-09-03 21:07:03 +02:00
orbitcowboy
9daf78527f
Improved testing of std.cfg regarding uninitialized variables.
2015-09-03 16:34:44 +02:00
orbitcowboy
84d8a869d0
Improved testing of std.cfg regarding uninitialized variables.
2015-09-03 16:03:16 +02:00
orbitcowboy
34551203a6
Improved testing of std.cfg regarding uninitialized variables.
2015-09-02 17:08:25 +02:00
orbitcowboy
89c4e08fc4
Improved testing of std.cfg regarding uninitialized variables.
2015-09-02 15:43:52 +02:00
orbitcowboy
651e225069
Improved testing of std.cfg regarding uninitialized variables.
2015-09-02 12:00:03 +02:00
orbitcowboy
d87d2ff779
Improved testing of std.cfg regarding uninitialized variables.
2015-09-01 16:50:36 +02:00
orbitcowboy
c64e74492b
Improved testing of std.cfg regarding uninitialized variables.
2015-09-01 11:59:24 +02:00
orbitcowboy
974414645a
Improved testing of std.cfg regarding uninitialized variables.
2015-09-01 11:29:28 +02:00
amai2012
e683d31e71
Re-enable okenizer::removeMacroInClassDef for C code
2015-09-01 07:10:12 +02:00
PKEuS
04209c08cf
Merge pull request #644 from Dmitry-Me/fixSearchReplace
...
Fix search-replace
2015-08-31 21:14:58 +02:00
orbitcowboy
f24fdb4257
Improved testing of std.cfg.
2015-08-31 17:10:10 +02:00
Dmitry-Me
969b1bfbe9
Fix search-replace
2015-08-31 17:44:33 +03:00
PKEuS
dc6c278d83
Fixed false negative #5815
2015-08-31 14:12:19 +02:00
orbitcowboy
0dd0f2a97d
Improved testing of std.cfg and added more test cases.
2015-08-31 13:35:57 +02:00
orbitcowboy
d1ba919e39
Improved testing of std.cfg regarding uninitialized variables.
2015-08-31 11:59:57 +02:00
orbitcowboy
f653189bd4
Improved testing of std.cfg and added more test cases.
2015-08-31 11:39:25 +02:00
PKEuS
c5a8ecb6f9
New check: Detect unused 'goto' labels ( #5124 )
2015-08-30 16:45:47 +02:00
PKEuS
f12f16cb4a
Handle anonymous structs (which can appear inside unions) like anonymous unions ( #2039 )
2015-08-30 15:41:54 +02:00
Martin Ettl
5e9325b4f4
test/cfg: Improved testing of std.cfg and added more test cases.
2015-08-30 12:05:38 +02:00
Martin Ettl
fb643ba2d4
Running astyle; test/cfg/: Since #6958 is fixed, activated test cases for fma()-functions.
2015-08-30 11:59:33 +02:00
Philipp Kloke
56698dd844
Fixed #6919 : Support initializer list in duplicateEnumError check
2015-08-29 22:20:09 +02:00
PKEuS
d7853b9963
Fixed simplification of fma(a, b, c) ( #6958 )
2015-08-29 20:52:03 +02:00
Alexander Mai
8d2c4453ad
Small optimizations for C code in Tokenizer. Add some regression tests for recently fixed results
2015-08-29 19:00:09 +02:00
Daniel Marjamäki
e31ee26b6c
Merge pull request #662 from simartin/ticket_6959
...
Ticket #6959 : Properly handle arrays of pointers in CheckClass::constructors
2015-08-29 13:22:10 +02:00
Daniel Marjamäki
6ddd0a953f
Fixed #6917 (False positive uninitvar - unused array declaration and ternary expression)
2015-08-29 13:19:28 +02:00
Simon Martin
b4b636b6a2
Ticket #6959 : Properly handle arrays of pointers in CheckClass::constructors.
2015-08-29 13:11:00 +02:00
Alexander Mai
66e4faa621
Add regression test for true negative argumentSize
2015-08-29 11:14:13 +02:00
PKEuS
d5bc3285b9
Move "extern" to the beginning of a declaration like "static" and "const"
2015-08-29 10:57:52 +02:00
Martin Ettl
0e3b74fbbc
test/cfg: Improved testing of std.cfg. Fixed false negatives by adding more stdandard namespace functions and test cases.
2015-08-29 01:43:17 +02:00
Martin Ettl
08413f0112
test/cfg: Improved testing of std.cfg.
2015-08-29 00:09:33 +02:00
Simon Martin
101cebbde1
Ticket #6957 : Properly handle arrays of pointers in CheckClass::constructors.
2015-08-28 23:06:39 +02:00
Simon Martin
59abb04042
Ticket #6596 : Address of local variables can also be assigned to pointer-pointer arguments using the ptr[] syntax.
2015-08-28 20:29:51 +02:00
orbitcowboy
994ba5d5a4
Improved testing of std.cfg.
2015-08-28 17:04:47 +02:00
amai2012
2b17a5bcee
Merge pull request #656 from simartin/ticket_6953
...
Ticket #6953 : Fixed flawed logic in PR#650.
2015-08-28 06:01:13 +02:00
Simon Martin
c78d99dc07
Ticket #6954 : Properly handle pointers to arrays in CheckUnunsedVar.
2015-08-27 23:56:26 +02:00
Simon Martin
2e2f9facf5
Ticket #6953 : Fixed flawed logic in PR#650.
2015-08-27 23:35:22 +02:00
orbitcowboy
a1b2597a5e
test/cfg/ Suppress implicit function declaration warnings from GCC.
2015-08-27 14:49:52 +02:00
PKEuS
af07c3ce46
Merge pull request #649 from simartin/useless_todo
...
Remove unnecessary TODO exception safety test case.
2015-08-27 14:40:47 +02:00
PKEuS
2ace3d3144
Rewritten handling of declaration specifiers:
...
- Removed simplifyConst() because it did the opposite of the (superior) simplifyStaticConst()
- Execute simplifyStaticConst() in simplifyTokenList1() - there is no reason to defer it, and it is required to properly parse declarations like "unsigned static int i;"
- Fixed simplifyStaticConst() to handle more patterns. It did not work at the beginning of the token list and for function arguments
- Reimplemented Tokenizer::simplifyStdType()
-> properly support all possible ways to declare integers as requested by the standard, instead of only a few common permutations of "unsigned|signed", "short|char|long|int"
-> Fixed parsing of _Complex/complex types
2015-08-27 14:34:17 +02:00
PKEuS
7bb79562e9
Skip inner classes in CheckAutoVariables::returnReference() ( #6951 )
2015-08-26 13:31:51 +02:00
PKEuS
37aec52399
Simplify complex/_Complex types ( #6939 )
2015-08-26 13:13:45 +02:00
PKEuS
c8c59aa92b
Removed Tokenizer::simplifyIfSameInnerCondition(). It covered only very simple patterns and is unlikely to have an impact on real-world code.
2015-08-26 13:04:00 +02:00
Simon Martin
6fb19b02d0
Properly differentiate arrays of pointers and pointers to arrays.
2015-08-25 21:19:19 +02:00
Simon Martin
8beb95e179
Fix CheckClass::checkMemset for arrays of pointers.
2015-08-23 19:57:58 +02:00
Simon Martin
0c2b5cc244
Remove unnecessary TODO exception safety test case.
2015-08-21 22:28:56 +02:00
amai2012
873861df4a
#6948 cash: daca: mgetty (garbage code)
2015-08-21 10:40:43 +02:00
PKEuS
8d926d7328
Moved some simple WinAPI/MFC-specific simplifications to windows.cfg
2015-08-20 15:59:59 +02:00
PKEuS
128a926d9d
Collected some more garbage code tests in testgarbage.cpp; Avoid std::string creation in testgarbage.cpp
2015-08-16 19:12:12 +02:00
Martin Ettl
c26ec86508
std.cfg: Readded accidentially removed functions from <cfenv> and added test cases to test/cfg/std.cpp.
2015-08-16 15:05:42 +02:00
Martin Ettl
ca7e232b60
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-08-16 14:49:59 +02:00
Martin Ettl
58d7b8a3f2
std.cfg: Added more test cases.
2015-08-16 14:49:35 +02:00
PKEuS
0babc4f38f
Moved some unit tests to testgarbage.cpp
2015-08-16 14:49:35 +02:00
Martin Ettl
2665fb9481
std.cfg: Removed some non-existent functions that accidentially declared being in standard namespace. Improved testing of std.cfg functions.
2015-08-16 14:38:13 +02:00
PKEuS
ab8afec3eb
Refactorizations:
...
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
Martin Ettl
a8af7142a1
std.cfg: Added more test functions.
2015-08-16 01:29:34 +02:00
Martin Ettl
716b4d6e18
Another attempt to fix the current travis build. Improved testing of std.cfg.
2015-08-16 01:21:11 +02:00
Martin Ettl
ab0862f218
std.cfg: Fixed travis build. Added noreturn to the assert-definition in std.cfg. Improved testing of std.cfg.
2015-08-16 01:09:03 +02:00
Martin Ettl
b2bf6cde5f
std.cfg: Improved testing of libary functions. Removed some non existent such as std::sinf from the libary and added corresponding test cases to test/cfg/.
2015-08-16 00:52:52 +02:00
Daniel Marjamäki
c72047f6f5
Fix 'make checkcfg' errors.
2015-08-15 14:35:23 +02:00
PKEuS
b77912a0b5
Support namespaces in CheckOther::checkIgnoredReturnValue()
2015-08-15 12:19:14 +02:00
PKEuS
4d80df2f4a
Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
...
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Daniel Marjamäki
871b02ea88
removed testcase for #5238 . it's not good enough.
2015-08-15 07:38:56 +02:00
Martin Ettl
84486605ec
#6392 : Added a regression test case.
2015-08-15 01:00:36 +02:00
Martin Ettl
278808daa9
#5238 : Added a regression test case.
2015-08-15 00:49:07 +02:00
Martin Ettl
640ec3a099
#6491 : Added a regression test.
2015-08-15 00:31:26 +02:00
Alexander Mai
4fe61a6c3e
Correct actual result string
2015-08-14 18:55:21 +02:00
Alexander Mai
8b433fa053
Add regression test for #6299 . Fix clang compiler warning due to doxygen comment
2015-08-14 18:27:03 +02:00
PKEuS
a297a03b64
Fixed false positive #6787 : Skip over lambdas in CheckAutoVariables::returnReference()
2015-08-14 13:03:07 +02:00
PKEuS
b0bf69bae7
Fixed false positive #6763 and reordered conditions
...
Ran AStyle
2015-08-14 12:50:45 +02:00
PKEuS
3cf67014ad
Fixed parsing of template in enum
2015-08-14 11:08:03 +02:00
Daniel Marjamäki
e578988832
invalidScanf: removed the checking for 'scanf crash with huge input data for old glibc'. new systems are not vulnerable to this bug anymore.
2015-08-14 08:03:46 +02:00
Martin Ettl
e9b1f1f0a6
test/cfg/ Started to test std::complex functions.
2015-08-14 02:06:48 +02:00
Martin Ettl
77869b7812
test/cfg: Improved testing of functions from standard namespace. Added test/cfg/*.c* files to astyle script and formatted code.
2015-08-14 01:36:44 +02:00
Malcolm Parsons
daf633ef78
Fixed #5028 Fix parsing of C++11 raw string literals
2015-08-12 13:11:55 +01:00
Daniel Marjamäki
6865724c4e
Fixed #6914 (Token::expressionString: parenthesis missing in expression (*it)->stats.corpse_ticks)
2015-08-12 10:55:25 +02:00
PKEuS
002b606a9c
Refactorized CheckObsoleteFunctions:
...
- Mention all checked functions in getErrorMessages() and classInfo(), not only posix ones
- Made members static and initialize them only once only once
- Better support for global namespace
2015-08-11 14:57:23 +02:00
Matthias Krüger
7a90b36cca
CheckVaarg::va_start_subsequentCallsError: fix spelling "inbetween" -> "in between"
2015-08-11 14:03:00 +02:00
Matthias Krüger
391194579c
CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates"
2015-08-11 13:27:55 +02:00
Daniel Marjamäki
501ab0b6da
CheckLeakAutoVar: updated handling of unknown types in C++
2015-08-11 12:41:42 +02:00
Daniel Marjamäki
2e78d21480
Fixed #6730 (ValueFlow: inner scope does not return (continue,throw))
2015-08-11 11:21:03 +02:00
Martin Ettl
797cac5098
Library: Started to test functions from std-namespace.
2015-08-10 23:44:36 +02:00
Martin Ettl
ceafde86ad
Library: Removed not needed suppressions.
2015-08-10 23:09:56 +02:00
Martin Ettl
38cba67115
Suppressed compiler warnings during testing cfg tests.
2015-08-10 22:58:46 +02:00
Alexander Mai
b3cc4629a6
Remove obsolete tests. Add incomplete test for GNU __builtin_expect to gnu.c
2015-08-10 21:20:20 +02:00
Daniel Marjamäki
5b287fc849
Library: The <function> name attribute can now have a comma separated list of names
2015-08-09 21:27:57 +02:00
Daniel Marjamäki
b70fe4c609
Fixed #6711 (Add namespace support to library files)
2015-08-09 19:55:33 +02:00
Daniel Marjamäki
9627fccdc5
assignFunctionArg: don't warn when there is self assignment. There is a separate warning for self assignments.
2015-08-09 14:51:23 +02:00
Daniel Marjamäki
e71ab70356
Fixed #6871 (False positive uninitvar - pointer to uninitialized char[])
2015-08-08 14:52:46 +02:00
Daniel Marjamäki
72706cd0b8
Fixed #6868 (Tokenizer: wrong simplification of the unlikely keyword)
2015-08-08 12:49:42 +02:00
Daniel Marjamäki
8f309aed12
TestUninitVar: cleanup duplicate tests for function handling
2015-08-08 09:57:56 +02:00
Daniel Marjamäki
7ec8adeb93
Fixed #6701 (Uninitialized variable warning when header could not be found)
2015-08-08 08:53:08 +02:00
Daniel Marjamäki
c9e239afbf
Fixed #6908 (False positive: Same expression on both sides of '+='.)
2015-08-07 20:28:25 +02:00
Daniel Marjamäki
ec3d76be5e
astyle formatting
2015-08-07 20:27:32 +02:00
amai2012
53feb88614
Merge pull request #630 from Dmitry-Me/detectRaceInInterlockedAccess
...
Prototype for detecting non-interlocked check after InterlockedDecrement()
2015-08-06 15:43:10 +02:00
Daniel Marjamäki
07a064aab0
Fixed #6910 (ValueFlow: variable incremented as macro argument is not known)
2015-08-05 14:08:57 +02:00
Dmitry-Me
43800a9419
Detect non-interlocked check after InterlockedDecrement()
2015-08-05 12:20:28 +03:00
Daniel Marjamäki
eda5272dfd
Fixed #6875 (Improve 'Redundant condition' error message)
2015-08-05 11:15:54 +02:00
Daniel Marjamäki
4bebb80300
Fixed #6869 (False positive: uninitvar, array passed to function)
2015-08-05 10:19:17 +02:00
Daniel Marjamäki
67e9ed9294
ZeroDiv: Avoid constant folding in testcases
2015-08-02 18:56:26 +02:00
Daniel Marjamäki
8d3f7e36e9
Fixed #6911 (valueflow: comparison of string and NULL)
2015-08-02 18:12:03 +02:00
Alexander Mai
ea62ab337b
Add more testcases for zerodiv
2015-08-02 14:05:09 +02:00
Frank Zingsheim
7021cb2c6b
Fixed #6284 (Token::Match called with varid 0. Constants)
2015-08-02 09:11:51 +02:00
Simon Martin
0009ceee59
Ticket #6793 : Added basic unit test showing that basic integer shift length check is run even for templates.
2015-08-02 00:03:09 +02:00
Alexander Mai
965a034afd
Fix some more false positives on zerodiv: error should be issued if type of epxression is known to be integral
2015-08-01 18:42:17 +02:00
Alexander Mai
f91ad9bbf6
5402 false positive: (error) Division by zero -- with boost::format
2015-08-01 17:28:54 +02:00
Martin Ettl
1741af497f
Added test case for #6858 .
2015-08-01 17:26:23 +02:00
Martin Ettl
b7ea311123
Running astyle. No functional changes.
2015-08-01 12:31:16 +02:00
amai2012
b182edddda
#6909 segmentation fault (invalid code) in Tokenizer::simplifyEnum
2015-08-01 12:24:22 +02:00
Alexander Mai
acf050793e
#6907 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1
2015-08-01 07:39:56 +02:00
Alexander Mai
0b96b9d984
#6505 ValueFlow: handle 2 related if in valueFlowSubFunction. Regression test. Bug got fixed before
2015-07-31 21:15:43 +02:00
Alexander Mai
4400f2ac85
#6900 segmentation fault (invalid code) in CheckStl::runSimplifiedChecks.
2015-07-31 20:24:06 +02:00
Matthias Krüger
73eefa46fc
testcondition: update testcase that was added since I did the changes.
2015-07-31 15:31:43 +02:00
Matthias Krüger
8bfbb5d09c
CheckMemoryLeakNoVar::returnValueNotUsedError: put function name into singlequotes
2015-07-31 15:29:07 +02:00
Matthias Krüger
83ee640977
Tokenizer::syntaxError: put the character that we have an invalid number of into singlequotes instead of parentheses.
2015-07-31 15:28:59 +02:00
Matthias Krüger
87891b4128
CheckCondition::checkIncorrectLogicOperator put conditions in single quotes
2015-07-31 15:28:48 +02:00
Matthias Krüger
21ed807f8d
CheckCondition::alwaysTrueFalseError: put condition in single quotes.
2015-07-31 15:28:37 +02:00
Daniel Marjamäki
251f6d2a15
Fixed #6898 (Token::expressionString: wrong output when first token is post-incremented)
2015-07-31 07:03:52 +02:00
Martin Ettl
42a406ac5f
testbufferoverrun: Removed duplicate test case.
2015-07-30 22:42:45 +02:00
amai2012
249a05126b
#6895 segmentation fault (invalid code) in CheckCondition::isOppositeCond
2015-07-30 17:19:19 +02:00
Daniel Marjamäki
d4344bd859
cleanup testcases for div()
2015-07-30 14:05:53 +02:00
Daniel Marjamäki
1752c4f4f0
Avoid 'Condition always true/false' FP when part of the condition is an expanded macro
2015-07-30 13:30:16 +02:00
amai2012
c5673612e2
#6069 False positive incorrectLogicOperator due to dynamic_cast. Run CheckCondition::checkIncorrectLogicOperator on non-simplified tokenlist.
2015-07-30 10:30:30 +02:00
Daniel Marjamäki
9085fdc156
Fixed #6887 (False positive eraseDereference - container is member of member variable)
2015-07-30 10:13:49 +02:00
Daniel Marjamäki
6790d91fbb
Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884 .
2015-07-29 19:54:57 +02:00
PKEuS
738057229c
Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
...
Handle sizeof in isSameExpression() (#6851 )
2015-07-29 14:28:24 +02:00
Daniel Marjamäki
120f3072eb
alwaysTrueFalse: Dont write warning when comparison is made in macro
2015-07-29 12:51:00 +02:00
Daniel Marjamäki
fc25ed8c86
Fixed #6879 (valueflow in do-while(++i))
2015-07-29 11:55:07 +02:00
Daniel Marjamäki
bf75ee9aed
Fixed #6885 (valueflow ignores assignment of variable via function call)
2015-07-29 10:49:17 +02:00
amai2012
1f43550688
#6880 , 6881 Crashes on invalid code. Fix null pointer access
2015-07-28 18:41:50 +02:00
Dmitry-Me
544932734f
VS: Disable 4482 warning
2015-07-28 18:33:45 +02:00
Daniel Marjamäki
e759710198
Fixed #6743 (valueFlowAfterCondition: wrong value when variable is changed in conditional code)
2015-07-28 08:58:05 +02:00
Daniel Marjamäki
c5bbea2994
Fixed #6816 (FP: buffer overflow, checkminsizes of array with string value)
2015-07-27 16:39:41 +02:00
Daniel Marjamäki
b50f554b28
TestValueFlow::valueFlowArrayElement: Refactoring tests
2015-07-27 16:25:14 +02:00
Daniel Marjamäki
05a21d45eb
Fixed #6670 (Analysis failed when there are {} in LHS in compound assignment)
2015-07-27 13:44:35 +02:00
Daniel Marjamäki
35eb1a393d
AST: handle concatening of strings better. this is not ideal but better.
2015-07-27 13:13:30 +02:00
Daniel Marjamäki
64b72bd6e5
Fixed #6227 (False positive (oppositeInnerCondition) - if (!dynamic_cast<>))
2015-07-27 10:43:52 +02:00
Daniel Marjamäki
29fbbef001
TestOther: Added zeroDiv test to make sure there is not FN when there is cast
2015-07-26 22:23:37 +02:00
Daniel Marjamäki
bf921251e9
TestOther: code cleanup
2015-07-26 22:21:26 +02:00
Daniel Marjamäki
389aec51ae
Fixed #6598 (False positive zerodivcond - cast to double ignored)
2015-07-26 22:08:36 +02:00
Alexander Mai
7cdeb70efa
Fix some glitches from previous commit to TestMathLib
2015-07-26 19:47:27 +02:00
Daniel Marjamäki
ed1c6e41d9
Fixed #6876 (valueFlowForward: lambda function)
2015-07-26 19:28:42 +02:00
Alexander Mai
7c48bf3ca5
MathLib::isFloat now detects C99 hexadecimal float literals. MathLib::isDecimalFloat was added for C++ and pre-C99 compatibility.
2015-07-26 19:21:53 +02:00
Daniel Marjamäki
190550f9f9
Fixed #6877 (ValueFlow: valueFlowForward, after goto label the value is not known)
2015-07-26 17:05:21 +02:00
Alexander Mai
bc28b252bf
#6048 syntax error in enum - value set to member of template class. Add test case, issue got fixed before
2015-07-26 15:42:40 +02:00
PKEuS
2342b604b0
Refactorized preprocessor (speedup of preprocessing time by ~10%):
...
- Reduced memory usage of PreprocessorMacro by 87,5% (removed redundant or unused members)
- Use char overload of std::string::find where possible
- Reordered conditions
2015-07-26 12:03:40 +02:00
Daniel Marjamäki
f3b5857b96
improved testing of calculations in valueflow
2015-07-26 12:00:42 +02:00
Alexander Mai
bbec54db8e
Implement MathLib::isFloatHex to detect C99 hexadecimal floating pointer literals. Rename MathLib::isHex to MathLib::isIntHex
2015-07-26 08:06:56 +02:00
Alexander Mai
12eb3ae716
#6628 False positive: The extra qualification 'namespace::' is unnecessary and is considered an error by many compilers. Add regression test since that issue has been fixed in 1.69 already
2015-07-26 06:54:46 +02:00
Alexander Mai
473336f986
#6426 FP duplicateExpressionTernary - (expr) ? ~0u : ~0ul. Regression test added. That issue got fixed in 1.69 already
2015-07-26 06:28:23 +02:00
Daniel Marjamäki
afd9f071c0
simplified the code for ValueFlow Known/Possible values
2015-07-25 19:36:29 +02:00
Alexander Mai
6548f20d9a
#4871 "Uninitialized variable" when try/catch on an if branch. Regression test, issue got fixed since 1.69
2015-07-25 19:02:20 +02:00
Alexander Mai
a36b544995
#3991 false positive: Memory leak (allocation function returns success/failed code). Add testcase. Issue had been fixed in 1.69 already
2015-07-25 18:50:27 +02:00
PKEuS
92b867dd2c
Fixed behaviour of --quiet/-q and its description
2015-07-25 17:55:12 +02:00
PKEuS
8ed0180279
Use C++11 string.back() instead of string[string.length()-1]
2015-07-25 17:19:53 +02:00
PKEuS
176b3925b3
Removed "verify" code in testrunner. Fixing its messages reduces the accuracy of the test suite.
2015-07-25 14:18:41 +02:00
Daniel Marjamäki
e5151a13ab
Fixed #6867 (False positive memleak)
2015-07-25 11:37:03 +02:00
Simon Shanks
9910c1fa0c
Fixed #6617 (preprocessor performance improvement)
2015-07-24 13:30:41 +02:00
Daniel Marjamäki
8ffa917fa2
Fixed #6863 (AST: wrong handling of assignment between ? and :)
2015-07-24 13:02:00 +02:00
Daniel Marjamäki
234669b02b
Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected.
2015-07-24 08:30:38 +02:00
Alexander Mai
ed74a3dcc6
Testcase for #4683 added (which got fixed already)
2015-07-24 06:06:31 +02:00
PKEuS
e95800bed4
Added regression test for #4816
...
Ran AStyle
2015-07-23 20:53:50 +02:00
PKEuS
795e5de903
Refactorization: Cleaned up after ExecutionPath removal
2015-07-23 20:37:09 +02:00
Daniel Marjamäki
3dbf290220
Refactor CheckStl::erase so it doesn't use ExecutionPath
2015-07-23 18:53:31 +02:00
Daniel Marjamäki
ea933e9873
CheckUninitVar: Removed ExecutionPath based checker
2015-07-23 17:28:18 +02:00
Daniel Marjamäki
995c4196b5
testuninitvar: use new checking instead of executionpath
2015-07-23 17:20:11 +02:00
Daniel Marjamäki
0b81a267f4
uninitvar: handling arrays in non-executionpath checker
2015-07-23 14:51:38 +02:00
PKEuS
ce9272a4ed
Refactorized file listing code (CLI):
...
- Apply PathMatch in FileLister::recursiveAddFiles() already to avoid touching directories that are ignored (#5775 )
- Simplified code to warn about header exclusion; use Path::isHeader() instead of custom header filename detection
2015-07-23 14:28:17 +02:00
Daniel Marjamäki
28fd6ce2f0
testuninitvar: use new checking instead of executionpath in 2 more testcases
2015-07-23 13:50:02 +02:00
Daniel Marjamäki
c4f9a2a160
testuninitvar: update testcase
2015-07-23 12:58:38 +02:00
Frank Zingsheim
6485339d66
Support lambdas in "else if" simplification ( #6860 )
2015-07-23 09:41:35 +02:00
Daniel Marjamäki
79067ac031
uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases.
2015-07-23 08:46:59 +02:00
Daniel Marjamäki
239f0d4ab4
testuninitvar: use new checking instead of executionpath in various testcases
2015-07-22 22:53:59 +02:00
Daniel Marjamäki
1de1aaa2f4
CheckUninitVar: Fix crash when AST is not created properly
2015-07-22 22:17:12 +02:00
Daniel Marjamäki
1f5eea98b5
CheckUninitVar: Fix a FP reported for invalid code
2015-07-22 21:58:06 +02:00
Daniel Marjamäki
42ed436e9d
Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath
2015-07-22 20:31:58 +02:00
Robert Reif
4e693f1620
Fixed #6827
2015-07-22 13:57:51 +02:00
PKEuS
ab1113fb16
Fixed crash on garbage code #6859
2015-07-22 13:33:24 +02:00
Daniel Marjamäki
f711520892
Fixed #6852 (false negative: logical conjunction 'x == 0')
2015-07-21 22:26:22 +02:00
Daniel Marjamäki
f9d22f70db
Removed simplifyIfNot simplification ( #6072 )
2015-07-21 20:56:47 +02:00
Daniel Marjamäki
1b8252181d
Tokenizer: Removed Tokenizer::simplifyIfNotNull ( #6072 )
2015-07-21 17:58:44 +02:00
Daniel Marjamäki
ffc707246b
ValueFlow: Better handling of Known/Possible values after conditional unknown function call
2015-07-21 17:56:40 +02:00
PKEuS
7f6b6e43b1
Support strings in CheckStl::mismatchingContainers() ( #6839 )
2015-07-21 14:13:26 +02:00
PKEuS
a3eb725c3f
Support C++03-style of declaring a copy ctor as deleted ( #6585 )
2015-07-21 13:46:50 +02:00
amai2012
e8ac4d8e87
#6847 segmentation fault (invalid code) in Token::multiCompare. Fix and simple refactoring in Tokenizer
2015-07-21 13:40:50 +02:00
PKEuS
bdd53b4142
Fixed false positive #6717
2015-07-21 12:13:59 +02:00
PKEuS
dd9cb929bf
Refactorization in Preprocessor: Support beginning/end of file in removeSpaceNearNL(), avoid string copying when calling replaceIfDefined()
2015-07-21 12:13:58 +02:00
Daniel Marjamäki
8a72bb8aa8
AST: Fixed AST for struct initialisation
2015-07-21 11:40:42 +02:00
PKEuS
149d11d9ad
Improved handling of inline assembly ( #6813 ):
...
- Add ; after asm {} block if required
- Fixed inline suppressions
2015-07-20 23:09:54 +02:00
PKEuS
a0890ecd2c
Fixed false positive: Do not print useClosedFile on arrays ( #6823 )
2015-07-20 22:40:19 +02:00
PKEuS
c987a99ac8
Fixed hang on garbage code ( #6824 )
2015-07-20 22:33:32 +02:00
Daniel Marjamäki
749bb34deb
Fixed #6830 (ValueFlow: value of switch-variable inside switch)
2015-07-20 19:45:38 +02:00
Alexander Mai
defee734f5
#6846 segmentation fault (invalid code) in CheckClass::hasAssignSelf
2015-07-20 19:04:34 +02:00
Daniel Marjamäki
c0880c8d79
ValueFlow: Values that are assigned in switch are possible after switch
2015-07-20 09:36:56 +02:00
Frank Zingsheim
8416be4d9d
#6345 Tokenizer::simplifyTypedef() adds redundant 'typename' to declaration
2015-07-20 07:55:22 +02:00
amai2012
af9b67562b
Merge pull request #626 from simartin/ticket_6648
...
Ticket #6648 : Properly handle variables that have been deallocated and whose _address_ is taken after
2015-07-19 18:04:47 +02:00
Simon Martin
fa94f2e0f4
Ticket #6648 : Properly handle variables that have been deallocated and whose _address_ is taken after in CheckLeakAutoVar.
2015-07-19 17:37:50 +02:00
Alexander Mai
8b97f04de4
Try to address some Coverity issues. Add TODO testcase for #5783 . Introduce TODO_ASSERT macro.
2015-07-19 15:03:35 +02:00
orbitcowboy
f1f46611d6
Merge pull request #624 from simartin/ticket_6601_template_parameters
...
Added unit test involving function reference for TemplateSimplifier::templateParameters
2015-07-19 09:02:43 +02:00
Simon Martin
d218b95349
Ticket #5776 : Since the fix is in Tokenizer, it makes more sense to have a Tokenizer unit test.
2015-07-19 00:10:47 +02:00
Simon Martin
d1d51c5bb7
Added unit test involving function reference for TemplateSimplifier::templateParameters.
2015-07-18 23:56:55 +02:00
Daniel Marjamäki
ce7e879460
ValueFlow: isVariableChanged() should return true when variable is changed by passing its address to subfunction
2015-07-18 15:35:39 +02:00
Daniel Marjamäki
5aa0b284dc
ValueFlow: Evaluate more calculations when operands have known values
2015-07-18 15:03:57 +02:00
Simon Martin
1f73d71542
Ticket #5776 : Simplify (&a)->b into a.b
2015-07-17 23:27:35 +02:00
Simon Martin
af1b0cfddf
Ticket #6835 : Don't get confused by parentheses while detecting template parameter default values.
2015-07-17 21:30:34 +02:00
Daniel Marjamäki
25d9ebedd8
ValueFlow: fixed known/possible value of static variable
2015-07-17 20:48:37 +02:00
Daniel Marjamäki
f1e410a878
ValueFlow: value that is changed in do while loop must be possible instead of known.
2015-07-17 20:30:34 +02:00
Daniel Marjamäki
cb04dfbd37
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-17 15:30:23 +02:00
Daniel Marjamäki
61cf224f32
ValueFlow: Make known loop value possible
2015-07-17 10:24:24 +02:00
Daniel Marjamäki
3d5781743c
ValueFlow: Restore handling of not
2015-07-16 21:17:44 +02:00
Daniel Marjamäki
15a8e4d2df
Temporarily revert "Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))"
...
This reverts commit a3fbad50cb
.
The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00
Daniel Marjamäki
09efe140fe
ValueFlow: Change value to 'Possible' after conditional assignment in inner loop
2015-07-16 21:08:32 +02:00
Daniel Marjamäki
38214b6907
ValueFlow: function arguments only has 'possible' values
2015-07-16 20:49:14 +02:00
Daniel Marjamäki
a3fbad50cb
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-16 20:17:57 +02:00
Daniel Marjamäki
88491267d6
ValueFlow: Added Value::valueKind that says if value is known or possible
2015-07-16 17:33:16 +02:00
orbitcowboy
48fed95942
Fixed wrong test case in testother: mathfunctionCall_atan2().
2015-07-16 10:55:58 +02:00
orbitcowboy
1d910bc3bc
#6313 : Added test case for oppositeInnerCondition.
2015-07-16 08:44:38 +02:00
Alexander Mai
d45aa6170b
Minor refactoring in Tokenizer: Optimize for C code and use nullptr instead of 0
2015-07-16 00:29:48 +02:00
Simon Martin
2d8993319c
Ticket #6810 : Avoid infinite loop upon invalid typed enum declaration.
2015-07-15 21:39:15 +02:00
Daniel Marjamäki
b821e996e1
MathLib: Add TEST_MATHLIB_VALUE that is used to test MathLib::value
2015-07-15 17:36:41 +02:00
orbitcowboy
dda5e46d1d
Fixed typo in comment. No functional changes.
2015-07-15 15:29:35 +02:00
Alexander Mai
b604d63dd8
#6726 cppcheck hangs with 100% CPU load (invalidcode) inside Token::astOperand2(). #6840 egmentation fault (invalid code) in Token::astOperand2. Improve stability on invalid code
2015-07-15 15:19:48 +02:00
Alexander Mai
b30d9ffe98
#6838 cppcheck hangs on some strange input code. Token::astOperand1/2 throw internal error on garbage code instead of creating endless recursion in AST
2015-07-14 21:07:10 +02:00
Daniel Marjamäki
cf53074fd9
astyle formatting
2015-07-14 18:09:28 +02:00
Antti Tuppurainen
a75872a15e
Fix uniform init in out-of-class ctor-initer
2015-07-14 18:09:07 +02:00
Daniel Marjamäki
405a1fba11
ValueFlow: set values for false/true
2015-07-14 18:02:26 +02:00
Martin Ettl
027bdd3370
Reverted cebc105856
.
2015-07-13 21:31:24 +02:00
Daniel Marjamäki
1a872a2c9f
Fixed #6019 (false negative: Expression is always true/false '!(v!=10) && !(v!=20)')
2015-07-13 20:53:49 +02:00
orbitcowboy
08d6c244ee
Running astyle.
2015-07-13 16:50:48 +02:00
orbitcowboy
cebc105856
Changed test case from recent commit into a TODO test case. Since it is a FP.
2015-07-13 16:50:23 +02:00
orbitcowboy
d042151b62
Checkother:selfAssignment: Improved test coverage.
2015-07-13 16:39:21 +02:00
Daniel Marjamäki
7ccd30362c
Fixed #6826 (False positive: ValueFlow conditional value used in condition)
2015-07-12 19:35:47 +02:00
Daniel Marjamäki
b8e77c8005
valueflow: fix for ?:. the condition result is not a result of the ?.
2015-07-04 11:17:38 +02:00
Daniel Marjamäki
fef251ac76
negative array size: fixed noise when array is not vla
2015-07-04 09:42:42 +02:00
Daniel Marjamäki
7e1ddea653
One more fix for #6811 (ValueFlow: result of ?:)
2015-07-02 20:52:04 +02:00
Daniel Marjamäki
c751039612
Fixed #6811 (ValueFlow: result of ?:)
2015-07-02 20:11:27 +02:00
Daniel Marjamäki
14044bf60b
testrunner: revert changes to avoid compiler warnings
2015-07-01 19:15:27 +02:00
amai2012
4a1695c879
#6807 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #6808 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw InternalError on garbage code
2015-07-01 16:31:49 +02:00
Alexander Mai
6e03e7dca2
Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0
. Run astyle
2015-07-01 07:50:13 +02:00
amai2012
480a5672b0
#6298 stack overflow in Scope::findFunctionInBase (endless recursion). Fix handling of circular class hierarchy
2015-07-01 00:04:01 +02:00
amai2012
108b035af2
Adjust two checks which have different results on Windows/Visual Studio than on Linux: one succeeds already, another fails. Analysis/fix is under development. Temporary repair allows to detect further regressions.
2015-06-30 21:21:26 +02:00
amai2012
1604e751e5
Fix some compiler warnings which got introduced recently
2015-06-30 20:11:51 +02:00
amai2012
99dfd55d0c
#6804 segmentation fault (invalid code) in Token::getValueTokenDeadPointer. Fix null pointer access
...
TestGarbage: Increase coverage by running all code snippets as C as well as C++ code. (inspired by #6800 )
2015-06-30 19:40:22 +02:00
amai2012
c0b91662ba
#6803 segmentation fault (invalid code) in Token::findClosingBracket.
2015-06-30 12:16:55 +02:00
Alexander Mai
d7aa65c1fc
#6800 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix null pointer access for invalid C code
2015-06-29 19:56:02 +02:00
Alexander Mai
0b225fa02f
2nd attempt to fix crash in CheckUnusedFunctions::check. CheckBufferOverrun::checkBufferAllocatedWithStrlen: Don't check for 'new' in C code.
2015-06-28 18:34:09 +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
amai2012
4a47b8b3ae
Refactoring: Better distinguish between C and C++ in a few checks.
2015-06-28 16:49:16 +02:00
Alexander Mai
56e90f95d9
Corrections for non-Microsoft compilers
2015-06-28 12:34:08 +02:00
amai2012
649a89d308
Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
...
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
Alexander Mai
e75662aaf1
#6792 segmentation fault (invalid code) in TemplateSimplifier::templateParameters. Avoid null pointer access
2015-06-25 20:48:05 +02:00
amai2012
ac1f0301c0
#6791 segmentation fault (invalid code) in TokenList::createAst. Fix null pointer access
2015-06-25 08:57:09 +02:00
Alexander Mai
c047fae53b
#6790 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix null pointer access
2015-06-25 07:47:40 +02:00
Alexander Mai
56b826e3bf
#6732 , #6762 . Enable tests for garbage code. Related bug has been fixed before
2015-06-24 21:03:02 +02:00
Alexander Mai
8946fcd960
#6772 segmentation fault (invalid code) in Tokenizer::setVarId. Add another validate() call to Tokenizer::simplifyTokenList1. Small refactoring to Tokenizer: mark many methods as private.
2015-06-24 20:47:04 +02:00
Alexander Mai
6ba9c21fb9
#6786 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses. Small refactoring for Tokenizer::simplifyTokenList2() including additional calls to validate() - which prevents heap corruption on invalid code
2015-06-24 20:22:28 +02:00
amai2012
9fedc9bd74
#6788 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl. Fix null pointer access
2015-06-24 16:54:23 +02:00
Alexander Mai
f806d945a1
Refactoring: Allow TemplateSimplifier to throw InternalErrors by itself.
2015-06-23 20:53:57 +02:00
amai2012
69f91ac187
#6785 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Avoid null pointer access
2015-06-23 17:59:01 +02:00
Alexander Mai
07bcc7157b
#6784 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Avoid null pointer access
2015-06-22 20:43:26 +02:00
amai2012
99524b1f59
#6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther
2015-06-22 11:12:46 +02:00
Alexander Mai
b6858622eb
#6779 internal error: division overflow. Previous error handling (see #4520 ) was too restrictive.
2015-06-20 23:15:35 +02:00
Simon Martin
7481fbb028
Fixed #6506 (Properly detect calls to the deallocating free() function)
2015-06-20 21:00:54 +02:00
Daniel Marjamäki
1d49334398
Fixed #6662 (False positive assignIfError (assignment in while condition))
2015-06-20 16:23:16 +02:00
Alexander Mai
272cc55ab8
#5309 False positive: redundantCondition - comparing large integer values (unsigned long long). Testcase added, issue got fixed before.
2015-06-20 12:18:24 +02:00
Daniel Marjamäki
63f39ea48f
Change unusedScopedObject severity from error to style. The checker does not determine that there is ub or wrong behaviour.
2015-06-20 11:22:15 +02:00
Simon Martin
cba0583045
Ticket #6536 : Properly handle variables whose name is that of an allocation function.
2015-06-19 23:48:40 +02:00
Daniel Marjamäki
af4a4663e2
Fixed #6764 (False positive redundantCondition - !(i>1) is not i<1)
2015-06-19 19:49:05 +02:00
Daniel Marjamäki
02df692b0b
Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member))
2015-06-19 18:21:46 +02:00
Alexander Mai
712919a691
#6431 Invalid XML created - Invalid encoding of string literal. Partial fix: ensure the short message string is also processed to avoid problems with non-terminated string.
2015-06-18 21:16:25 +02:00
Alexander Mai
13c1c2c035
Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code.
2015-06-17 22:28:15 +02:00
Daniel Marjamäki
a884362817
Fixed #6752 (wrong AST when there is lambda function)
2015-06-17 19:32:44 +02:00
orbitcowboy
06e818f89d
Running astyle, no functional change.
2015-06-17 09:09:23 +02:00
amai2012
33d7631ee3
Fix another Borlad-specific test by setting Windows platform type
...
Refactoring: make CheckIO::ArgumentInfo aware of language (C vs. C++) to perform some optimizations
2015-06-16 23:11:34 +02:00
amai2012
a8db00b4bf
Repair test which had to be adjusted after previous changeset.
...
Refactoring: Add some const
2015-06-16 22:45:33 +02:00
amai2012
e32257db0a
Add new test file: testtokenlist.cpp to testrunner
2015-06-16 20:30:09 +02:00
Martin Ettl
9b14ab15eb
MathLib::intsuffix: Added support for LLU and LU suffixes.
2015-06-16 19:12:18 +02:00
Daniel Marjamäki
2cc23b4bb3
MathLib: Try to keep type suffix in constant calculations
2015-06-15 19:01:56 +02:00
Alexander Mai
a5a835b1e0
#6771 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase
2015-06-14 22:18:28 +02:00
Daniel Marjamäki
1e1ba6b4a9
Fixed #6574 (False positive oppositeInnerCondition - unknown variable)
2015-06-14 20:06:05 +02:00
Alexander Mai
70ba6c4340
#6767 False positive: memory leak when variable name is 'new'. Fix handling of new in C code. Move some tests for TokenList to new testtokenlist.cpp
2015-06-14 15:49:49 +02:00
Alexander Mai
fff3db48a7
Refactoring to address some issues from #5895 (handling of unsigned numbers). Also adding a TODO testcase since the real issue (FP) is still not fixed
2015-06-13 18:14:55 +02:00
Alexander Mai
a7b82b5c28
Refactoring to address some issues from #5895 (handling of unsigned numbers). Also adding a TODO testcase since the real issue (FP) is still not fixed
2015-06-13 18:08:13 +02:00
Dmitry-Me
cae605b1ec
New warning: warn about redundant code in condition.
2015-06-10 18:53:55 +02:00
Daniel Marjamäki
0ca410a4d7
Fixed #6668 (False positive bufferAccessOutOfBounds on sprintf() - regression)
2015-06-07 14:01:20 +02:00
Alexander Mai
c18461b173
#6761 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash.
2015-06-07 13:35:51 +02:00
Daniel Marjamäki
75b0430ba5
Token::strValue: fixed handling of backslash
2015-06-07 11:25:33 +02:00
Alexander Mai
b6264e4a00
#6759 segmentation fault (invalid code) in Tokenizer::simplifyTokenList2. #6760 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crashes
2015-06-06 13:11:32 +02:00
orbitcowboy
eed0c0df14
Merge pull request #610 from simartin/ticket_6665_test
...
Ticket #6665 (dupe of #6588 ): Added test case.
2015-06-06 03:28:51 +02:00
Simon Martin
0ebaa9b8c4
Ticket #6463 (dupe of #6680 ): Added test case.
2015-06-05 23:57:42 +02:00
Simon Martin
311db970c5
Ticket #6665 (dupe of #6588 ): Added test case.
2015-06-05 23:44:03 +02:00
Daniel Marjamäki
d208e763df
astyle formatting
2015-06-05 14:34:53 +02:00