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
Daniel Marjamäki
486a3192c0
Fixed #5246 (false positive: (warning) Logical conjunction always evaluates to false: t > 0 && t < 1.)
2014-02-04 06:50:29 +01:00
Lucas Manuel Rodriguez
ad0269eeeb
Refactor checks using Variable::isStlType()
2014-01-30 01:26:48 -03:00
Daniel Marjamäki
69109784e8
value flow: cleanup usage of valueflow. utility function Token::getValue was added.
2014-01-20 06:49:45 +01:00
Daniel Marjamäki
add84187cc
CheckOther: Removed old zero division check
2014-01-20 06:31:13 +01:00
Daniel Marjamäki
b2b5590f2b
Refactoring: Moved astStringify to the Token class and renamed it to expressionString. This can often be useful when reporting error messages that contains source code.
2014-01-17 18:37:49 +01:00
Daniel Marjamäki
3facc06cb7
CheckOther: Removed non-valueflow check for division by possible zero before condition
2014-01-17 17:42:54 +01:00
Daniel Marjamäki
ab866be03a
Tokenizer: Move 'else if' simplification to tokenize
2014-01-12 17:47:02 +01:00
Daniel Marjamäki
e3496080c8
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-12 07:40:56 +01:00
Daniel Marjamäki
ceca6be22b
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-11 15:15:01 +01:00
Daniel Marjamäki
39b47cc1e7
value flow: improved error message output for conditional division by zero
2014-01-06 10:51:17 +01:00
Daniel Marjamäki
0877adb542
astyle formatting
2014-01-05 21:12:32 +01:00
Daniel Marjamäki
afaf1473a8
Value flow: refactorings, write debug warning if iterating too far
2014-01-05 20:06:46 +01:00
Daniel Marjamäki
d8270c710a
Add new experimental value flow analysis
2014-01-04 20:57:02 +01:00
Daniel Marjamäki
372c29c24e
Fixed #5284 (duplicateExpression falsely reported by members of a union in some circumstances)
2014-01-02 16:58:07 +01:00
Daniel Marjamäki
4b72f01e99
clarify calculation: Fixed FP for 'a = (*p ? 1 : 2)'
2013-12-28 11:02:39 +01:00
Daniel Marjamäki
4c44e62159
AST: Refactored CheckOther::clarifyCalculation
2013-12-24 10:07:20 +01:00
Daniel Marjamäki
042d3afb80
CheckOther::checkDuplicateExpression: Readded warnings when there is a expression between the duplicate expressions 'X || Y || X'
2013-12-24 07:21:46 +01:00
Daniel Marjamäki
ac30a84c3a
Refactoring: Replaced CheckOther::checkCCTypeFunctions with configuration
2013-12-23 19:58:33 +01:00
Daniel Marjamäki
76b907fe65
Fixed #5252 (Improve check: use Library to validate function arguments in invalidFunctionUsage)
2013-12-23 10:06:45 +01:00
Daniel Marjamäki
fdcb6634df
Fixed #5190 (FP Use const reference to avoid data copying)
2013-12-14 08:46:18 +01:00
Daniel Marjamäki
08cd0cd0f7
CheckOther::checkDuplicateExpression: Added TODO comment to readd checking for duplicate separated expressions
2013-12-13 06:40:35 +01:00
Daniel Marjamäki
83066edec0
Code cleanup
2013-12-10 06:29:06 +01:00
Daniel Marjamäki
5ba02d2fdd
AST: Always use AST
2013-12-09 18:06:19 +01:00
Daniel Marjamäki
da540a3bb3
AST: Improved astIsFloat handling of expressions
2013-11-25 04:26:15 +01:00
Daniel Marjamäki
abdf2bb9d4
AST: fixed isSameExpressions handling of ({..})
2013-11-25 04:08:28 +01:00
Daniel Marjamäki
13cd0f41f6
AST: Fixed FP in isSameExpression when there are different casts
2013-11-24 15:17:08 +01:00
Daniel Marjamäki
e8eeb90adb
AST: Fixed 'same expression' false positives (git merge --squash s, <<, >>)
2013-11-20 16:18:09 +01:00
Daniel Marjamäki
27a40b10e1
AST/incorrectLogicOperator: Better handling of large doubles where x+1=>x
2013-11-20 06:33:34 +01:00
Daniel Marjamäki
4e003c392e
AST: code cleanup. Remove unreachable 'break' after 'return'
2013-11-18 23:24:58 +01:00
Daniel Marjamäki
45ee3b0fba
AST: Refactoring new checkIncorrectLogic checking
2013-11-18 23:09:14 +01:00
Daniel Marjamäki
033cb19656
Same expression: Don't write warnings for same expression on both sides of arithmetical operators
2013-11-17 17:21:39 +01:00
Daniel Marjamäki
5af2fe6e5b
AST: improved 'incorrect logic' checking when there are nested expressions
2013-11-15 06:51:35 +01:00
Daniel Marjamäki
d1721b9d1b
AST: Improved 'same expression on both sides of operator' checking for nested operators
2013-11-15 06:35:46 +01:00
Daniel Marjamäki
203d3e916b
Fixed #5173 (false positive Variable XX is reassigned a value before the old one has been used)
2013-11-14 16:10:00 +01:00
Daniel Marjamäki
1ecade2657
AST: don't warn about duplicate expressions around '+' operator. It might be more efficient than using for instance '*2'
2013-11-11 20:03:59 +01:00
Daniel Marjamäki
58d7caded1
AST: improved handling of casts
2013-11-11 16:39:34 +01:00
Daniel Marjamäki
4027848761
incorrectLogicOperator: fixed FP when comparing char values. improved handling of float comparisons.
2013-11-10 18:06:51 +01:00
Daniel Marjamäki
807f62520c
Fixed crash caused by endless recursion in redundant assignments check
2013-11-10 17:20:40 +01:00
Alexander Mai
687aeb4f5f
Fixed #5158 (segmentation fault (valid code))
2013-11-10 16:22:52 +01:00
Daniel Marjamäki
4ed4d71b3c
CheckOther::checkIncorrectLogicOperator(): cleanup
2013-11-10 14:24:09 +01:00
Daniel Marjamäki
cadb284a3d
Refactored the AST checking of CheckOther::checkIncorrectLogicOperator()
2013-11-10 11:59:18 +01:00
Martin Ettl
babbee4e73
Fixed typos in comments, no functional changes.
2013-11-09 16:07:28 +01:00
Daniel Marjamäki
b0ce42565e
AST: Added experimental new implementations for CheckAssignIf::comparison, CheckOther::checkIncorrectLogicOperator and CheckOther::checkDuplicateExpression
2013-11-07 14:38:08 +01:00
orbitcowboy
43103c84d8
Checkother:memsetZeroBytes: removed not needed '\n' from verbose message.
2013-11-07 05:15:36 -08:00
orbitcowboy
3d47ae9463
checkother:memsetZeroBytes: improved verbose message.
2013-11-06 06:42:27 -08:00
orbitcowboy
86aa2a27ab
checkother: improved constness of local variables, no functional change.
2013-11-06 06:15:32 -08:00
Daniel Marjamäki
fb04c8ff84
Fixed #5107 (redundantAssignment when pointer changes)
2013-11-04 23:46:07 +01:00
Daniel Marjamäki
06c5bd0daa
Fixed #5128 (False positive zerodivcond 'a ? 1 / a : 0')
2013-10-30 16:51:00 +01:00
Daniel Marjamäki
364757e1e1
Fixed #5089 ('inconclusive' output printed although --inconclusive not specified)
2013-10-23 06:42:52 +02:00
Daniel Marjamäki
d1b03d9c31
Fixed false positive for 'object is destroyed immediately' when there is no code after the object
2013-10-22 19:37:11 +02:00
Daniel Marjamäki
a55056c770
Fixed #5105 (false positive: (warning) Either the condition 'b!=0' is useless or there is division by zero)
2013-10-22 16:18:42 +02:00
Daniel Marjamäki
5d7e0aebf4
Fixed #5084 (False positive: (style) Same expression on both sides of '&&')
2013-10-19 18:04:53 +02:00
Daniel Marjamäki
6aa03efa2f
Fixed #5103 (Don't show 'The scope of the variable can be reduced' if there is no explicit block with { })
2013-10-19 17:27:02 +02:00
Daniel Marjamäki
9ce7efc6e4
commaSeparatedReturn: made checking experimental for now because there are false positives ( #5076 )
2013-10-08 18:05:07 +02:00
Daniel Marjamäki
4cd0108b93
Fixed #4976 (False positive: (style) A pointer can not be negative (git/sha1_file.c))
2013-10-06 16:52:27 +02:00
Daniel Marjamäki
6830d5f7a4
Fixed #5042 (false positive: Redundant code (set filled in initialization list))
2013-10-05 12:26:09 +02:00
Martin Ettl
ee9b7283ec
checkother:checkComparisonFunctionIsAlwaysTrueOrFalse: Removed redudant varid != 0 check. No functional changes.
2013-09-29 13:33:46 +02:00
Daniel Marjamäki
973bdcc6d8
Fixed #4929 (false positive: Division by zero (standard function div()))
2013-09-29 11:13:49 +02:00
Daniel Marjamäki
c05a80d314
zero division or useless condition: dont crash when variable declaration is not parsed correctly
2013-09-28 16:51:38 +02:00
Martin Ettl
5aaaff46ee
Fixed #5049 : new check: (warning) Comparison of two identical variables with isgreater(result,result) evaluates always to false.
2013-09-26 07:07:48 +02:00
Daniel Marjamäki
17c0bb3cab
revert 027e5cc8
. the div() standard function should not be reimplemented. create a different fix. Ticket: #4929
2013-09-23 18:01:15 +02:00
Daniel Marjamäki
d1c9cac155
Merge pull request #170 from simartin/clang_warnings_2
...
Remove warnings emitted by clang's -Wsign-conversion
2013-09-22 20:42:10 -07:00
Simon Martin
894f537eba
Remove warnings emitted by clang's -Wsign-conversion
2013-09-22 13:22:52 +02:00
Daniel Marjamäki
027e5cc860
Fixed #4929 (false positive: Division by zero (standard function div()))
2013-09-22 09:52:12 +02:00
Daniel Marjamäki
965d8f0ecc
Fixed #5033 (segmentation fault (valid code) in CheckOther::checkZeroDivisionOrUselessCondition)
2013-09-21 17:44:25 +02:00
Daniel Marjamki
3de9431507
Fixed #5022 (Improve check: Division by zero or useless condition, function call)
2013-09-15 17:46:52 +02:00
Ettl Martin
5a671f8914
Fixed #5023 (Add support for asinf,acosf,asinl,acosl (...) functions)
2013-09-13 19:49:25 +02:00
Daniel Marjamäki
0d246f84ca
checkZeroDivisionOrUselessCondition: Refactoring
2013-09-07 17:54:34 +02:00
Daniel Marjamäki
6bb6506ce2
checkZeroDivisionOrUselessCondition: Fixed false positive when function is called and variable is passed to it
2013-09-07 16:18:11 +02:00
Daniel Marjamäki
83c460fc56
Fixed #5017 (New check: division by zero, otherwise condition is redundant)
2013-09-07 07:40:10 +02:00
Daniel Marjamäki
5d7f30b88f
reassign var: better handling of struct members
2013-08-15 16:13:58 +02:00
PKEuS
a9a5dc0354
Updated to AStyle 2.03, require this version
2013-08-07 16:27:37 +02:00
PKEuS
dd82817752
Fixed #4943 and simplified CheckOther::checkCommaSeparatedReturn()
2013-08-06 11:27:09 -07:00
PKEuS
5e3ccda408
Added support for noreturn functions from library to CheckOther::checkUnreachableCode()
2013-08-06 02:11:59 -07:00
Daniel Marjamäki
d9a2f542be
CheckOther: removed redundant conditions. No need to check if varid is > 0 and if there is variable info.
2013-07-29 12:01:52 +02:00
Alexander Mai
40fa474a5b
Fixed #4927 (Segfault in CheckOther::checkCommaSeparatedReturn() on invalid code)
2013-07-28 10:39:58 +02:00
Carlo Marcelo Arenas Belon
aa0560fe3b
Fixed #4925 (False positive: checkother style)
...
When using a variable that is assigned a function pointer checks for
pointers are triggered which would complain if used in arithmetic
comparisions (eventhough it will be valid code if the function returns
an int)
2013-07-24 08:22:24 +02:00
Lucas Manuel Rodriguez
7e556c215e
Fixed #4861 (Improve check: object is destroyed immediately not detected when calling overloaded constructor)
2013-07-22 07:25:53 +02:00
Daniel Marjamäki
9c67af058a
SymbolDatabase: Renamed Variable::varId() to Variable::declarationId() to make it more clear how it works.
2013-07-20 12:31:04 +02:00
Roman Zaytsev Borisovich
e37587aed5
Ticket #4801
2013-07-02 15:28:44 +04:00
Daniel Marjamäki
2fb8133e90
Fixed #4862 (False positive: Comma is used in return statement (template))
2013-06-18 00:13:45 +02:00
Daniel Marjamäki
b31c218773
fixed typo, thanks XhmikosR for pointing it out
2013-06-15 19:31:17 +02:00
Abhishek Bharadwaj
d85c8e6782
Fixed #4104 (New check: comma separated statements in return statement from a function)
2013-06-15 17:49:10 +02:00
Zachary Blair
9c45e6d47d
Fixed #4173 : Elaborated on the verbose error message
2013-06-10 23:11:44 -07:00
PKEuS
4efccc2c5d
Fixed #4420 : Prefix increment is only suspicious, if its return value is not used.
2013-06-10 13:02:02 -07:00
Zachary Blair
28c0045f36
Fixed #4173 : New check: arithmetical usage of inf/nan result
2013-06-09 23:13:08 -07:00
Daniel Marjamäki
c795f6e2f7
CheckOther::checkSuspiciousEqualityComparison: check if --inconclusive has been used since the message is inconclusive
2013-05-20 16:05:21 +02:00
Frank Zingsheim
d387e8b770
Fixed #4711 : (false positive: Consecutive return...)
2013-05-11 17:50:59 +02:00
PKEuS
fb480ebb0a
Now really fixed #4604 .
2013-05-09 15:39:33 +02:00
PKEuS
881b47e79d
Revert "Improved handling of 0 initializations ( #4604 )"
...
This reverts commit 1201e417ec
.
2013-05-09 15:32:02 +02:00
PKEuS
0a104c40b7
Fixed "Improved handling of 0 initializations ( #4604 )"
...
This fixes commit 1201e417ec
.
2013-05-09 15:25:36 +02:00
PKEuS
982b9491d4
Improved handling of 0 initializations ( #4604 )
2013-05-09 06:23:25 -07:00
PKEuS
c42b89fb88
Revert "Improved handling of 0 initializations ( #4604 )"
...
This reverts commit 1201e417ec
.
2013-05-09 15:19:23 +02:00
PKEuS
1201e417ec
Improved handling of 0 initializations ( #4604 )
2013-05-09 06:17:10 -07:00
Lena Herscheid
e23038c4de
Fixed #4775 (Check for assert() with side effects)
2013-05-07 21:35:16 +02:00
Daniel Marjamäki
b2798e929d
Improved fix for #4455 , no false negatives if variable is used before first memset
2013-04-30 16:56:44 +02:00
Daniel Marjamäki
47ef8cf455
Fixed #4455 (redundantCopy when precleaning with memset)
2013-04-30 06:43:16 +02:00
Daniel Marjamäki
a5b044a6e2
Fixed #4754 (False positive: Map literals trigger redundant code warning)
2013-04-20 07:51:44 +02:00