Daniel Marjamäki
b67cf0a475
Improved handling of varid in complex scopes
2017-11-09 15:58:08 +01:00
Dmitry-Me
916acfc133
Reuse duplicated code for "x" and "u" scanf specifiers
2017-11-09 16:35:09 +03:00
Dmitry-Me
56ba48d705
Unify code handling "x" and "u" scanf specifiers
2017-11-09 16:25:56 +03:00
Dmitry-Me
94dd63f196
Fix FN for std::uintmax_t passed as %lx, %lu scanf read targets
2017-11-09 15:38:48 +03:00
Dmitry-Me
b301b44897
Fix FN for unsigned ptrdiff_t passed as %lu into scanf
2017-11-09 14:43:09 +03:00
Dmitry-Me
78be821431
Fix FN for std::uintmax_t passed as %llx, %llu scanf read targets
2017-11-09 11:28:07 +03:00
Daniel Marjamäki
cc08d51505
Fix Cppcheck warning (use prefix increment for iterator)
2017-11-09 08:40:13 +01:00
Daniel Marjamäki
26b9e1528c
Fixed #7000 (Invalid varid - matching class with same name from other namespace)
2017-11-08 22:52:27 +01:00
Dmitry-Me
74c778c5f0
Fix FN when unsigned ptrdiff_t is passed as %llu into scanf
2017-11-09 00:26:07 +03:00
Dmitry-Me
703d86992d
Fix FN when size_t, uintmax_t are passed as %Lx into scanf
2017-11-08 23:52:49 +03:00
Dmitry-Me
89b83b2d16
Fix FN for unsigned ptrdiff_t passed as %Ix into scanf
2017-11-08 15:06:51 +03:00
Dmitry-Me
970aee9ce1
Fix FN for ptrdiff_t passed as %zd into scanf
2017-11-08 14:22:03 +03:00
Dmitry-Me
aff993115f
Remove duplicate check
2017-11-08 00:53:18 +03:00
Dmitry-Me
4c186d2455
Remove dead code - %llf specifier doesn't exist
2017-11-07 22:57:44 +03:00
Dmitry-Me
06fd390b3f
Remove duplicate checks
2017-11-07 22:14:29 +03:00
Daniel Marjamäki
4a9984d73b
Fixed #8233 (FP uninitvar found in bash:lib/readline/display.c)
2017-11-06 10:28:07 +01:00
Daniel Marjamäki
8b384f8ee5
Fixed #4988 (Tokenizer::setVarId: Wrong varid for inline function parameter)
2017-11-05 22:25:46 +01:00
Daniel Marjamäki
324257ef52
Fixed #7823 (No varid for member variable of type std::bitset< static_cast<int>(2) >)
2017-11-05 17:59:34 +01:00
Daniel Marjamäki
511d14a051
astyle
...
[ci skip]
2017-11-05 17:56:24 +01:00
Daniel Marjamäki
4d8f069907
Renamed pro c sql to embedded sql
2017-11-03 21:04:12 +01:00
Ayaz Salikhov
19af9bc216
Fix UB when converting float to int ( #984 )
2017-11-03 14:05:23 +01:00
Daniel Marjamäki
4f6f1e20dd
Hide Pro*C SQL simplification. Use pro_c_sql.cfg library file if this is wanted.
2017-11-03 13:02:29 +01:00
Daniel Marjamäki
9b2936a66f
Code refactoring
2017-11-03 11:41:32 +01:00
Alexey Eryomenko
02461753f3
Fix for embedded PL/SQL blocks (Oracle Pro*C) ( #985 )
...
* fix for correct parsing of embedded PL/SQL blocks (Oracle Pro*C)
* enforce SQL block end at the end of nearest outer C block, when
appropriate terminator is not found
* added check for ; at the end of END-EXEC and made SQL block detection
more readable
2017-11-03 11:31:33 +01:00
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
Dmitry-Me
fe5dd55723
Wrong reporting function was being called
2017-10-27 22:21:18 +03:00
Dmitry-Me
f653b36b87
Fix actual type reported for unsigned ptrdiff_t passed into scanf
2017-10-26 23:47:11 +03:00
Dmitry-Me
65b2755098
Extract common check and run it first
2017-10-26 23:42:38 +03:00
Björge Dijkstra
94031ef11d
Fix for conditional memory allocation inside if-condition ( #986 )
...
* Add test cases for allocation inside if-condition
* Fix missed memory leak and false positive double free for allocation inside if-condition
2017-10-26 19:11:00 +02:00
Dmitry-Me
a38854451f
Warn for signed values passed as scanf targets with "x" conversion
2017-10-25 21:22:17 +03:00
Dmitry-Me
eaa12db761
scanf with %zd expects ssize_t, not ptrdiff_t
2017-10-24 22:01:23 +03:00
Dmitry-Me
eb6bf1bcae
Cache and reuse value
2017-10-23 00:42:56 +03:00
Dmitry-Me
1de8f771e9
Cache and reuse value
2017-10-23 00:41:29 +03:00
Dmitry-Me
46f726c049
Cache and reuse value
2017-10-23 00:36:05 +03: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
002f6679d5
Fix syntax error
2017-10-21 22:17:07 +02:00
Daniel Marjamäki
c4c76aa1ad
Use MathLib::bigint_bits
2017-10-21 22:08:34 +02:00
Daniel Marjamäki
4cb3548e2b
unsafeClassDivZero: change severity to style
2017-10-21 21:51:58 +02:00
Daniel Marjamäki
5de3c43209
changed id for new checker to unsafeClassDivZero
2017-10-21 21:45:04 +02:00
Ayaz Salikhov
64e61d28ba
Add an ability to use address sanitizer ( #979 )
2017-10-21 21:04:14 +02:00
Daniel Marjamäki
15d814e609
classPublicInterfaceDivZero: Try to make the error message a bit better. Added variable name and what the bad input value is.
2017-10-21 13:00:52 +02:00
Daniel Marjamäki
7a67bced71
classPublicInterfaceDivZero: extend bailout
2017-10-21 12:40:20 +02:00
Daniel Marjamäki
299835da2f
classPublicInterfaceDivZero: don't warn in overloaded operators. It is normal behaviour that these are not protected.
2017-10-21 08:56:23 +02:00
Daniel Marjamäki
05e1e5e0a0
astyle formatting
...
[ci skip]
2017-10-20 22:11:12 +02:00
Daniel Marjamäki
8a7411abdb
CheckClass: Fix wrong 'public interface' warnings
2017-10-20 22:10:55 +02:00
Daniel Marjamäki
819862ddcb
Fix compiler errors
2017-10-20 17:38:15 +02:00
Daniel Marjamäki
1d5e3e4f0c
Fixed #8247 (False positive knownConditionTrueFalse)
2017-10-20 17:31:58 +02:00
Daniel Marjamäki
86c84029e3
New check: Check public interface of classes ( #8248 )
2017-10-20 02:02:51 +02:00
Daniel Marjamäki
afbfc914bc
astyle formatting
...
[ci skip]
2017-10-20 01:53:20 +02:00
Dmitry-Me
5040491ee6
Size computation code not required outside this translation unit
2017-10-19 19:01:41 +03:00
Dmitry-Me
606e28a3c5
Extract and reuse size computation
2017-10-19 00:25:21 +03:00
Dmitry-Me
34a8d2431f
Extract and reuse size computation
2017-10-19 00:20:04 +03:00
Dmitry-Me
8709490903
Clarify expressions with parentheses
2017-10-18 23:40:43 +03:00
Dmitry-Me
e356ccca22
Revert "Clarify expression with parentheses"
...
This reverts commit bbf0a81c2d
.
2017-10-18 23:31:44 +03:00
Dmitry-Me
bbf0a81c2d
Clarify expression with parentheses
2017-10-18 23:24:31 +03:00
Sign Bit
aaafa72bc8
Use a 'negative cache' for tokens / enumerator checks ( #980 )
...
Checking whether a token is an enumerator in all the available scopes
is expensive. Once we determined that a token is not an enumerator,
skip all the expensive checks.
2017-10-18 18:01:36 +02:00
Dmitry-Me
151ace2581
Use Platform for char limits computation ( #972 )
2017-10-18 17:30:47 +02:00
Daniel Marjamäki
ad1749738e
Fixed #6153 (ValueFlowBeforeCondition: Handle global variables)
2017-10-17 16:55:37 +02:00
orbitcowboy
f1e5f64690
wxwidgets.cfg: Added support for wxMenu:Append().
2017-10-17 10:59:23 +02:00
Florin Iucha
6e737082da
Store the defined types in a map, for faster lookup
2017-10-17 09:00:14 +02:00
Florin Iucha
cccf035535
Memoize token nature computation
2017-10-17 09:00:14 +02:00
Daniel Marjamäki
4700b75ded
Clarify error message 'condition is always true/false'
2017-10-16 22:05:00 +02:00
Daniel Marjamäki
6d59290858
Fixed #10 (ValueFlow: condition variable has known value in switch case)
2017-10-16 21:51:30 +02:00
Daniel Marjamäki
0425f1d46d
Fixed #8241 (FP: Same expression on both sides of operator)
2017-10-16 17:39:50 +02:00
IOBYTE
352fd7a381
SymbolDatabase: Add support for functions in unions. ( #973 )
2017-10-15 11:49:36 +02:00
Dmitry-Me
e4de220a2d
Only check pointer that can be null at that point
2017-10-14 19:09:42 +03:00
Dmitry-Me
288ee96cc7
Avoid recomputing loop range end
2017-10-14 18:57:27 +03:00
orbitcowboy
db787369b9
#8243 : Changed order of includes. Moved mathlib include at first place.
2017-10-14 16:30:10 +02:00
Daniel Marjamäki
1656ecd73b
Revert changes I committed by mistake
2017-10-11 17:15:28 +02:00
Daniel Marjamäki
cc82288ff6
Travis: Suppress false positive
2017-10-11 17:14:02 +02:00
Dmitry-Me
2d1c47b474
Omit repeated map access
2017-10-11 17:36:43 +03:00
amai2012
e4cdb51f7f
#8240 Fix test error due to path handling
2017-10-11 08:45:29 +02:00
Daniel Marjamäki
fbccb3ae55
Add errorpath for accessMoved message
2017-10-10 15:49:15 +02:00
Daniel Marjamäki
abc3779e61
Tweaked the --check-library output so configured methods will not be shown
2017-10-10 10:18:03 +02:00
Daniel Marjamäki
d3c9d06aa4
astyle formatting
...
[ci skip]
2017-10-08 14:16:45 +02:00
Daniel Marjamäki
9d27917fea
c++98 compatibility
2017-10-08 14:16:18 +02:00
Dmitry-Me
9c0e6986da
Passing string literals into printf as %p is fine
2017-10-08 11:14:10 +03:00
Ayaz Salikhov
be2c65eb58
Simplify int vs bool
2017-10-08 07:54:39 +02:00
PKEuS
a29b33b833
Set version to 1.81.99/1.82 dev
2017-10-07 23:22:31 +02:00
Daniel Marjamäki
cebf34e718
1.81: Set versions
2017-10-07 12:55:36 +02:00
Daniel Marjamäki
b1c730405f
Code cleanup
2017-10-06 22:45:37 +02:00
Daniel Marjamäki
a1053dd7dd
--check-library: Report unconfigured scoped functions also
2017-10-06 11:27:01 +02:00
Daniel Marjamäki
2a6fbe2e3c
astyle formatting
...
[ci skip]
2017-10-05 23:01:42 +02:00
hexcoder
051a18b120
pull request for ticket 8180 (better diagnostic output for bailouts) ( #964 )
...
* sync build instructions from readme.txt
* refactored the patch from ticket 8180. Moved logic from macros to the bailoutInternal function
* adapt to new bailout message format
* adapt to new bailout message format
* adapt to new bailout message format
* compile fix for Microsoft platform
* remove directory part from file locations in bailout message (normalize)
* remove directory part from valueflow message filter
* adapt tests to file format without directory part
* adapt tests to file format without directory part
* new line number agnostic assert_equals methods
* new line number agnostic assert_equals methods
* adapt to new method assertEqualsWithoutLineNumbers()
* adapt to new method assertEqualsWithoutLineNumbers()
* Bugfix: do not replace line number with spaces, remove it
* review changes: const char * -> std::string, size_t -> int, std::to_string() -> MathLib::toString()
* set #line at the beginning to guard against insertions from match compiler
* Bugfix: counting lines can be difficult :-) #line 1 -> #line 2
* added method stripDirectoryPart()
* added method stripDirectoryPart()
* used new method Path::stripDirectoryPart()
* new dependency path.h in lib/valueFlow.cpp
* code cleanup, removing redundant temporary objects and casts
2017-10-05 23:03:13 +02:00
Daniel Marjamäki
13c0b4131b
--check-library: improved function name output
2017-10-05 21:50:24 +02:00
Alexey Eryomenko
22483baf72
missed simplification in parsing of std function declaration resulted in ( #967 )
...
wrong type detection
2017-10-03 22:10:13 +02:00
Oleksandr Redko
2bee664ec9
Return non-const object to enable move compiler optimization ( #966 )
2017-10-03 18:24:18 +02:00
Dmitry-Me
4601e40615
Simplify code for finding string format token
2017-10-02 18:03:55 +03:00
orbitcowboy
d9ef5c5a85
Improved const correctness of local variables.
2017-10-01 14:24:37 +02:00
Daniel Marjamäki
406ddc5c10
cleanup dead code, spotted by dmitry-me!
2017-09-30 23:05:42 +02:00
Daniel Marjamäki
9ce23203cc
Fix includes
2017-09-30 12:45:25 +02:00
Daniel Marjamäki
885f8452e4
reuse case insensitive string comparison function
2017-09-30 11:25:46 +02:00
Dmitry-Me
9fdfada4b5
Compute value earlier and reuse it
2017-09-28 23:41:29 +03:00
Dmitry-Me
7308901add
Omit duplicate and opposite checks
2017-09-28 17:59:55 +03:00
Dmitry-Me
d18e8466a9
Cache and reuse values
2017-09-27 00:51:04 +03:00
Daniel Marjamäki
04c2be33a6
Unit testing visual studio import
2017-09-24 22:57:24 +02:00
Daniel Marjamäki
30e6a05aa0
ImportProject: Macro names in visual studio solutions/projects are case insensitive
2017-09-24 22:36:20 +02:00
Daniel Marjamäki
9f306cf3aa
Added C++14 option
2017-09-22 22:00:00 +02:00
Daniel Marjamäki
5993c40d5b
Improve 'opposite inner condition' check
2017-09-22 14:01:20 +02:00
Daniel Marjamäki
5e618418d5
Refactoring, use early continue in loop
2017-09-21 22:53:15 +02:00
Daniel Marjamäki
411c5e5f7e
Fixed #8190 (False positive constStatement - return (struct media_frames_per_second) {0};)
2017-09-21 22:50:46 +02:00
Daniel Marjamäki
89b9f57759
Fix corrupt Token::Match pattern
2017-09-21 15:01:34 +02:00
Daniel Marjamäki
71d207c034
Fixed #8226 (Tokenizer: Wrong handling of string literal u"abc")
2017-09-21 13:33:14 +02:00
Daniel Marjamäki
aa38556e1c
SymbolDatabase: Simplification of code. My assumption is that start and end of scope is never null.
2017-09-20 23:06:19 +02:00
Daniel Marjamäki
ba8222de1c
ValueFlow: Put 'inconclusive' state in the ValueKind. A value can't be both known and inconclusive.
2017-09-20 22:41:36 +02:00
Daniel Marjamäki
e61222126f
Fixed #8176 (ValueFlow: variable might be changed if it's passed by reference to method)
2017-09-20 22:09:09 +02:00
Daniel Marjamäki
5f4b06c0f4
isVariableChangedByFunctionCall: Fix FN when constructor argument is const reference
2017-09-20 14:03:56 +02:00
Daniel Marjamäki
3e231a9325
Refactoring: Reuse function numberOfArguments() for counting arguments
2017-09-20 13:28:45 +02:00
Daniel Marjamäki
2103726d54
Stop counting arguments properly
2017-09-20 13:00:43 +02:00
Daniel Marjamäki
4318521fc1
Fixed #8187 (isVariableChangedByFunctionCall: Constructor reference argument)
2017-09-20 12:53:25 +02:00
Daniel Marjamäki
87c35cd60e
ValueFlowForward: Refactoring handling of compound assignments
2017-09-20 11:45:28 +02:00
Daniel Marjamäki
3d587d2704
Revert "Fix CID 1368511"
...
This reverts commit 41a79152a9
.
2017-09-19 23:13:40 +02:00
Daniel Marjamäki
1a057bc23a
Revert "Remove redundant safety logic (CID 1368511)"
...
This reverts commit d892031f28
.
2017-09-19 23:13:31 +02:00
Daniel Marjamäki
d892031f28
Remove redundant safety logic (CID 1368511)
2017-09-19 23:07:02 +02:00
Dmitry-Me
41a79152a9
Fix CID 1368511
2017-09-19 22:35:00 +03:00
Dmitry-Me
05d58f5c51
Unify classEnd check for scope
2017-09-19 22:13:50 +03:00
Daniel Marjamäki
840c7eb258
checkFloatToIntegerOverflow: check all calculations, not only in function bodies
2017-09-19 19:30:24 +02:00
Daniel Marjamäki
9268c2034a
checkSignConversion: check all calculations, not only in function bodies
2017-09-19 19:25:33 +02:00
Daniel Marjamäki
f6e30eee19
checkIntegerOverflow: handle long and long long also
2017-09-19 19:14:29 +02:00
Daniel Marjamäki
cac7146cac
checkIntegerOverflow: check all calculations, not only in function bodies
2017-09-19 14:43:48 +02:00
Daniel Marjamäki
6bc0df2908
checkTooBigBitwiseShift: Separate id for signed shift overflow
2017-09-19 09:21:20 +02:00
Daniel Marjamäki
be0ad20a04
checkTooBigBitwiseShift: bitshift overflow when lhs is signed
2017-09-19 09:08:44 +02:00
Daniel Marjamäki
0cf551351b
tooBigBitwiseShift: check all calculations, not only in function bodies
2017-09-19 08:50:19 +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
2e6d78bd08
Fixed #8184 (Syntax error: case outside switch)
2017-09-15 22:37:31 +02:00
Daniel Marjamäki
1dbcba4dd6
Fixed #8221 (ValueFlow: value for static variable that is not written)
2017-09-15 15:58:19 +02:00
Daniel Marjamäki
d79762cfc3
Fixed #7449 (reademptycontainer (inconclusive) when variable changed in function )
2017-09-15 10:49:58 +02:00
Dmitry-Me
349a28705a
Clarify code with assertions
2017-09-15 01:11:27 +03:00
Dmitry-Me
0fe82335ac
Remove duplicated method call
2017-09-15 00:53:44 +03:00
Dmitry-Me
f28524fefa
Unify variable names
2017-09-15 00:44:59 +03:00
Daniel Marjamäki
ef1f3fbee6
Fixed #8173 (ValueFlow: use AST when setting values in assignment RHS ((n=42) && n=='A'))
2017-09-14 22:49:47 +02: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
5c7cf584ef
bump simplecpp
2017-09-12 22:42:10 +02:00
Dmitry-Me
37dea8a5cf
Only check the value if it wasn't surely set by previous code
2017-09-12 23:20:07 +03:00
Dmitry-Me
a4c20b3606
Break loop early
2017-09-12 07:48:06 +03:00
Dmitry-Me
4126fab1d5
Simplify code with temporary
2017-09-12 07:46:38 +03:00
Dmitry-Me
caebf137bc
Cache and reuse value
2017-09-12 00:21:36 +03:00
Dmitry-Me
9ff04b4df1
Resolve CID 1368512
...
Wrong pointer was being checked
2017-09-11 23:50:42 +03:00
Dmitry-Me
988de6422e
Omit repeated computations
2017-09-11 18:36:44 +03:00
Daniel Marjamäki
56544ac936
Fixed #8211 (Crash on incomplete code in isVariableChanged ())
2017-09-11 13:45: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
b9b47809f9
Fixed #8197 (iscast: '(b)&1' is not a cast)
2017-09-08 22:52:16 +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