Oleksandr Redko
a8700f5622
Remove redundant parts of conditional expressions ( #988 )
...
All issues were found with PVS-Studio:
V560 A part of conditional expression is always true: tok. astutils.cpp 407
V560 A part of conditional expression is always true: size > 0. checkbufferoverrun.cpp 709
V547 Expression 'secondTrue' is always true. checkcondition.cpp 1013
V547 Expression 'firstTrue' is always true. checkcondition.cpp 1020
V560 A part of conditional expression is always true: !scan. checkio.cpp 1036
V560 A part of conditional expression is always true: scope->function. checknullpointer.cpp 395
V560 A part of conditional expression is always true: tok2. checkstl.cpp 268
V560 A part of conditional expression is always true: par. tokenize.cpp 9440
V547 Expression '!erased' is always true. symboldatabase.cpp 3990
2017-11-03 10:39:57 +01:00
Daniel Marjamäki
539258f7a3
Fix FP for pointer addition checker
2017-10-22 23:13:12 +02:00
Daniel Marjamäki
28cfee2d4f
Fixed #8250 (New check: Pointer calculation result cant be NULL unless there is overflow)
2017-10-22 14:32:54 +02:00
Daniel Marjamäki
4700b75ded
Clarify error message 'condition is always true/false'
2017-10-16 22:05:00 +02:00
Dmitry-Me
696c5b8100
Reduce duplication, omit building unneeded string
2017-09-18 03:06:35 +03:00
Dmitry-Me
7d6ef71c4d
More selective match pattern
2017-09-18 02:45:02 +03:00
Daniel Marjamäki
927b14b60f
Fixed #8217 (Crash in isVariableChanged())
2017-09-14 15:45:15 +02:00
Daniel Marjamäki
bb20c0504e
CheckCondition: Fix FP in daca (iqtree) 'in >> ch'
2017-09-13 22:46:36 +02:00
Daniel Marjamäki
db321c2617
CheckCondition: Fix FP when there is increment/decrement in condition (daca icu)
2017-09-10 22:58:05 +02:00
Daniel Marjamäki
c34fdd1905
CheckCondition: Fix FP for undeclared variables (daca)
2017-09-10 22:30:41 +02:00
Daniel Marjamäki
b81b4fcb78
Fixed #8208 (CheckCondition: Use Library to determine if function is const)
2017-09-08 18:08:32 +02:00
Daniel Marjamäki
899ad8479d
CheckCondition: Fixed FP when condition contains global static variable
2017-09-08 15:44:56 +02:00
Daniel Marjamäki
d9adb5432a
astyle formatting
...
[ci skip]
2017-09-08 15:41:14 +02:00
Nekto89
9cbfa0e383
Fix #7803 : false negative: condition is always true 'if (flags & A)' ( #938 )
2017-09-08 14:30:42 +02:00
Daniel Marjamäki
58db814d72
Rephraze /Same/Identical/
2017-09-08 12:41:33 +02:00
Daniel Marjamäki
120d0f86d0
CheckCondition: Fix FP about same condition when switch case is used (daca)
2017-09-07 22:05:01 +02:00
Daniel Marjamäki
4c30a5af25
CheckCondition: Break out code to check if function call is non-const
2017-09-06 22:51:21 +02:00
Daniel Marjamäki
e0c7f7f8f2
CheckCondition: Fix FP when there are method calls in condition
2017-09-06 22:26:00 +02:00
Daniel Marjamäki
35736364f8
Fixed #8199 (false negative: (warning) Same condition '...', second condition is always false)
2017-09-05 22:45:28 +02:00
Daniel Marjamäki
e5e6f37e41
Fixed #7405 (false positive: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.)
2017-09-05 22:03:29 +02:00
Daniel Marjamäki
c1000998f0
CheckCondition: Fix FP found in daca results (ace)
2017-09-05 09:33:35 +02:00
Daniel Marjamäki
d02d235e5e
Refactoring oppositeInnerCondition checking
2017-09-04 22:54:06 +02:00
Daniel Marjamäki
d82805b7fe
CheckCondition: Improved checking for same conditions
2017-09-04 22:40:34 +02:00
Daniel Marjamäki
abae5e0156
Fixed #8198 (false positive: (warning) Same condition, second condition is always false)
2017-09-04 22:25:20 +02:00
Daniel Marjamäki
d838dc2129
CheckCondition::multiCondition2: Fix FN for pointers
2017-09-04 15:58:22 +02:00
orbitcowboy
095e435031
wxwidgets.cfg: Added support for some wxTextFile functions.
2017-09-04 14:52:10 +02:00
Daniel Marjamäki
9465dca583
CheckCondition: Fix FPs for aliased variables (daca)
2017-09-04 09:34:03 +02:00
Daniel Marjamäki
ef4a7ba7f2
Fix FP in CheckCondition::multiCondition2
2017-09-03 14:46:37 +02:00
Daniel Marjamäki
e5c6379d01
CheckCondition: Fix FP in Cppcheck
2017-09-03 11:35:37 +02:00
Daniel Marjamäki
b9849d9e4e
CheckCondition::multiCondition2: Handle loops better
2017-09-03 11:03:01 +02:00
Daniel Marjamäki
01e65d3e00
Improved CheckCondition::multiCondition2 so deeper bugs are found
2017-09-03 10:44:22 +02:00
Daniel Marjamäki
f2ec5f24ce
Fixed #5845 (new check: same condition after noreturn conditional code => second condition is always false)
2017-09-03 10:34:34 +02:00
Daniel Marjamäki
0b751dcc1b
Opposite conditions: Better matching when outer condition uses &&
2017-09-01 23:24:15 +02:00
Daniel Marjamäki
3b4f60fd21
Updated error message
2017-09-01 13:33:47 +02:00
Daniel Marjamäki
dce942197c
Fixed #8186 (Inner condition always false inside for loop)
2017-08-31 16:00:12 +02:00
Dmitry-Me
cf6d3ba398
Omit unneeded computations
2017-08-28 18:10:49 +03:00
Ayaz Salikhov
b8cd7dbb5c
Use nullptr instead of 0 or NULL ( #936 )
2017-08-09 20:00:26 +02:00
Daniel Marjamäki
814d2ae2a4
Fixed #7028 (False positive: opposite conditions (const method modifies variable))
2017-07-10 23:12:45 +02:00
Daniel Marjamäki
32fe0aba41
Fixed #8037 (ValueFlow: global variable might be modified by function call)
2017-07-09 12:50:17 +02:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
Daniel Marjamäki
55cd69e290
alwaysTrueFalse: Dont warn when checking sizeof for some type. such condition might be platform dependent.
2017-05-13 19:07:24 +02:00
PKEuS
b1f4bd7504
Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set ( #7995 )
2017-04-11 11:49:26 +02:00
PKEuS
3c8f5b85ae
Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10%
2017-03-27 18:48:34 +02:00
PKEuS
9225bff31d
Added (back) support for enums to CheckCondition::checkIncorrectLogicOperator() ( #7794 )
2017-03-23 18:57:48 +01:00
PKEuS
ca3e3b3cdb
Fixed false positive multiCondition when & is used in both conditions ( #7827 )
2017-03-15 19:37:14 +01:00
Daniel Marjamäki
263c3596d5
known conditions: dont warn about 0 or 1 conditions as those look intentional
2017-03-08 18:39:19 +01:00
Daniel Marjamäki
ecc59859e1
Don't simplify _Bool in TokenList
2017-03-04 11:13:28 +01:00
Daniel Marjamäki
1c6c209353
Fixed #7890 (1.77 false positive from knownConditionTrueFalse with function-like macros)
2017-03-03 19:53:16 +01:00
Daniel Marjamäki
16c06e5714
Fixed #7588 (Opposite conditions in nested 'if' blocks lead to a dead code block.)
2017-02-28 18:46:28 +01:00
Matthias Krüger
6f1e7e897d
simplify if(tok && Token::{simple,}Match) to if(Token::{simple,}Match).
2017-02-06 15:37:12 +01:00