Daniel Marjamäki
fa42a08a71
Make code less strict that looks for garbage template code. Before a template there might be unknown macros.
2017-12-31 16:25:41 +01:00
Daniel Marjamäki
7d2450e445
Fixed #1478 (false negative: buffer access out of bounds not detected after free and malloc)
2017-12-31 14:58:26 +01:00
Daniel Marjamäki
79f6793076
minor code cleanup
2017-12-31 12:30:02 +01:00
Daniel Marjamäki
1cbeec26c6
Replace Token::Match with Token::simpleMatch
2017-12-30 22:43:44 +01:00
Daniel Marjamäki
f6fcf01cc6
Fixed #7868 (TemplateSimplifier: template specialization fails)
2017-12-30 22:14:48 +01:00
Daniel Marjamäki
03a4c84fec
Rename variables
2017-12-30 12:27:55 +01:00
Daniel Marjamäki
a8f73055ad
Templates: Fixed scope problem
2017-12-30 09:00:19 +01:00
Daniel Marjamäki
005bb7c747
Replace Token::Match with Token::simpleMatch
2017-12-29 23:05:54 +01:00
Daniel Marjamäki
fc1ac180e6
Fixed #6218 (Template type aliasing misdetection)
2017-12-29 22:47:07 +01:00
Daniel Marjamäki
caf9f22015
Rename method TemplateParametersInDeclaration => getTemplateParametersInDeclaration
2017-12-28 22:10:10 +01:00
Daniel Marjamäki
42bcb6d417
use early continue
2017-12-27 22:29:45 +01:00
Daniel Marjamäki
469cb7e6df
TemplateSimplifier: Fix instantiations when template parameter is a template
2017-12-26 22:34:39 +01:00
Daniel Marjamäki
4a7f923fca
astyle formatting
...
[ci skip]
2017-12-26 22:12:30 +01:00
Daniel Marjamäki
84bdabacf8
TemplateSimplifier: Remove not needed variable indentlevel
2017-12-26 13:27:02 +01:00
baltth
6cbd69bf2d
Fix define parsing from compile_command.json ( #1013 )
...
* Define value parsing from compile_commands.json
* Handle escaping in defined values
* Added test for importCompileCommands
* Added used defines for imported projects
* Fixed unnecessary string literals
2017-12-26 13:04:27 +01:00
Daniel Marjamäki
2c69f2b226
TemplateSimplifier: Improved handling of scopes
2017-12-26 10:55:18 +01:00
Dmitry-Me
5a642ac35e
Omit unneeded computations
2017-12-26 02:07:24 +03:00
Daniel Marjamäki
eaadfb3910
update debug token list output for templates.
2017-12-25 23:16:51 +01:00
Daniel Marjamäki
a80760cb6f
TemplateSimplifier: Fix in expandTemplate
2017-12-25 08:19:46 +01:00
Daniel Marjamäki
1eb2df34ad
Revert improved scope handling in TemplateSimplifier
2017-12-23 22:11:30 +01:00
Daniel Marjamäki
d237d36d46
TemplateSimplifier: Fix crash seen in Travis
2017-12-23 17:29:28 +01:00
Daniel Marjamäki
2d7fedbb49
Try to fix Travis
2017-12-23 15:41:32 +01:00
Daniel Marjamäki
91839c2534
Fixed #7987 (FP copyCtorAndEqOperator - class with a move constructor and move assignment operator)
2017-12-23 10:35:14 +01:00
Daniel Marjamäki
5ed2dbd5ef
Fix Cppcheck warning
2017-12-23 10:16:17 +01:00
Daniel Marjamäki
326765c632
TemplateSimplifier: Better handling of scopes
2017-12-23 08:20:24 +01:00
Dmitry-Me
8851fd64a6
Break loop early
2017-12-21 03:13:00 +03:00
Dmitry-Me
82825ab721
Reorder checks, remove duplicate check
2017-12-20 13:16:59 +03:00
Dmitry-Me
f4ddf43cba
Break loop early, simplify check
2017-12-20 03:55:43 +03:00
Dmitry-Me
6ae32ed98c
Unify check with surrounding code
2017-12-20 01:37:19 +03:00
Daniel Marjamäki
9c17bddbd4
Tweak fix for ticket #8297
2017-12-17 22:27:05 +01:00
Daniel Marjamäki
1428759479
Fixed #8297 (Tokenizer:createLinks: 'X<sizeof(int)==1 || sizeof(int)==4>()')
2017-12-17 15:53:05 +01:00
Daniel Marjamäki
d292434e76
Try again to clarify warning message for new strcmp() checker
2017-12-13 15:28:50 +01:00
Daniel Marjamäki
3f36d4b5f4
try to clarify error message
2017-12-11 22:10:00 +01:00
IOBYTE
026d8f6859
fix #8284 : False positive: "Label 'class' is not used." for anonymous… ( #1011 )
...
* fix #8284 : False positive: "Label 'class' is not used." for anonymous C++ class
Add support for annonymous derived structures and classes.
* Fix travis build (use findsimplematch).
* Fix bug in simplifyLabelsCaseDefault which was inserting ; in wrong place.
2017-12-05 16:50:04 +01:00
Simon Martin
1b14380007
Ticket #8175 : Fix bug in TemplateSimplifier::instantiateMatch with template parameters involving sizeof or namespace.
2017-12-02 19:18:36 +01:00
BNT
fd76abba16
also generate debug information when building for release. This makes ( #1003 )
...
debugging and profiling easier and has now drawback as long as the PDB
files are not distributed (which would blow up installers)
2017-11-29 08:31:30 +01:00
BNT
b913a04462
remove outputlist since its not moved and all subfunction check for ( #1001 )
...
nullptr
2017-11-29 08:29:19 +01:00
Daniel Marjamäki
6c50dafbac
Fix classInfo to fix TestCppcheck assertion
2017-11-27 23:34:01 +01:00
Daniel Marjamäki
43db6147d3
astyle formatting
...
[ci skip]
2017-11-27 23:32:20 +01:00
Daniel Marjamäki
f28d5e91ac
Fixed #8251 (Condition: bug when there are more than 2 strcmp() on same buffer (tricky))
2017-11-27 12:55:20 +01:00
Simon Martin
cbf0b13b3e
Ticket #8255 : Don't crash upon invalid code while checking conditions.
2017-11-25 08:22:39 +01:00
Dmitry-Me
4ac56a55be
Fix FN for signed short passed as %hx into printf
2017-11-21 22:17:02 +03:00
Dmitry-Me
c6bf881ee6
Fix FN for signed char passed as %hhx into printf
2017-11-21 22:14:48 +03:00
Dmitry-Me
5869f6d989
Fix FN for std::intmax_t passed as %ld, %lld into scanf
2017-11-20 23:07:37 +03:00
Dmitry-Me
7cf21f329a
Fix FN for size_t, uintmax_t passed as %lx and %llx into printf
2017-11-20 22:56:33 +03:00
Dmitry-Me
f0a7365f35
Fix FN for ptrdiff_t passed as %Ix into printf
2017-11-20 22:51:10 +03:00
Dmitry-Me
eb4bb893b3
Fix FP for std::intmax_t passed as %jd into scanf
2017-11-20 22:31:13 +03:00
Dmitry-Me
c4b6db7e23
Fix FP for std::uintmax_t passed as %ju and %jx into scanf
2017-11-20 22:13:20 +03:00
Daniel Marjamäki
8fe4852b98
Refactoring, reuse and improve isVariableChangedByFunction()
2017-11-18 11:02:52 +01:00
Daniel Marjamäki
9191e6f112
Fixed #8246 (ValueFlow: known value, function pointer argument)
2017-11-17 23:04:54 +01:00
Daniel Marjamäki
5cfa13c31c
Reuse Token::isControlFlowKeyword()
2017-11-17 22:18:19 +01:00
Daniel Marjamäki
b57dd4359b
Fixed #8263 (check-library incorrectly reports missing configuration for case when value is in parentheses)
2017-11-17 22:10:39 +01:00
Dmitry-Me
cf05b722a9
Fix FN for intmax_t passed as %jx into printf
2017-11-18 00:00:02 +03:00
Dmitry-Me
73414ee56c
Fix FN for std::uintmax_t passed as %Lu and %Lx into scanf
2017-11-17 23:58:09 +03:00
Dmitry-Me
167258a6bf
Fix FNs when various types are passed as %tu into printf
2017-11-15 22:40:16 +03:00
Dmitry-Me
4fc0a7998e
Remove duplicate error reporting function
2017-11-14 21:46:17 +03:00
Daniel Marjamäki
b3c80947ed
Fixed #6508 (False positive unusedStructMember - brace initializer)
2017-11-12 22:33:17 +01:00
Daniel Marjamäki
526d8b76a6
Fixed #8271 (FP uninitMemberVar: Handle method call in middle of statement)
2017-11-11 21:28:24 +01:00
Daniel Marjamäki
31a1cebc5f
Fixed #8272 (setVarIdPass2: Broken parsing of class header)
2017-11-11 12:04:25 +01:00
Daniel Marjamäki
4740bf116f
Remove unused variable
2017-11-11 11:31:27 +01:00
Daniel Marjamäki
cbb23f14d2
astyle formatting
...
[ci skip]
2017-11-11 11:13:45 +01:00
BNT
cc4c9032de
Support relative paths in Visual Studio projects properties ( #995 )
...
* transform relative paths with the help of the project dir to absolute
paths so the actual checker can resolve include paths defined in
property sheets
* fix coding style (one-line if)
* add existing importproject testfile to visual studio project to appear
when loading solution
* also explicitly export struct from within class to enable linking in
testrunner
2017-11-11 11:13:18 +01:00
Daniel Marjamäki
b01772e4d1
Fix testcase
2017-11-10 21:28:13 +01:00
Daniel Marjamäki
6b1a2dcc5d
Fixed #7788 (Varid missing for member variable in ctor of template class)
2017-11-10 21:03:15 +01:00
Daniel Marjamäki
7ec0e41196
Fix Cppcheck performance warnings
2017-11-09 23:18:00 +01:00
Daniel Marjamäki
799f953c00
Fixed #8269 (Tokenizer: wrong varid (using namespace A::B))
2017-11-09 23:15:16 +01:00
Daniel Marjamäki
2408f01cc0
Fixed #8270 (Tokenizer: wrong varid (using namespace std))
2017-11-09 22:08:58 +01:00
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
Daniel Marjamäki
58db814d72
Rephraze /Same/Identical/
2017-09-08 12:41:33 +02:00
Daniel Marjamäki
97125acabd
Fixed #7365 (False positive: Use of erased iterator)
2017-09-08 09:45:30 +02:00
Daniel Marjamäki
57004ed533
Fixed #7663 (False positive: uninitialized variable (multi variables in inner scopes))
2017-09-07 23:08:55 +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
Ayaz Salikhov
1d2b58e828
Correctify explicit usage ( #951 )
2017-09-07 13:03:45 +02:00
Ayaz Salikhov
64eccd780c
Don't use static where not needed ( #952 )
2017-09-07 13:01:07 +02:00
Ayaz Salikhov
f0b5327450
Fix codestyle ( #953 )
2017-09-07 13:00:46 +02:00
Ayaz Salikhov
0fc35c1350
Name all params ( #956 )
2017-09-07 12:59:53 +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
Dmitry-Me
68f6cad2aa
Omit repeated search when no insertion occurs
2017-09-06 18:02:27 +03:00
Dmitry-Me
66524ef645
Clarify code using temporary
2017-09-06 18:00:23 +03:00
Dmitry-Me
35f5515931
Fix CID 1360383
2017-09-06 00:12:09 +03:00
Matthias Krüger
58a64702b7
add "internalAstError" id so we can easily track ast errors on daca.
2017-09-05 22:49:16 +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
Dmitry-Me
3127fcf429
Omit repeated computations
2017-09-05 17:56:57 +03:00
Dmitry-Me
0e444aa133
Cache and reuse values
2017-09-05 17:50:36 +03:00
Daniel Marjamäki
c1000998f0
CheckCondition: Fix FP found in daca results (ace)
2017-09-05 09:33:35 +02:00
Dmitry-Me
d7b91a9e92
Fix CID 1378763
...
Defensive check recovered from earlier version of this code
2017-09-05 00:17:51 +03:00
Dmitry-Me
7e823e6d8e
Extract repeating checks, break loop early
2017-09-05 00:04:48 +03:00
Dmitry-Me
79f74fc4d3
Break loop early
2017-09-05 00:00:02 +03:00
Dmitry-Me
7c8cb29d14
Extract repeating checks
2017-09-04 23:58:14 +03: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
Dmitry-Me
5885988b1f
Cache and reuse value
2017-09-04 23:33:52 +03:00
Dmitry-Me
aece2254d7
Put faster checks first
2017-09-04 23:33:14 +03: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
Dmitry-Me
f7ab8c5ebb
Drop unneeded parentheses
...
Those are a misleading leftover from old code
2017-09-04 22:49:05 +03:00
Dmitry-Me
c29f16a306
Cache and reuse values
2017-09-04 17:55:45 +03:00
Dmitry-Me
5dba8268e7
Better variable name
2017-09-04 17:53:56 +03: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
a02fd54a69
ValueFlow: Avoid FPs for aliased variables
2017-09-03 23:24:55 +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
Hinterwaeldlers
8aa568f085
Corrected noexcept constructor delegating handling ( #948 )
2017-09-02 22:54:23 +02:00
Daniel Marjamäki
1ecefa045a
Fixed #8194 (False positive reademptycontainer - range based loop)
2017-09-02 22:22:32 +02:00
Daniel Marjamäki
30f04a5a96
Fixed #8195 (False positive uninitvar (regression) - valueflow misses variable initialization via istringstream >>)
2017-09-02 21:53:51 +02:00
Daniel Marjamäki
9eed9adf3c
Fixed CID 1361393, logically dead code in return statement
2017-09-02 10:49:29 +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
3bbcede43b
Fixed #8193 (crash: A = -(-0.2) / (1.0 + B * B) ( daca, lammps))
2017-09-01 22:15:09 +02:00
Dmitry-Me
beba46987d
Remove redundant variable
2017-09-01 18:19:25 +03:00
Dmitry-Me
2133350bf0
More useful default value
2017-09-01 18:17:40 +03:00
Dmitry-Me
4663dc205a
Cache and reuse value
2017-09-01 18:16:08 +03:00
Daniel Marjamäki
3b4f60fd21
Updated error message
2017-09-01 13:33:47 +02:00
Daniel Marjamäki
7fad1b9a36
Improved checking for opposite conditions
2017-08-31 22:53:21 +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
d598a1c278
Fix typo causing two expressions being identical
2017-08-30 22:43:54 +03:00
Daniel Marjamäki
82527422a8
Fixed #5614 (Incorrect syntax error with function pointer typedef and dependent template types)
2017-08-30 19:18:05 +02:00
Daniel Marjamäki
59034e17f1
Refactoring, reuse code to skip lambda functions
2017-08-29 22:35:55 +02:00
Daniel Marjamäki
9c99bc43c2
ValueFlow: Skip wrong handling of lambda functions. TODO: handle lambda functions properly.
2017-08-28 22:39:12 +02:00
Dmitry-Me
017e72d145
Read attribute once, better variable name
2017-08-28 19:11:04 +03:00
Dmitry-Me
7bd3dc5da6
Simplify array access with references
2017-08-28 18:19:03 +03:00
Dmitry-Me
7d19d1ea2e
Better use of temporary
2017-08-28 18:15:15 +03:00
Dmitry-Me
cf6d3ba398
Omit unneeded computations
2017-08-28 18:10:49 +03:00
Daniel Marjamäki
02a1b7cd2d
Fixed #7965 (valueFlowForward: Improved handling of correlated variables)
2017-08-27 19:50:44 +02:00
Daniel Marjamäki
713f607168
Fixed #8156 (wrong ast for 'z = (x & (unsigned)1) | (y & (unsigned)2);')
2017-08-26 23:25:45 +02:00
Daniel Marjamäki
e74e4c6934
Fixed #8030 (False positive 'constStatement' when indexing with {})
2017-08-26 11:59:09 +02:00
Dmitry-Me
cc97834e88
Revert "Combine overlapping patterns"
...
This reverts commit 123f9b67e0
.
2017-08-26 08:18:24 +03:00
Dmitry-Me
123f9b67e0
Combine overlapping patterns
2017-08-26 07:32:02 +03:00
Dmitry-Me
b9c2a996bf
Break loop early
2017-08-26 07:26:28 +03:00
Daniel Marjamäki
46c6620691
Token::takeData: dont keep old values or valuetype
2017-08-25 23:32:26 +02:00
Daniel Marjamäki
ea0db18e0c
Refactor Token::deleteThis()
2017-08-25 23:30:04 +02:00
Daniel Marjamäki
529b255e99
ValueFlow: Better errorpath for increment/decrement
2017-08-25 23:07:26 +02:00
Daniel Marjamäki
b1b8e5270a
ValueFlow: Better errorpath for increment/decrement
2017-08-25 22:15:52 +02:00
Heiko Eißfeldt
bab2b26d10
Fixed #8154 (heap use after free in tokenlist)
2017-08-25 17:17:19 +02:00
Daniel Marjamäki
50636f75ba
ValueFlow: Improved error path for compound assignments
2017-08-24 22:02:49 +02:00
Dmitry-Me
61e290750e
Read attribute once, better variable name
2017-08-24 18:28:52 +03:00
Dmitry-Me
3bcfc33014
Break loop early
2017-08-24 18:26:53 +03:00
Dmitry-Me
45996b1404
Simplify code, read attribute once
2017-08-24 18:23:44 +03:00
Dmitry-Me
eba9ea0ed0
Remove redundant check
2017-08-24 18:11:54 +03:00
Dmitry-Me
2582bbd0f6
Break loop early
2017-08-24 18:10:33 +03:00
Daniel Marjamäki
d160d27417
Fixed #8172 (False positive uninitvar on sizeof *ptr)
2017-08-23 22:17:49 +02:00
Daniel Marjamäki
f10634c021
ValueFlow: Dont try to evaluate '/=0;'
2017-08-23 17:53:05 +02:00
Dmitry-Me
7fba6ecef1
Remove and disallow unused copy constructor
2017-08-23 17:54:20 +03:00
Daniel Marjamäki
167cfb1ac5
valueFlowForward: improve handling of compound assignments
2017-08-23 11:13:47 +02:00
Daniel Marjamäki
71b0370389
Fixed #1793 (CheckType::checkFloatToIntegerOverflow: assignments)
2017-08-23 05:34:47 +02:00
Daniel Marjamäki
b7f9e7ed1d
negativeContainerIndex: avoid crash when AST is wrong
2017-08-22 12:30:43 +02:00
Daniel Marjamäki
2679b576c2
Fixed #1693 (false negative: std::vector, negative index)
2017-08-22 11:04:02 +02:00
Alexander Mai
0cae823c5d
Fix doxygen comments
2017-08-21 21:13:01 +02:00
Daniel Marjamäki
e087156e30
CheckUninitVar: Try to activate the valueflow based checking again
2017-08-20 19:54:06 +02:00
Daniel Marjamäki
3abb62a6d1
Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);)
2017-08-20 19:47:26 +02:00
Daniel Marjamäki
92e9744020
Fixed #8148 (Tokenizer: Braces are not added properly in do while)
2017-08-16 18:55:34 +02:00
Dmitry-Me
2a4f68ccf8
Resolve CID 1365361
...
* work around possible null pointer dereference in case of missing attributes
2017-08-16 17:53:04 +03:00
Martin Güthle
1d491bd332
Treat noexcept correctly
...
Converts the noexcept to the already correctly handled noexcept(true)
2017-08-16 11:31:19 +02:00
Daniel Marjamäki
5c733c8f22
Fixed #8152 (Garbage code cause crash '0|\0|0>;')
2017-08-15 23:19:42 +02:00
Hinterwaeldlers
705e5e3468
Fix for http://trac.cppcheck.net/ticket/8151 ( #942 )
...
* Taking care of incorrect template syntax (missing close)
Forward the incorrectness via throw, as there is no direct access to the
syntaxError method, without converting the function to a member function
2017-08-15 22:40:55 +02:00
Dmitry-Me
6303437163
Resolve C4800
2017-08-15 17:42:56 +03:00
Dmitry-Me
d3d9c76f01
Fix off by one, resolve C4334
2017-08-14 18:07:36 +03:00
Dmitry-Me
b995e59ff2
No need for counting here
2017-08-14 18:06:23 +03:00
Daniel Marjamäki
ca6109b40c
threadsafety: Fix static data in Token::values()
2017-08-13 14:15:24 +02:00
Daniel Marjamäki
fb37f3503a
Fix GCC compiler warning about missing enum constant PlatformFile in switch
2017-08-12 00:17:55 +02:00
Dmitry-Me
45032f7d3b
Use std mechanism to detect signedness
2017-08-11 18:44:14 +03:00
Gennady Feldman
1c71c789d6
Stop parsing a define with value at the '='. ( #937 )
2017-08-09 20:02:25 +02:00
Ayaz Salikhov
b8cd7dbb5c
Use nullptr instead of 0 or NULL ( #936 )
2017-08-09 20:00:26 +02:00
orbitcowboy
61e47208eb
Removed hard coded avr8 platform and moved it into a platform file (avr8.xml).
2017-08-09 11:58:27 +02:00
Daniel Marjamäki
7a9d4b820f
Fixed #8158 (Custom platform configuration seems to be not used)
2017-08-09 11:06:31 +02:00
Daniel Marjamäki
c0890b5255
ImportProject: Improve cppcheckDefines()
2017-08-08 22:57:11 +02:00
Daniel Marjamäki
9861240e79
ImportProject: Only expose Cppcheck Visual Studio defines for Cppcheck
2017-08-08 22:27:08 +02:00
Nekto89
729af993fe
Fix absolute pathes import from vcxproj ( #934 )
...
Fixed importing vcxproj that contains files with absolute pathes.
2017-08-07 23:51:12 +02:00
Daniel Marjamäki
5fa7a4edc4
GUI: save dumpfiles in buildDir if possible
2017-08-03 22:54:38 +02:00
Daniel Marjamäki
53002e40f6
Fix ImportProject
2017-08-03 20:38:24 +02:00
Daniel Marjamäki
ccea0b17b3
ImportProject: Read system includes and standard from compile database
2017-08-03 20:33:56 +02:00
Daniel Marjamäki
61eccd7070
Fix dump
2017-08-03 18:03:59 +02:00
Daniel Marjamäki
4eb43a5557
Fixed some recent regression in ImportProject for vcxproj projects
2017-08-02 22:51:22 +02:00
Veli-Matti Visuri
da3846f752
Add Timer copy constructor ( #932 )
...
- Satisfy the rule of three
2017-08-02 22:34:28 +02:00
amai2012
39955973e9
Merge pull request #931 from IOBYTE/master
...
Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='
2017-08-02 21:16:29 +02:00
Daniel Marjamäki
f7514fcd2c
Fix issue detected by Coverity, dereference tok3 and then check if its null.
2017-08-02 08:38:36 +02:00
Daniel Marjamäki
e977cea04c
Fix issue detected by Coverity, either null pointer check is useless or there is null pointer dereference
2017-08-02 08:24:16 +02:00
Daniel Marjamäki
32422c815b
Fix issue found by Coverity, scope cant be null since scope is dereferenced on all paths before the while and also unconditionally inside while
2017-08-02 08:17:29 +02:00
Daniel Marjamäki
462ae455c8
Fix issue detected by Coverity, missing check if _settings is null
2017-08-02 08:04:35 +02:00
Daniel Marjamäki
60f819dbe7
Refactoring, use continue in loop
2017-08-02 08:00:52 +02:00
Daniel Marjamäki
5abf39503a
Fix issue detected by Coverity, in case solution does not specify platform configuration the platform will be uninitialized
2017-08-02 07:59:25 +02:00
Daniel Marjamäki
05cdda3f4c
Fix issue detected by Coverity, XMLElement::Attribute might return null
2017-08-02 07:56:22 +02:00
Daniel Marjamäki
55aec0ef1b
Fix issue detected by Coverity, vt2 is null checked and then dereferenced
2017-08-02 07:48:11 +02:00
Robert Reif
f5044bb65f
Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='.)
...
Do not count static member variables when trying to figure out if
'operator =' is needed.
2017-08-01 19:52:41 -04:00
Matthias Krüger
9b6d371762
checkbufferoverrun: remove dead store
...
the variable was declared inside a loop and the dead store also took place inside the loop (guarded by a condition) without further access of the value after that store.
Found by clang analyzer.
Was:
lib/checkbufferoverrun.cpp:1223:17: warning: Value stored to 'tok' is never read
tok = tok->next();
^ ~~~~~~~~~~~
2017-08-01 16:53:00 +02:00
Daniel Marjamäki
9ef9d0e4a8
Fixed #8128 (False negative: variable is assigned value that is not read)
2017-08-01 14:56:53 +02:00
Daniel Marjamäki
1758c3b4e7
Fix suspicious code found by Coverity, dont check if scope->function is null and then dereference it
2017-08-01 13:26:35 +02:00
Daniel Marjamäki
058c439b2a
Coverity detected useless function call, cleanup code
2017-08-01 12:45:37 +02:00
Daniel Marjamäki
0c8a899f59
Fix issue detected by Coverity, there was dead code because the wrong variable was used in condition
2017-08-01 11:45:51 +02:00
Daniel Marjamäki
be998773ee
Minor refactoring, fixes FP from Coverity
2017-08-01 11:33:24 +02:00
Daniel Marjamäki
6cc7f46696
Fix issue detected by Coverity, ternary condition is always true
2017-08-01 11:25:28 +02:00
Daniel Marjamäki
267a2e154d
Fixed #8127 (cppcheck 1.80 compilation by MINGW32 gcc 6.3 failed)
2017-07-31 18:30:20 +02:00
Daniel Marjamäki
cdeae918a8
Fix issue detected by Coverity (ternary operator false expression is unreachable)
2017-07-31 17:58:07 +02:00
Daniel Marjamäki
a024f339dd
Fix issue detected by Coverity (ternary operator false expression is unreachable)
2017-07-31 17:55:15 +02:00
Daniel Marjamäki
fec0c46af0
Refactoring, use continue in loop
2017-07-30 14:53:58 +02:00
Daniel Marjamäki
29265cdd49
Refactoring, use continue
2017-07-30 12:46:04 +02:00
PKEuS
9558877458
Set version to 1.80.99/1.81 dev
2017-07-30 08:48:47 +02:00
Daniel Marjamäki
f76ff9e7bf
Tokenizer: Put struct in anonymous namespace
2017-07-29 19:46:18 +02:00
Daniel Marjamäki
91eb0f1fad
Removed XML version 1
2017-07-29 18:56:22 +02:00
Daniel Marjamäki
baedfa6718
1.80: Set versions
2017-07-29 12:55:53 +02:00
Daniel Marjamäki
a78fd23732
Refactoring, skipEnumBody
2017-07-29 12:13:32 +02:00
Daniel Marjamäki
abf525e46d
Fix Cppcheck warning
2017-07-29 11:58:00 +02:00
Simon Martin
aa35462add
Ticket #8091 : Don't replace std types within enum definitions. ( #922 )
2017-07-29 11:56:09 +02:00
Daniel Marjamäki
01f023dc0a
CheckClass: Refactor hasAssignSelf to use AST
2017-07-28 23:49:11 +02:00
orbitcowboy
0e575ce12c
Modernize: make use of 'nullptr' and added a rule-file for finding non-nullptr (zero) initializations.
2017-07-28 15:20:43 +02:00
Daniel Marjamäki
c4bd70210c
GUI: Rename methods in FileList and PathMatch
2017-07-28 10:55:51 +02:00
Daniel Marjamäki
a4dd8f0aa4
modernize, use nullptr
2017-07-27 18:36:33 +02:00
Daniel Marjamäki
5ae962194d
revert mode change for lib/checkstl.cpp
2017-07-26 23:51:30 +02:00
Daniel Marjamäki
27af3edc5b
CheckStl: Safer use of AST
2017-07-26 23:43:39 +02:00
Daniel Marjamäki
eb288ec2a1
CheckStl: Use AST to handle iterator comparisons better
2017-07-26 23:13:01 +02:00
Daniel Marjamäki
a3916c501c
Refactor loop, use continue
2017-07-26 22:03:55 +02:00
Daniel Marjamäki
da26ef0650
Refactoring: Use continue in loop
2017-07-26 21:13:49 +02:00
Daniel Marjamäki
32940c023a
Refactoring: Use continue in loop
2017-07-26 20:32:14 +02:00
Daniel Marjamäki
2d4f64027a
Refactoring: Use continue in loop
2017-07-26 20:29:13 +02:00
Daniel Marjamäki
2f38d3d80e
CheckStl: Use ValueType
2017-07-26 20:19:36 +02:00
Andreas Pokorny
b802b98136
Do not warn when unique pointers are passed by value
...
A unique pointer should only be passed by value or by const reference.
Passing by value means transferring ownership it makes no sense to have a pass by value Warning for unique_ptr
Signed-off-by: Andreas Pokorny <andreas.pokorny@siemens.com>
2017-07-25 11:17:56 +02:00
Daniel Marjamäki
0a03bbb320
Fixed #6315 (false positive - unreadVariable - variable is used via pointer)
2017-07-23 23:32:14 +02:00
Daniel Marjamäki
b41350e8d8
Token::expressionString(): Fixed output of library types
2017-07-22 16:42:42 +02:00
Daniel Marjamäki
bf5040e3d6
Fixed #7701 (ValueFlow: handle 64-bit unsigned values )
2017-07-22 12:19:46 +02:00
Daniel Marjamäki
12b7843937
astyle formatting
...
[ci skip]
2017-07-21 09:17:25 +02:00
Daniel Marjamäki
255d0410a4
Fixed #8085 (Token::expressionString: unsigned long long)
2017-07-21 09:16:42 +02:00
Daniel Marjamäki
76a50e60b9
Merge pull request #926 from mathbunnyru/asalikhov/fix_warnings_macro
...
Fix warnings
2017-07-17 22:46:40 +02:00
Ayaz Salikhov
4bbc830a85
Fix warnings
2017-07-17 10:13:11 +03:00
Robert Reif
354a773bfe
Fix #8020 (ValueType: no value type for iterator + constant)
2017-07-16 11:27:32 -04:00
Daniel Marjamäki
fabe07ffd6
Merge pull request #924 from IOBYTE/master
...
Fixed #6985 (SymbolDatabase: Function pointer not set when calling bas…
2017-07-16 14:04:25 +02:00
Robert Reif
b0aec042a6
Fixed #6985(SymbolDatabase: Function pointer not set when calling base class function)
...
Use using namespace when looking up types.
2017-07-15 19:14:15 -04:00
Daniel Marjamäki
814d2ae2a4
Fixed #7028 (False positive: opposite conditions (const method modifies variable))
2017-07-10 23:12:45 +02:00
rsBNT
fb7230ce05
importSln: Handle absolute paths for vcxproj
2017-07-10 11:12:48 +02:00
Daniel Marjamäki
f85e43d21f
Fixed #8059 (Tokenizer::simplifyWhile0: for loop that modifies local variable)
2017-07-09 22:44:10 +02:00
Daniel Marjamäki
dff9d13758
Fixed #8115 (Tokenizer: links not properly set in r-value template 'Foo<int> && foo')
2017-07-09 13:26:59 +02:00
Daniel Marjamäki
ea598d5284
refactoring, use early return
2017-07-09 13:09:36 +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
Daniel Marjamäki
0a91ced941
refactoring, use continue in loop instead of nesting
2017-07-09 12:36:33 +02:00
Daniel Marjamäki
ac85b78e2a
Fixed #5619 (false positive: unusedVariable - array accessed by pointer variable only)
2017-07-09 11:19:00 +02:00
Daniel Marjamäki
7161daefbd
Fixed #8040 (False positive resourceLeak - handle assigned to class instead of scalar)
2017-07-08 22:28:31 +02:00
Daniel Marjamäki
6417be4a71
Fixed #8054 (Tokenizer::simplifyKnownVariables(): Wrong simplification for global variables)
2017-07-08 22:12:01 +02:00
Daniel Marjamäki
6c2002a150
minor constness fix
2017-07-08 21:41:57 +02:00
Daniel Marjamäki
6b48781fdc
Fixed #7105 (False positive resourceLeak - socket handle wiped after close)
2017-07-07 21:51:48 +02:00
Daniel Marjamäki
211d8c6020
Refactoring checking for unused variables (avoid FN when not taking address)
2017-07-01 22:45:51 +02:00
Daniel Marjamäki
d6f066482e
Fixed #6542 (FP: Variable 'lcount' is not assigned a value - using address of integer array)
2017-07-01 11:31:51 +02:00
Daniel Marjamäki
db01ea1408
Fixed #6261 (false positive: Variable used in ternary expression within function argument list)
2017-07-01 11:03:49 +02:00
Daniel Marjamäki
4827751b04
improve constness
2017-07-01 09:10:23 +02:00
Daniel Marjamäki
f847631cdb
Fixed #5273 (FP memleak: Unknown if() condition should make error inconclusive)
2017-06-30 23:05:09 +02:00
Daniel Marjamäki
b97f5d909e
Fixed #6570 (False positive unusedFunction - function called from within template function)
2017-06-30 14:34:28 +02:00
Daniel Marjamäki
22919da9a8
Fixed #6246 (Defect: False positive due to ignoring struct initialisation when nested in a loop and assigned to a member)
2017-06-30 13:41:19 +02:00
Daniel Marjamäki
3ab8466415
refactoring, use early continue in for loop
2017-06-30 12:45:48 +02:00
x29a
15b0eb42bd
import solution: Support system environment variables
2017-06-27 12:41:25 +02:00
Daniel Marjamäki
dc37034687
Merge pull request #917 from x29a/unique_includes
...
Unique includes
2017-06-23 20:21:38 +02:00
neheb
ef86ac04b4
Add OpenCL support
...
OpenCL is basically C99.
2017-06-22 17:34:07 -07:00
x29a
b3a747d606
fix brainfart
2017-06-22 16:53:13 +02:00
x29a
cde17935ea
only use each include path once
2017-06-22 16:49:36 +02:00
Daniel Marjamäki
1e12ec241c
reuse simplecpp::simplifyPath
2017-06-21 14:27:46 +02:00
Daniel Marjamäki
f86d8244fa
Fixed #8022 (DacaWrongData: checkIgnoredReturnValue, hana)
2017-06-10 08:23:26 +02:00
Daniel Marjamäki
453058c059
AST: Better handling of C++11 initializer lists
2017-06-09 22:35:46 +02:00
Daniel Marjamäki
fd74d455ce
AST: Better handling of case
2017-06-08 15:32:35 +02:00
Daniel Marjamäki
da87fdbb90
Refactoring TemplateSimplifier::simplifyCalculations, Token::Match patterns
2017-06-08 08:18:40 +02:00
Daniel Marjamäki
c1ea873e1c
TemplateSimplifier::simplifyCalculations: Add some more tests and make sure they pass
2017-06-08 08:15:05 +02:00
Daniel Marjamäki
cb48e63f92
TemplateSimplifier: Fixed bug in simplifyCalculations. Now template58 test case does not throw InternalError
2017-06-08 00:49:46 +02:00
Daniel Marjamäki
d2e7df2c04
TemplateSimplifier: Broke out code into separate function
2017-06-08 00:16:43 +02:00
Daniel Marjamäki
2740736136
Avoid 'deleteThis' in TemplateSimplifier::simplifyCalculations as it can cause 'use after free' see #6021
2017-06-07 20:09:06 +02:00
Daniel Marjamäki
d335412858
Avoid 'deleteThis' in TemplateSimplifier::simplifyCalculations as it can cause 'use after free' see #6021
2017-06-07 19:46:02 +02:00
Daniel Marjamäki
18abe4a142
Fixed #6021 (TemplateSimplifier::simplifyCalculations causes heap corruption on invalid code)
2017-06-07 19:32:56 +02:00
Daniel Marjamäki
60e36492e2
Refactoring, renamed local variable
2017-06-07 12:37:44 +02:00
Alexander Mai
ce13b75967
Add missing types to Platform::platformString(). Add another pattern to Tokenizer::findGarbageCode() to avoid potential crash in Valueflow
2017-06-06 22:15:11 +02:00
Stas Cymbalov
ff38cc5c13
Set struct size cutoff in passedByValue check to 2*sizeof_pointer
...
Struct arguments are either pushed to the stack or passed in the
registers. Since both methods operate on machine words it is logical to
tie the maximum size of a struct argument that doesn't trigger
passedByValue diagnostic to the size of the machine word.
Also guessed size of STL classes is set to 3*sizeof_pointer, this better
represents reality and ensures that structs containing them will still
trigger passedByValue.
2017-06-06 08:48:11 +02:00
Daniel Marjamäki
3b805e7001
fix testrunner (WRONG_DATA usage)
2017-06-05 18:49:20 +02:00
Daniel Marjamäki
150d2aa902
Refactor and rename CHECK_WRONG_DATA
2017-06-05 18:41:15 +02:00
Daniel Marjamäki
62c22a8e06
daca2: change output for DacaWrongData. Show location. And use severity 'debug'
2017-06-04 19:46:20 +02:00
Daniel Marjamäki
66a488586e
Temporarily readd the UNSTABLE configuration
2017-06-04 18:30:49 +02:00
Daniel Marjamäki
20b27cfd51
avoid some WrongData warnings
2017-06-04 18:27:42 +02:00
Daniel Marjamäki
0c6a551039
Try to limit Daca2WrongData output a little
2017-06-04 16:41:30 +02:00
Daniel Marjamäki
9715164d0a
Fixed DACA2 CHECK_WRONG_DATA macro
2017-06-04 15:50:27 +02:00
Daniel Marjamäki
35348fcf98
Try to fix Travis
2017-06-04 14:46:57 +02:00
Daniel Marjamäki
1439b08fbd
Fixed -DDACA2 compiler errors
2017-06-04 14:14:42 +02:00
Daniel Marjamäki
2106099029
daca2: print error message (DacaWrongData) instead of crashing when wrong data is seen
2017-06-04 14:05:34 +02:00
Daniel Marjamäki
26bd863d0a
Fixed #7724 (hang: long expression => wrong AST)
2017-06-04 12:16:49 +02:00
Daniel Marjamäki
b8ee500d45
Fixed #7092 (Invalid style error: Variable not assigned a value)
2017-06-03 15:31:29 +02:00
Daniel Marjamäki
ccb2f2ce6a
astyle formatting
...
[ci skip]
2017-06-03 15:30:36 +02:00
Daniel Marjamäki
bbde3cc23a
Merge pull request #910 from mathbunnyru/asalikhov/improve_readability
...
improve readability
2017-06-03 14:33:21 +02:00
Daniel Marjamäki
aeef7117fe
astyle formatting
...
[ci skip]
2017-06-03 11:34:30 +02:00
Daniel Marjamäki
7ec3715c57
check.h: Cppcheck will be stable by default. Use -DUNSTABLE to make it unstable.
2017-06-03 11:18:00 +02:00
uburuntu
f4ce49d883
ENH: perfomance: using clear() and empty() more faster for stl containers
2017-06-02 22:38:00 +04:00
Ayaz Salikhov
f5646183cd
Move comment to the right place
2017-06-02 17:15:24 +03:00
Alexander Mai
b4a58be113
#define HIDE_WRONG_DATA to get release mode build (hiding crashes on invalid AST/symboldatabase). Fix doxygen syntax.
2017-06-01 23:38:02 +02:00
Daniel Marjamäki
b68c8d91ab
Fixed #8039 (Tokenizer: wrong simplification of string)
2017-06-01 22:21:02 +02:00
Daniel Marjamäki
bce0776417
Fixed #7795 (ValueFlow: Value is not known after conditional increment )
2017-06-01 15:16:07 +02:00
Daniel Marjamäki
5efb2e3be0
Visual Studio: Skip unknown platforms (ARM, ARM64)
2017-06-01 13:13:23 +02:00
Ayaz Salikhov
132c0af22a
Simplify some statements
2017-06-01 02:02:12 +03:00
Ayaz Salikhov
3cd2f2d092
Don't cast bool to bool
2017-06-01 01:49:40 +03:00
Ayaz Salikhov
cb58cf8163
.length() > 0 == !.emepty()
2017-06-01 01:42:29 +03:00
Daniel Marjamäki
1f48b082d1
CLI: Add --output-file flag so results can be written to file directly.
2017-05-30 15:04:28 +02:00
Ville Skyttä
5ab158fec2
Spelling fixes
2017-05-30 08:03:15 +03:00
Daniel Marjamäki
1961d6d0f7
CppCheck: make sure preprocessor syntax errors are reported
2017-05-28 20:34:58 +02:00
Sam Truscott
956b5812e7
Fixed #7866 (Crash while scanning QML files)
2017-05-28 16:39:18 +02:00
Steve Browne
b58562fc7d
Added test cases for catching when assignment comes after an operator, compound assignment, or comparison for ticket #7429 and fixed the tests.
2017-05-28 16:00:06 +02:00
Daniel Marjamäki
18adb97873
astyle formatting
...
[ci skip]
2017-05-28 15:56:26 +02:00
Frank Zingsheim
aa937e426d
Fixed #7849 (Tokenizer: Wrong simplification of floating point equality comparison)
2017-05-28 10:53:50 +02:00
amai
624ceb5027
Fix includes for cygwin
2017-05-27 10:23:06 +02:00
Ayaz Salikhov
28aa939d69
iwyu - include what you use
2017-05-27 04:33:47 +02:00
uburuntu
d41d091c07
ENH: perfomance: seeking of one char is more efficiently
2017-05-27 04:15:54 +02:00
amai
45ba1ff1e3
#8079 SymbolDatabase::createSymbolDatabaseEnums() crashes on invalid enum declaration
2017-05-25 09:50:14 +02:00
Daniel Marjamäki
1dd42d9a9e
arrayIndexOutOfBounds: Make sure error message is clarified for daca2 --template format
2017-05-25 08:18:37 +02:00
Daniel Marjamäki
0262020707
--template: Removed 'clang' and renamed 'cppcheck2' to 'daca2'
2017-05-25 05:24:42 +02:00
Daniel Marjamäki
dda5556ded
Fixed #8034 (AST: better handling for c++ type initialization)
2017-05-24 20:24:56 +02:00
Daniel Marjamäki
5444875f89
Fixed #8034 (AST: better handling for c++ type initialization)
2017-05-24 20:18:31 +02:00
Daniel Marjamäki
099b4435c3
Fixed #8074 (Preprocessor::getConfigs: wrong configuration extracted 'A;B;;')
2017-05-24 11:16:41 +02:00
Daniel Marjamäki
93e0516291
Fixed #8009 (Tokenizer: fix handling of template rvalue references)
2017-05-23 18:55:17 +02:00
Daniel Marjamäki
70c2de62b7
arrayIndexOutOfBounds: better note
2017-05-23 16:06:32 +02:00
Daniel Marjamäki
6e1544bd49
ValueFlow: Use getOrdinalText()
2017-05-23 15:01:56 +02:00
Daniel Marjamäki
e73657b198
Clarify arrayIndexOutOfBounds
2017-05-23 14:58:43 +02:00
Daniel Marjamäki
a3c0eecccf
Added --template=cppcheck2 output format
2017-05-23 12:19:11 +02:00
Daniel Marjamäki
6cb563b3fe
ErrorLogger: Adjust the severity in the 'clang' output format. as far as I know, clang severities are 'fatal error', 'error' and 'warning'.
2017-05-23 12:02:57 +02:00
Daniel Marjamäki
d3d3d31613
Clarify 'invalidFunctionArg' messages
2017-05-23 11:57:25 +02:00
Daniel Marjamäki
f7cda81c0c
Refactoring: ValueFlow::Value::errorSeverity() will have the logic if value is 'error' or 'warning'
2017-05-23 11:43:56 +02:00
orbitcowboy
ba2b235e24
Fixed: warning: ‘tokvalue’ may be used uninitialized in this function [-Wuninitialized].
2017-05-22 15:22:38 +02:00
orbitcowboy
ffe6582e6b
Added platform support for Atmel AVR 8 bit microcontrollers.
2017-05-22 14:46:19 +02:00
Daniel Marjamäki
b59bd96c6d
ErrorLogger: Fix crash when error message does not have a FileLocation
2017-05-22 11:25:58 +02:00
Daniel Marjamäki
8ef9ab26b1
Clarify floatConversionOverflow
2017-05-22 11:04:24 +02:00
Daniel Marjamäki
0cb1c4f221
Clarify integerOverflow messages
2017-05-22 10:10:56 +02:00
Daniel Marjamäki
9374055238
ErrorPath: clarify the 'shiftTooManyBits' error message
2017-05-22 07:58:56 +02:00
Daniel Marjamäki
7af58cf31a
show full error path in xml files
2017-05-22 07:42:54 +02:00
Daniel Marjamäki
58da0df2f6
astyle formatting
...
[ci skip]
2017-05-20 18:52:48 +02:00
Daniel Marjamäki
82a372a380
Try to clarify ErrorPath texts
2017-05-20 08:47:35 +02:00
Daniel Marjamäki
55ae206ecc
ErrorPath: better output
2017-05-19 17:29:16 +02:00
Daniel Marjamäki
b53a2ff9eb
Command line: Added --template=clang formatting
2017-05-19 17:09:49 +02:00
Daniel Marjamäki
f92b16706c
ValueFlow: Add ErrorPath info after for loop
2017-05-19 16:32:58 +02:00
Daniel Marjamäki
2bb54fef69
ValueFlow: Test ErrorPath handling
2017-05-19 14:34:59 +02:00
Matthias Krüger
a2c716fa3b
CheckOther::checkDuplicateExpression(): be lazier if style-reports are not enabled. NFCI.
2017-05-19 00:54:55 +02:00
Daniel Marjamäki
899615c1e4
update simplecpp includes
...
[ci skip]
2017-05-18 22:26:07 +02:00
Matthias Krüger
aa3f1db33c
Add internal check that checks for redundant non-nullness checks in Token::(simple)Match checks.
...
In code like
if (tok && Token::simpleMatch(tok, "bla")) {}
or
if (tok->previous() && Token::Match(tok->previous(), "foo")) {},
the first check is redundant because Token::(simple)Match already checks if the argument token is null.
2017-05-18 22:12:33 +02:00
Daniel Marjamäki
9d08cbf4d2
Fix 'make checkcfg'
2017-05-18 22:10:08 +02:00
Daniel Marjamäki
340c687cbf
Revert "Use 'Stringification => Tokenizer' until some issues have been fixed"
...
This reverts commit c2727691a4
.
2017-05-18 21:53:25 +02:00
Daniel Marjamäki
040d2f0012
Use simplecpp lexer in test cases
2017-05-18 21:52:31 +02:00
Daniel Marjamäki
c2727691a4
Use 'Stringification => Tokenizer' until some issues have been fixed
2017-05-18 09:33:41 +02:00
Daniel Marjamäki
7bd0bc7534
Tokenizer: Simplify '->' to '.'
2017-05-17 22:50:54 +02:00
Daniel Marjamäki
bc12a0b21f
Handle empty token list better (for instance when Preprocessor::validateCfg() see problem)
2017-05-17 22:30:20 +02:00
Daniel Marjamäki
1f4b84379d
Fix for #pragma asm
2017-05-17 21:58:46 +02:00
Daniel Marjamäki
59335f80d2
Try to fix windows build. Reduce header dependencies
2017-05-17 15:38:31 +02:00
Daniel Marjamäki
90a952d8c2
Add col and info in plist
2017-05-17 15:22:51 +02:00
Daniel Marjamäki
6230919976
Skip 'Stringification => Tokenize' step
2017-05-17 14:57:54 +02:00
Daniel Marjamäki
67e3187653
Preprocessor: Refactor handling of #pragma asm
2017-05-17 10:25:37 +02:00
Daniel Marjamäki
cd53d10970
ErrorPath: More information about assignments
2017-05-16 23:12:35 +02:00
Daniel Marjamäki
ecb3f0a934
ErrorLogger: Write ErrorPath info in the xml report
2017-05-16 22:58:02 +02:00
Daniel Marjamäki
c617851567
ErrorLogger: Added ErrorPath where each item has token and info
2017-05-16 22:38:13 +02:00
Daniel Marjamäki
e65d6d3c67
ValueFlow: inherit Value::callstack in calculations
2017-05-16 19:43:55 +02:00
Daniel Marjamäki
f92e7b3bfc
Emit better errorpath in CheckBufferOverrun::negativeIndexError
2017-05-16 19:08:47 +02:00
Daniel Marjamäki
970ff181de
Show 'Possible' errors without --enable=warning
2017-05-16 17:51:45 +02:00
Daniel Marjamäki
6967d68137
Add --plist-output argument
2017-05-16 14:07:23 +02:00
Daniel Marjamäki
3ef2f825c7
Fixed Cppcheck warnings about null pointer dereference
2017-05-15 20:36:28 +02:00
Daniel Marjamäki
8d75d1b920
Partial fix for #8028 (ValueFlow: Origin/callstack of value)
2017-05-15 20:05:11 +02:00
PKEuS
3432257390
Removed deprecated command --append
2017-05-14 11:57:04 +02:00
PKEuS
fda1f67da6
Set version to 1.79.99/1.80 dev
2017-05-14 10:07:38 +02:00
PKEuS
fb94ad21fa
Updated Visual Studio solution to VS2017.
2017-05-14 10:04:25 +02:00
Daniel Marjamäki
45d998979c
CHECK_WRONG_DATA: switch to debug macro
2017-05-13 19:10:05 +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
Daniel Marjamäki
e5e5a5e4b8
1.79: Set version
2017-05-13 11:25:16 +02:00
Daniel Marjamäki
95db173e77
Fixed Cppcheck warning
2017-05-13 11:06:33 +02:00
orbitcowboy
b9bac79a8c
Improved const correctness, there are no functional changes.
2017-05-12 16:20:47 +02:00
PKEuS
68d77b73da
SymbolDatabase: Fixed parsing of unnamed arguments, properly detect pointers ( #8052 )
2017-05-07 09:03:58 +02:00
PKEuS
28b8bc57a8
CheckVaarg::va_list_usage(): Bailout on "goto" ( #8043 )
2017-05-07 08:32:48 +02:00
PKEuS
b345c430fe
CheckStl::readingEmptyStlContainer(): Skip over lambdas ( #8055 )
2017-05-07 08:15:58 +02:00
Alexander Mai
c1cdcc158f
Run astyle. Fix some Doxygen issues
2017-05-06 11:57:02 +02:00
amai2012
3e11eb9dca
#8050 cppcheckError: 0xFFFFFFul -> 16777215ULU. Don't add a suffix 'U' if there is already a suffix present.
2017-05-05 14:47:58 +02:00
Daniel Marjamäki
a8a54bbfa8
Fixed #6028 (Improvement: False positive caused by C keywords in assembly comments)
2017-05-05 08:57:24 +02:00
Daniel Marjamäki
65297ce285
Fixed #7191 (false positive memleak on in-place new)
2017-05-04 19:39:57 +02:00
Alexander Mai
f54a6f085b
#7883 hang: CheckOther::checkFuncArgNamesDifferent() template code in .h. Activate language check for header files + Small refactoring
2017-05-03 20:36:26 +02:00
Daniel Marjamäki
1ec9b8c5b4
Fixed #8047 (false positive uninitialized variable - sizeof **A)
2017-05-03 19:27:55 +02:00
Alexander Mai
e88b4dcf06
Add another check to Tokenizer::validateC(): C++ casts
2017-05-03 16:57:42 +02:00
Matthias Krüger
a28f57344c
templatesimplifier: mark getTemplateNamePositionTemplateMember() static.
...
Fixes gcc 7-dev warning:
lib/templatesimplifier.cpp: In function ‘bool getTemplateNamePositionTemplateMember(const Token*, int&)’:
lib/templatesimplifier.cpp:715:6: warning: no previous declaration for ‘bool getTemplateNamePositionTemplateMember(const Token*, int&)’ [-Wmissing-declarations]
bool getTemplateNamePositionTemplateMember(const Token *tok, int &namepos)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-05-03 08:45:48 +02:00
Daniel Marjamäki
295e4fdfc2
Fixed #8049 (Preprocessor: Comment in system include not removed properly)
2017-05-02 22:18:24 +02:00
Alexander Mai
1bc7a89b3c
Improve search patterns within Tokenizer::validateC()
2017-05-02 17:57:06 +02:00
Robert Reif
e2bfe1c0ec
Fixed #8044 : Crash below SymbolDatabase::setValueType
2017-05-01 14:12:50 -04:00
Matthias Krüger
cee0f724ff
Fixed #8018 : Tokenize::findGarbageCode: detect heads of for-loops with 1 or more than 2 semicolons as garbage code.
2017-05-01 18:28:26 +02:00
Daniel Marjamäki
bc7799dccd
Fixed #7888 (false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))
2017-05-01 12:23:28 +02:00
Daniel Marjamäki
f51a709f80
add fixme comment
2017-05-01 11:25:58 +02:00
Daniel Marjamäki
ce6cc5416a
uninitvar: made ValueFlow check experimental
2017-05-01 11:13:30 +02:00
Daniel Marjamäki
9cdda53fb9
CheckFunctions::memsetZeroBytes: Add CHECK_WRONG_DATA to avoid crashes
2017-04-30 18:58:51 +02:00
Daniel Marjamäki
8a08cc0796
Fixed #8029 (Tokenizer::simplifyCAlternativeTokens: dont simplify 'eb.and + 1')
2017-04-30 14:40:41 +02:00
Daniel Marjamäki
7fd04cd8d0
Updated Token::expressionString(), write '->' instead of '.'
2017-04-30 14:22:18 +02:00
Simon Martin
28960a8bba
Remove bailout and fix varid for template class member initialized in out-of-line constructor ( #8031 )
2017-04-30 08:59:47 +02:00
IOBYTE
8a668aa860
Add missing else that could cause an extra try scope to be added to the scope list ( #8025 )
...
Add an optional extended description…
2017-04-30 08:58:41 +02:00
Daniel Marjamäki
980ca39fe2
valueFlowForward: better handling of sizeof() in rhs in assignments
2017-04-29 08:25:55 +02:00
Garrett Bodily
ddfd4c6348
Write access type of functions and variables to xml dump
2017-04-29 07:18:16 +02:00
Robert Reif
964b744c96
Fixed #7990 (crash: SymbolDatabase::printOut())
2017-04-29 07:02:49 +02:00
Daniel Marjamäki
06102cb3d7
UninitVar: Don't warn for inconclusive values
2017-04-28 21:09:56 +02:00
Daniel Marjamäki
a0a8f8ddd6
ValueFlowUninit: make it more strict
2017-04-28 13:29:09 +02:00
Daniel Marjamäki
5fd77d2518
Switch CHECK_WRONG_DATA macro so crashes/hangs are avoided
2017-04-28 10:48:41 +02:00
Daniel Marjamäki
589fabd0b1
Fixed #8027 (hang after AST_MAX_DEPTH is exceeded in array initialization)
2017-04-27 20:53:27 +02:00
Daniel Marjamäki
d9f72d5f8c
AST: Handle 'x = { [ID] = 1, .. }' when ID is unexpanded macro
2017-04-26 22:35:04 +02:00
Daniel Marjamäki
bdf16b1157
Tokenizer::simplifyComma: dont simplify comma in '=(struct s){...}'
2017-04-26 20:48:08 +02:00
Daniel Marjamäki
89532cf8b9
Fixed #7968 (valueFlowBeforeCondition: better handling of compound assignments)
2017-04-25 20:45:02 +02:00
orbitcowboy
537045b176
Improved const correctness. There are no functional changes.
2017-04-25 14:57:48 +02:00
Daniel Marjamäki
140e086206
Fixed #7738 (False positive deallocret - delete and return NULL pointer)
2017-04-24 22:05:16 +02:00
Daniel Marjamäki
37fd60e879
Fixed #7293 (Use of uninitialized pointer not detected (worked in 1.71))
2017-04-24 18:27:16 +02:00
Daniel Marjamäki
9a294496c1
ValueFlow::setTokenValue: Fix typo
2017-04-23 21:59:58 +02:00
Daniel Marjamäki
a688402617
ValueFlow::setTokenValue: Don't calculate parent value for uninitialized values
2017-04-23 21:58:01 +02:00
Daniel Marjamäki
2f51b975ed
valueFlowUninit: only check variables
2017-04-23 21:50:51 +02:00
Daniel Marjamäki
25a1ea3d18
use simpleMatch for simple pattern
2017-04-23 19:25:35 +02:00
Daniel Marjamäki
8a738eefab
fixed #7998 (uninitialized variable is not found when used with switch/case)
2017-04-23 18:05:14 +02:00
Daniel Marjamäki
3f069d9e44
Write two FIXME comments, create library configuration to replace hardcoded checks
2017-04-23 15:34:45 +02:00
Daniel Marjamäki
198c8878ee
Use Token::simpleMatch() for simple pattern
2017-04-23 12:14:14 +02:00
Daniel Marjamäki
f2719ec6ca
Refactoring CheckString::sprintfOverlappingData. Use AST, isSameExpression(), getArguments(), ..
2017-04-23 10:51:31 +02:00
Daniel Marjamäki
f92ef7d8e2
Refactoring. Use 'endsWith()'
2017-04-23 10:17:35 +02:00
Daniel Marjamäki
101dc28afa
Refactoring: Moved checkMemset.. from CheckOther to CheckFunctions
2017-04-23 07:53:41 +02:00
Daniel Marjamäki
f6ab204dc6
Refactorings in CheckOther
2017-04-23 07:19:44 +02:00
Daniel Marjamäki
f601a6903f
Updated comment
2017-04-23 06:44:38 +02:00
Matthias Krüger
2744a9456f
fix [lib/checkfunctions.cpp:300]: (warning) Found simple pattern inside Token::Match() call: "new"
2017-04-22 21:53:31 +02:00
Daniel Marjamäki
e5b9e2a898
--check-library: less warnings
2017-04-22 21:23:46 +02:00
Daniel Marjamäki
e72ec4282d
Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well)
2017-04-22 12:44:57 +02:00
Daniel Marjamäki
1039c710e4
Fixed #8017 (AST: wrong ast for extra comma 's={1,}')
2017-04-22 11:23:11 +02:00
Daniel Marjamäki
7140bae226
Merge pull request #894 from simartin/ticket_7964
...
Ticket #7964 : Don't crash on valid code using function pointers named strcpy or strcat in main()
2017-04-22 01:24:03 +02:00
Simon Martin
b526fd7c49
Ticket #7964 : Don't crash on valid code using function pointers named strcpy or strcat in main().
2017-04-21 23:36:10 +02:00
Daniel Marjamäki
43454936e7
Fixed #8014 (FP: Uninitialized variable 'f(1,{..});')
2017-04-21 22:33:27 +02:00
Robert Reif
78ad9825af
Add support for auto variables in regular for loop.
2017-04-21 15:25:02 -04:00
Daniel Marjamäki
e827119856
Fix testrunner InternalError
2017-04-21 21:02:46 +02:00
Daniel Marjamäki
902eb87a8a
Fixed #8016 (AST: wrong ast for 'x=(s){...};')
2017-04-21 17:44:11 +02:00
Daniel Marjamäki
eec8c77774
Merge pull request #892 from IOBYTE/master
...
Add support for auto variable initialized from function return type.
2017-04-20 22:17:23 +02:00
Daniel Marjamäki
f8e9071de1
CheckFunction: In the <valid> check handle possible/conditional/inconclusive values better
2017-04-20 22:14:54 +02:00
Robert Reif
0ff8e49b69
Add support for auto variable initialized from function return type.
2017-04-20 15:22:57 -04:00
Daniel Marjamäki
95dd16892b
Merge pull request #891 from IOBYTE/master
...
Fix #7963 : crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTra…
2017-04-20 20:51:40 +02:00
Daniel Marjamäki
3fbcc0cd3b
Refactor CheckFunctions::invalidFunctionUsage
2017-04-20 19:57:39 +02:00
Daniel Marjamäki
e43c078c5e
checkfunctions: code cleanup
2017-04-20 17:42:25 +02:00
Robert Reif
69d18d9c29
Fix #7963 : crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTransformFeedback.cpp
2017-04-20 10:03:29 -04:00
Daniel Marjamäki
7a26e046a8
Fixed #8001 (AST: Wrong AST for lambda function with 'std::string const&' result type)
2017-04-18 21:21:30 +02:00
Daniel Marjamäki
0edb0dbf3c
Fix redundant assignment found by Cppcheck
2017-04-17 22:33:15 +02:00
Daniel Marjamäki
d911eeba75
astyle formatting
...
[ci skip]
2017-04-17 22:16:02 +02:00
Daniel Marjamäki
1a95dc9bd6
Fixed #7979 (Tokenizer: Detect and reject c++ code in .c file)
2017-04-17 22:15:29 +02:00
Daniel Marjamäki
bb015c6a2b
Fixed #8006 (AST: Wrong tree with complex for loops and casts)
2017-04-17 21:11:53 +02:00
Simon Martin
5fd686c878
Ticket #4544 : Also handle Foo<struct Bar> constructs.
2017-04-17 11:24:28 +02:00
Daniel Marjamäki
4f64e67298
Misra: Add rule 8.11
2017-04-17 07:45:27 +02:00
Daniel Marjamäki
1045ece946
dump: refactor valueType dump
2017-04-16 09:11:20 +02:00
Daniel Marjamäki
f90d8c9987
dump: fix xml format
2017-04-15 14:03:49 +02:00
Daniel Marjamäki
b3b0a796b9
dump: fix xml format
2017-04-15 12:38:00 +02:00
Daniel Marjamäki
e71b428740
dump: Add platform info and valueType info
2017-04-15 12:25:44 +02:00
Daniel Marjamäki
174bcc8d34
Misra: Add rule 16.3
2017-04-14 10:46:35 +02:00
Daniel Marjamäki
d252a64ec8
Cleanup CheckFunctions::checkIgnoredReturnValue
2017-04-12 10:44:08 +02:00
Daniel Marjamäki
41a64f6d1f
Fix crash
2017-04-11 20:16:33 +02:00
PKEuS
b1f4bd7504
Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set ( #7995 )
2017-04-11 11:49:26 +02:00
Daniel Marjamäki
4d1a64301c
AST: Fixed Match pattern '|*' => '*|'
2017-04-10 23:44:30 +02:00
Daniel Marjamäki
632a6b664c
AST: Harden handling of C++11
2017-04-10 23:29:15 +02:00
Daniel Marjamäki
2c43075ece
AST: weird clang syntax
2017-04-10 23:05:41 +02:00
Daniel Marjamäki
df90ff9f5e
Merge pull request #888 from simartin/ticket_7942
...
Don't generate invalid syntax for out of line template class constructors during instantiation
2017-04-10 22:18:20 +02:00
Daniel Marjamäki
5e1b6aee8c
AST: Fix hang for weird VLA code
2017-04-10 22:17:34 +02:00
Daniel Marjamäki
ffeadbdde4
AST: improved handling for struct initialization 's = { [0] = 123 }'
2017-04-10 07:25:18 +02:00
Daniel Marjamäki
d92c529aa6
AST: Fix wrong handling of struct initialization, caused hang
2017-04-09 22:06:13 +02:00
Daniel Marjamäki
45d2d66df3
Remove redundant space in Token::Match pattern
2017-04-09 19:27:11 +02:00
Daniel Marjamäki
e6005dfa3c
AST: Fix AST for lambda '[&]{..}'
2017-04-09 17:49:55 +02:00
Matthias Krüger
7d12e1f3a6
valueFlowGetArrayIndexes: convert Token::Match to Token::simpleMatch.
...
The pattern is a sole "[", but since "[" is also used for complexe patterns, the internal check that finds potential simple match patterns bailed out here.
2017-04-09 17:27:46 +02:00
Simon Martin
ee05fe7d77
Ticket #7942 : Don't generate invalid syntax for out of line template class constructors during instantiation.
2017-04-09 16:12:59 +02:00
Daniel Marjamäki
6e0af5d01f
MISRA 19 and 28
2017-04-09 10:11:54 +02:00
Robert Reif
bcf0c5f010
Add ValueType and auto type information to debug output.
...
Print out ValueType for variables and function return type.
Print out complete type for variables and function return type.
Print out ValueType for variable auto token.
2017-04-07 19:57:10 -04:00
Daniel Marjamäki
f5f141ff42
astyle formatting
...
[ci skip]
2017-04-07 19:19:41 +02:00
Daniel Marjamäki
8ffed6862d
Tokenizer: Add --check-config warning for macro with semicolon in argument
2017-04-07 19:19:10 +02:00
Daniel Marjamäki
7d8af7bdca
Fixed #7979 (crash (nr 2): CheckFunctions::checkIgnoredReturnValue())
2017-04-07 13:18:53 +02:00
Daniel Marjamäki
392a06a44b
AST: better handling of '(struct X){...}'
2017-04-06 21:28:13 +02:00
Daniel Marjamäki
70a7915173
CppCheck: Improve output when first configuration is not empty.
2017-04-06 19:52:21 +02:00
Daniel Marjamäki
50da7d4919
Tokenizer: Write syntax error if there is C++ code in C file.
2017-04-06 08:50:35 +02:00
Daniel Marjamäki
fd2651909c
Fixed #7978 (ValueType: container type not set properly)
2017-04-06 07:07:20 +02:00
Daniel Marjamäki
fee86b9684
ValueType: Better handling of 'new Container'
2017-04-05 22:05:29 +02:00
PKEuS
47570f5791
Set version to 1.78.99/1.79 dev
2017-04-05 11:24:26 +02:00
Daniel Marjamäki
e6ed08c4d8
Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression))
2017-04-05 11:00:02 +02:00
Daniel Marjamäki
9c5a136f04
Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>)
2017-04-03 21:48:22 +02:00
Matthias Krüger
79010eecea
lib: fix a bunch of warnings about differing function arguments in definition and declaration.
...
[lib/token.h:72] -> [lib/token.cpp:36]: (style, inconclusive) Function 'Token' argument 1 names different: declaration 'tokensBack' definition 't'.
[lib/token.h:445] -> [lib/token.cpp:497]: (style, inconclusive) Function 'multiCompare' argument 1 names different: declaration 'needle' definition 'tok'.
[lib/checkio.h:73] -> [lib/checkio.cpp:1385]: (style, inconclusive) Function 'ArgumentInfo' argument 3 names different: declaration 'isCPP' definition '_isCPP'.
[lib/checkother.h:216] -> [lib/checkother.cpp:2136]: (style, inconclusive) Function 'checkComparisonFunctionIsAlwaysTrueOrFalseError' argument 2 names different: declaration 'strFunctionName' definition 'functionName'.
[lib/errorlogger.h:214] -> [lib/errorlogger.cpp:51]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
[lib/errorlogger.h:215] -> [lib/errorlogger.cpp:65]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
[lib/library.h:327] -> [lib/library.cpp:1043]: (style, inconclusive) Function 'ignorefunction' argument 1 names different: declaration 'function' definition 'functionName'.
[lib/mathlib.h:112] -> [lib/mathlib.cpp:1275]: (style, inconclusive) Function 'isNullValue' argument 1 names different: declaration 'tok' definition 'str'.
[lib/preprocessor.h:91] -> [lib/preprocessor.cpp:122]: (style, inconclusive) Function 'setDirectives' argument 1 names different: declaration 'tokens' definition 'tokens1'.
[lib/symboldatabase.h:860] -> [lib/symboldatabase.cpp:1801]: (style, inconclusive) Function 'argsMatch' argument 1 names different: declaration 'info' definition 'scope'.
[lib/symboldatabase.h:1171] -> [lib/symboldatabase.cpp:2048]: (style, inconclusive) Function 'addClassFunction' argument 1 names different: declaration 'info' definition 'scope'.
[lib/symboldatabase.h:1174] -> [lib/symboldatabase.cpp:2208]: (style, inconclusive) Function 'addNewFunction' argument 1 names different: declaration 'info' definition 'scope'.
[lib/symboldatabase.h:1090] -> [lib/symboldatabase.cpp:3648]: (style, inconclusive) Function 'findVariableType' argument 2 names different: declaration 'type' definition 'typeTok'.
[lib/symboldatabase.h:1101] -> [lib/symboldatabase.cpp:4308]: (style, inconclusive) Function 'findType' argument 1 names different: declaration 'tok' definition 'startTok'.
[lib/symboldatabase.h:1176] -> [lib/symboldatabase.cpp:4349]: (style, inconclusive) Function 'findTypeInNested' argument 1 names different: declaration 'tok' definition 'startTok'.
[lib/symboldatabase.h:1193] -> [lib/symboldatabase.cpp:4501]: (style, inconclusive) Function 'setValueType' argument 2 names different: declaration 'enumerators' definition 'enumerator'.
[lib/path.h:159] -> [lib/path.cpp:247]: (style, inconclusive) Function 'isCPP' argument 1 names different: declaration 'extensionInLowerCase' definition 'path'.
[lib/path.h:145] -> [lib/path.cpp:266]: (style, inconclusive) Function 'acceptFile' argument 1 names different: declaration 'filename' definition 'path'.
2017-04-03 00:06:46 +02:00
Daniel Marjamäki
abb43b6a81
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-04-02 19:44:33 +02:00
Daniel Marjamäki
de80d41ef4
CheckFunctions::checkIgnoredReturnValue: Dont warn in C++11 initializer lists in function arguments
2017-04-02 19:44:27 +02:00
Daniel Marjamäki
6f2db1a312
CHECK_WRONG_DATA: restore debug macro so crashes are seen.
2017-04-02 17:23:30 +02:00
Daniel Marjamäki
d403a6a883
Preprocessor::getConfigs: Remove bad configurations when #error is seen
2017-04-02 12:15:53 +02:00
Daniel Marjamäki
7eb95aac2a
Preprocessor::getConfigs: Handle #error in '#if !A' better
2017-04-02 10:06:39 +02:00
Daniel Marjamäki
87bc667289
astyle formatting
...
[ci skip]
2017-04-02 09:26:14 +02:00
Daniel Marjamäki
edd1c32e5b
Preprocessor::getConfigs: Better handling of ! in #if
2017-04-02 09:03:43 +02:00
Daniel Marjamäki
b7dcdc00d0
Fixed #7970 (ValueType: no types set below 'new std::string')
2017-04-01 22:22:37 +02:00
Daniel Marjamäki
1faca91c1d
Added 'endsWith' utility function. This will make compiling the democlient easier.
2017-04-01 18:14:18 +02:00
Daniel Marjamäki
2eda59eb72
Update version
2017-04-01 11:03:45 +02:00
Daniel Marjamäki
1dbf485e02
Fix Cppcheck warnings. Remove redundant null pointer check.
2017-04-01 10:51:45 +02:00
Daniel Marjamäki
279b66003b
Fix Cppcheck warnings about mismatching argument names
2017-04-01 10:34:53 +02:00
PKEuS
ea215c3b7b
Fixed false positives in CheckClass::checkConst() due to unmatched function overloads
...
Fixed function matching if constness mismatches
2017-04-01 10:19:32 +02:00
Daniel Marjamäki
633ed23c0d
Fix Cppcheck warnings about mismatching function argument names
2017-04-01 09:31:27 +02:00
Roberto Martelloni
35d1479d05
CWE mapping of funcArgOrderDifferent, funcArgNamesDifferent ( #885 )
...
Add an optional extended description…
2017-04-01 08:36:46 +02:00
Daniel Marjamäki
164df2aa7b
Fixed #7966 (ValueType: wrong type for gcc initialization {[1]=..})
2017-03-31 09:41:38 +02:00
Daniel Marjamäki
8fe7ee1012
Fixed #7886 (ValueFlow: endless forloop 'for (i = 0, j = 0; i < sz && j < 9; i++)')
2017-03-30 22:02:36 +02:00
Daniel Marjamäki
a8788d7fc7
Fix Cppcheck warning
2017-03-30 11:20:04 +02:00
Daniel Marjamäki
2da3123db2
Fix ValueType. The '[' in variable declaration is not a dereference.
2017-03-30 11:01:29 +02:00
Daniel Marjamäki
cc3ef7bbe8
Fix so array access out of bounds for external arrays are detected again
2017-03-30 10:14:17 +02:00
IOBYTE
7cae057615
Add missing varid or variable for member variables.
...
Add an optional extended description…
2017-03-30 10:07:58 +02:00
Daniel Marjamäki
c9eb7f4556
minor update of 64-bit checker
2017-03-30 10:07:25 +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
2938278f00
Refactorization: Store minsizes in vector instead of list which has less overhead
2017-03-27 17:53:43 +02:00
PKEuS
63d39390b4
checkbufferoverrun.cpp: refactorizations
2017-03-27 16:09:51 +02:00
PKEuS
83b1e1c329
CheckBufferOverrun: Refactorizations
...
- Improved/Optimized conditions in checkBufferAllocatedWithStrlen()
- Avoid copying strings for checkScope()
2017-03-27 11:48:34 +02:00
PKEuS
680828788b
Fixed false negative in CheckBufferOverrun::checkInsecureCmdLineArgs(), removed redundant tests
2017-03-27 11:30:07 +02:00
PKEuS
171e1b8244
Fixed false negatives in CheckBufferOverrun::arrayIndexThenCheck()
2017-03-27 11:07:49 +02:00
Daniel Marjamäki
62d4077dd0
Fix Cppcheck warning
2017-03-26 11:40:53 +02:00
Daniel Marjamäki
6874f27e73
Added CHECK_WRONG_DATA() that can be used to avoid crashes/hangs in release binaries
2017-03-26 11:23:39 +02:00
Daniel Marjamäki
4a1c04cb33
Preprocessor: Removed redundant initialization
2017-03-26 11:10:48 +02:00
Robert Reif
c96e8daebc
Don't change varid of member variables.
2017-03-25 10:59:35 -04:00
Daniel Marjamäki
f5d56fd303
Fixed #7961 (Hang in CheckOther::checkFuncArgNamesDifferent)
2017-03-24 22:01:05 +01:00
Daniel Marjamäki
5fb0f46a3a
ValueType: Hide assignment operator
2017-03-24 13:38:45 +01:00
PKEuS
f4c0ab5dd5
SymbolDatabase: Match function overloads by using ValueType information by running a second pass of the function pointer assignment routine.
2017-03-24 12:19:29 +01:00
Alexander Alekseev
abba762d42
New check: checking for copy ctor and eq operator co-existence
2017-03-24 12:00:20 +01:00
Robert Reif
bc87e874e9
Add variable and type information for auto and auto variables in range based for loops of containers.
2017-03-23 20:14:49 -04:00
Robert Reif
7adfb6e0e4
Add variable and type information to tokens for C array range based for loops.
2017-03-23 19:48:20 -04:00
PKEuS
97fa9e9d1b
ValueFlow: Stop on inline assembly
2017-03-23 20:01:16 +01:00
PKEuS
9225bff31d
Added (back) support for enums to CheckCondition::checkIncorrectLogicOperator() ( #7794 )
2017-03-23 18:57:48 +01:00
PKEuS
996501a449
Fixed false positive #7953 : Support type conversion operators returning pointers
2017-03-23 18:12:46 +01:00
Daniel Marjamäki
c280bcedb4
Merge pull request #880 from IOBYTE/master
...
Update symbol database with new auto type and variable information for assignment to auto.
2017-03-23 08:51:06 +01:00
Robert Reif
662bc6f846
Add variable or type information to auto and auto variable tokens. Changing the auto variable type requires rerunning the variable pointer pass to correct the symbol database for the new type.
2017-03-22 22:09:40 -04:00
Robert Reif
fda1f02dab
long double is a floating point type.
2017-03-22 19:11:40 -04:00
Daniel Marjamäki
865588950a
Preprocessor: quick fix for #7939
2017-03-22 10:53:21 +01:00
Robert Reif
f099c6a110
Refactor symbol database value type support by making setValueTypeInTokenList and setValueType member functions of SymbolDatabase. Class variables are no longer passed around as parameters but accessed directly which simplifies the code. There should be no functional change.
2017-03-21 21:55:22 -04:00
orbitcowboy
a7f1188151
Astyle run.
2017-03-21 14:22:28 +01:00
Simon Martin
fb2b29dc7d
Update TemplateSimplifier::getTemplateNamePosition to handle out-of-line template methods.
...
Add an optional extended description…
2017-03-19 20:44:20 +01:00
Daniel Marjamäki
c18fe8262b
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-03-19 07:26:11 +01:00
PKEuS
7c0aa4464c
Fixed travis build by replacing Token::Match by simpleMatch()
...
Added missing files to cppcheck.vcxproj.filters
2017-03-16 21:15:10 +01:00
PKEuS
8a3fb4dd6c
SymbolDatabase: Fixed return type token detection for template member functions ( #7945 )
2017-03-16 20:47:24 +01:00
PKEuS
ca3e3b3cdb
Fixed false positive multiCondition when & is used in both conditions ( #7827 )
2017-03-15 19:37:14 +01:00
PKEuS
c638180753
Fixed crash in clang test suite introduced in b27ba72fdd
2017-03-15 19:22:42 +01:00
PKEuS
816106560a
More conservative check for non-commutative operator+ in isSameExpression() ( #7938 )
2017-03-15 19:17:40 +01:00
PKEuS
bcba27fbb9
SymbolDatabase: Removed unnecessary bailout in function matching for pointers in function overload matching
2017-03-15 18:45:33 +01:00
PKEuS
b27ba72fdd
SymbolDatabase: Support function overload matching for member variables ( #7932 )
2017-03-15 18:37:22 +01:00
PKEuS
92414b923a
Library: Support variadic functions which are not a formatstr-function
2017-03-14 17:41:34 +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
8c707876ed
Tokenizer: Don't simplify '({..})' wrongly
2017-03-08 11:41:18 +01:00
Daniel Marjamäki
5d7fa590af
Don't check ignored function return value in ({..}). Ticket: #7934
2017-03-08 10:23:38 +01:00
PKEuS
00904ba32a
Fixed false negatives in CheckOther::checkPassByReference() when assignment operator is used.
2017-03-07 21:49:28 +01:00
PKEuS
3da1de7893
Do not exclude std::shared_ptr and std::unique_ptr from checkPassByReference() ( #7834 )
...
These two types are larger than one pointer. Hence, passing by reference is faster.
2017-03-07 21:18:08 +01:00
PKEuS
1c3f010935
Fixed false positive: Exclude STL shared pointers from checkPassByReference() ( #7834 )
2017-03-07 21:04:19 +01:00
Daniel Marjamäki
5ea9519586
UseRetVal: Fix FN for methods
2017-03-05 22:23:16 +01:00
Daniel Marjamäki
2daf7f5430
Merge pull request #874 from simartin/ticket_7912
...
Ticket #7912 : Properly preprocess files with decreasing line numbers, due to #line directives
2017-03-05 20:33:53 +01:00
Daniel Marjamäki
e560ad1616
update std::string config
2017-03-05 18:19:49 +01:00
Simon Martin
43e4364675
Ticket #7912 : Properly preprocess files with decreasing line numbers, due to #line directives.
2017-03-05 16:46:43 +01:00
Daniel Marjamäki
6c1096bf71
ValueType: First change to handle 'for (auto i : container)'
2017-03-05 15:40:29 +01:00
Daniel Marjamäki
ab7cf5d215
ValueType: set ValueType for method that returns iterator
2017-03-05 14:53:32 +01:00
Daniel Marjamäki
fa7501d3a5
ValueType: stl variables should now be handled
2017-03-05 10:33:17 +01:00
Daniel Marjamäki
f3c0461001
ValueType: handling scoped types in 'new ...'
2017-03-05 10:24:51 +01:00
Daniel Marjamäki
e0dd0a82ed
ValueType: refactor and improve handling of 'new ...'
2017-03-05 10:02:47 +01:00
Robert Reif
e02b2c4483
ValueType: handle new nothrow
2017-03-05 02:13:00 +01:00
Daniel Marjamäki
115ea08544
ValueType: Allow that type is library-container
2017-03-05 02:09:52 +01:00
Daniel Marjamäki
c832b2f40b
ValueType: Fixed bug
2017-03-05 01:39:56 +01:00
Daniel Marjamäki
920398615d
ValueType: handle scoped types in parsedecl
2017-03-05 01:21:02 +01:00
Daniel Marjamäki
2f2ac46243
Replaced hardcoding for char16_t and char32_t with configuration
2017-03-04 16:30:42 +01:00
Daniel Marjamäki
12fe4a8b3e
Fixed #7885 (ValueType: Wrong type for large hexvalue (platform=win32A))
2017-03-04 14:19:14 +01:00
Daniel Marjamäki
ecc59859e1
Don't simplify _Bool in TokenList
2017-03-04 11:13:28 +01:00
Daniel Marjamäki
f0c353abcb
TokenList: append 'U' if needed on hexvalues
2017-03-04 08:47:53 +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
b1ce229006
Small refactoring
2017-03-03 19:09:32 +01:00
Daniel Marjamäki
59c1c76a97
Fixed #7466 (Reference variable does not count side-effects (FP variableScope))
2017-03-03 19:07:00 +01:00
Daniel Marjamäki
b5f2fd3c55
Fixed #7738 (False positive deallocret - delete and return NULL pointer)
2017-03-03 18:36:06 +01:00
Daniel Marjamäki
d1c66edb03
ValueFlow: Known values in conditional code
2017-03-03 01:29:34 +01:00
Daniel Marjamäki
45c5860ca4
Fixed #7926 (Memory Leak with auto not detected)
2017-03-02 22:24:26 +01:00
Daniel Marjamäki
9dc219f1ba
CheckIO: Use ValueType more
2017-03-01 22:33:31 +01:00
Daniel Marjamäki
995d875cb2
SymbolDatabase: Refactoring
2017-03-01 18:09:50 +01:00
Daniel Marjamäki
51b5f1c286
Fixed #7931 (crash: SymbolDatabase: Variable::setFlag)
2017-03-01 17:13:22 +01:00
PKEuS
7eee6af4ce
Fixed broken condition
2017-03-01 11:42:14 +01:00
PKEuS
2f0db369f0
Refactorization: Avoid construction of empty strings by using emptyString
2017-03-01 10:50:50 +01:00
PKEuS
d501e488ca
Refactorization: Reordered conditions in Scope::findFunction()
2017-03-01 10:27:01 +01:00
Daniel Marjamäki
279425499e
Fixed #7930 (Improve check: Missing stlcstr warning for reference variable)
2017-03-01 02:03:08 +01:00
PKEuS
85768f1829
SymbolDatabase: Overload matching with boolean literals as argument and with arbitrary null-pointers
2017-02-28 22:43:47 +01:00
PKEuS
942644fde6
SymbolDatabase: Overload matching with character literals as argument
2017-02-28 22:08:41 +01:00
Daniel Marjamäki
841e0c2921
Fixed #7546 (Assignment to array element not detected if pointer addition is used)
2017-02-28 22:04:05 +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
Ville Skyttä
2ccd5aec1a
Comment spelling fixes
...
Add an optional extended description…
2017-02-28 12:22:59 +01:00
Daniel Marjamäki
beaf29c158
SymbolDatabase: Update some properties for auto variables
2017-02-27 23:04:25 +01:00
Daniel Marjamäki
994f6b684d
ValueType: initial handling of new
2017-02-27 20:57:28 +01:00
Matthias Krüger
ce3bc006e7
fix build with -DMAXTIME=123
2017-02-27 14:00:06 +01:00
Matthias Krüger
35e7697474
switch some functions from const to static, as cppcheck suggests.
2017-02-27 13:51:33 +01:00
PKEuS
900d05d9dd
Optimization: Do not attempt to find a matching function for if, for, while, etc.
2017-02-27 10:35:47 +01:00
Daniel Marjamäki
7ecd5db8fb
ValueType: Handle auto in range for loop
2017-02-27 02:09:33 +01:00
Daniel Marjamäki
2da360eec5
ValueType: Handle 'auto *p = ..'
2017-02-26 22:43:10 +01:00
Daniel Marjamäki
dad455c0dd
ValueType: Handle 'auto'. First fix for #4345
2017-02-26 20:02:57 +01:00
Daniel Marjamäki
d840005f06
Fixed #7656 (stlcstr - false positive)
2017-02-26 17:25:32 +01:00
Daniel Marjamäki
f68fa72095
Fixed #7583 (Defect: False positive '(error) Reference to temporary returned')
2017-02-26 13:41:49 +01:00
PKEuS
c1d8fd7f13
SymbolDatabase: Better handling of pointers in findFunction(), supporting const pointers and std::string overloads
2017-02-26 11:36:04 +01:00
PKEuS
4a27376694
SymbolDatabase: Implement two-stage fallback mechanism for matching function overloads, increasing matching accuracy
2017-02-25 23:12:00 +01:00
Daniel Marjamäki
adc659f58b
Fixed #7897 (MathLib::toDoubleValue: Does not handle character literal)
2017-02-25 21:58:09 +01:00
Daniel Marjamäki
26fc7abfac
Fixed #7837 (Field dereference triggers format string type warning)
2017-02-25 18:22:14 +01:00
Daniel Marjamäki
2e91858640
Fixed #7877 (Tokenizer: Does not clear ValueFlow after first pass)
2017-02-25 17:57:39 +01:00
Daniel Marjamäki
55d7ab65b9
Fixed #7918 (::exit() not recognized as noreturn)
2017-02-25 12:12:39 +01:00
Daniel Marjamäki
99544069d1
CheckLeakAutoVar: better handling of noreturn functions. Partial fix for #7918 .
2017-02-25 11:36:48 +01:00
PKEuS
3f1e2b4270
More conservative fallback for function overload matching
2017-02-24 20:56:47 +01:00
PKEuS
4e28d40bf0
Fixed matching long long overload to function call f(0)
2017-02-24 20:33:52 +01:00
PKEuS
de86d40c97
Fixed handling of NULL and nullptr in CheckNullPointer
2017-02-24 19:44:28 +01:00
PKEuS
b08f99a082
Fixed false negative: nullpointer passed as std::string argument ( #7927 )
...
Refactorization: Removed dead code from CheckNullPointer::parseFunctionCall()
2017-02-24 19:10:34 +01:00
Daniel Marjamäki
a53f14da25
Fixed #7925 (False Positive identical condition)
2017-02-22 21:13:36 +01:00
Robert Reif
8e0f1ec788
Fixed #7909 (Crash in CheckMemoryLeakInClass)
2017-02-20 23:09:35 +01:00
Simon Martin
487f76cdd1
Ticket #7916 : Don't incorrectly simplify return statements involving template instantiations.
2017-02-18 21:14:50 +01:00
Daniel Marjamäki
774a8979a3
Fixed #7095 (False positive: (warning) Return value of function to_string() is not used.)
2017-02-12 16:50:45 +01:00
Daniel Marjamäki
7c800d6ed7
Fixed #7447 (FP: ignoredReturnValue on C++11 uniform initialization)
2017-02-12 16:33:28 +01:00
Simon Martin
326d152aa2
Ticket #7914 : Properly recognize template parameters that contains operators. ( #870 )
2017-02-11 10:13:41 +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
Simon Martin
0943b2145b
Ticket #7891 : Do not remove spaces in the internal representation for template instantiations.
2017-02-05 17:35:29 +01:00
Matthias Krüger
92d9e810f3
templatesimplifier: remove redundant assignments inside switchcase. They will always be overwritten by an assignment outside of the switch near the end of the function. Found by clang analyzer.
2017-01-30 22:26:54 +01:00
Simon Martin
5262ed018e
Ticket #7440 : Function calls should not abort pointer alias analysis for local variables.
2017-01-27 22:56:28 +01:00
umanamente
a012e5b5fb
( Fixed #7846 ) Syntax error when using C++11 braced-initializer in function last argument
...
Add an optional extended description…
2017-01-23 12:50:36 +01:00
umanamente
2f609c2b9a
Added cppcheck.natvis file for human readable debug information in Visual Studio.
...
Add an optional extended description…
2017-01-22 10:21:29 +01:00
umanamente
0c1ba8e8b4
( Fixed #7895 ) C++11 brace initialization. Added test. ( #862 )
...
Add an optional extended description…
2017-01-22 10:16:40 +01:00
PKEuS
3022d74801
Do not suggest pass by reference for std::initializer_list
2017-01-19 11:14:55 +01:00
amai2012
722fac391d
Merge pull request #858 from simartin/ticket_7820
...
Ticket #7820 : Properly report leaks with conditional deallocations followed by a return.
2017-01-18 09:31:49 +01:00
Simon Martin
9e76b21d7f
Ticket #7820 : Properly report leaks with conditional deallocations followed by a return.
2017-01-17 23:02:39 +01:00
orbitcowboy
6c71d74563
Cleanup: There is no need to clear a string directly after its creation.
2017-01-16 20:10:28 +01:00
Simon Martin
ae939b1385
Teach CheckMemoryLeak about "alloc ; loop alloc ;" kinds of patterns. ( #861 )
...
Add an optional extended description…
2017-01-15 22:16:23 +01:00
Simon Martin
c82d8a0d06
Ticket #7745 : Simplify "alloc ; dealloc ;" blocks that we don't have any value for CheckMemoryLeak's analysis. ( #860 )
...
Add an optional extended description…
2017-01-15 22:14:37 +01:00
Daniel Marjamäki
47d39d0a14
Revert "Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))"
...
This reverts commit a762511067
.
2017-01-10 13:22:48 +01:00
Daniel Marjamäki
7bdd001a5f
SymbolDatabase: Removed redundant 'else'
2017-01-09 22:48:05 +01:00
Daniel Marjamäki
b7321e8dde
Tokenizer: Rename struct
2017-01-09 22:40:30 +01:00
Daniel Marjamäki
a762511067
Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))
2017-01-09 22:28:55 +01:00
Daniel Marjamäki
b1f7e46491
Fixed #7323 (valueflow: global variables)
2017-01-09 15:53:08 +01:00
Simon Martin
417c7e36c0
Ticket #7548 : Properly detect the end of template parameter default values during instantiation.
2017-01-08 09:38:29 +01:00
Matthias Krüger
064a4aa4cc
improve constness of functions as per cppchecks suggestions.
2017-01-07 14:31:03 +01:00
Simon Martin
bd92ddd386
Ticket #7850 : Properly handle C functions called "class".
2017-01-06 21:16:28 +01:00
Robert Reif
4123b457d7
Fixed #7441 (SymbolDatabase: No scope when function return type not specified)
2017-01-06 11:53:17 +01:00
Robert Reif
139071d88b
Fixed #7875 (New check: function declaration and definition argument names don't match)
2017-01-05 08:52:11 +01:00
PKEuS
8ba9ce4924
Set version to 1.77.99/1.78 dev
2017-01-01 11:58:39 +01:00
Daniel Marjamäki
a184d5d421
SymbolDatabase: Refactoring
2017-01-01 11:34:05 +01:00
Robert Reif
4c25e798b1
Fixed #7865 (Tokenizer::createLinks2(): does does set links for <> in struct template)
2016-12-31 22:05:29 +01:00
Daniel Marjamäki
bf5fa90952
updated version info
2016-12-31 18:35:08 +01:00
Simon Martin
f43431408b
Ticket #7685 : Properly handle function calls as argument to a dealloc function. ( #853 )
...
Add an optional extended description…
2016-12-29 13:17:46 +01:00
orbitcowboy
24332b540d
There is no need to clear a class member string in the Ctor.
2016-12-27 21:20:17 +01:00
Daniel Marjamäki
85ae3adeb2
Fixed #5144 (FP old memleak - tree structure)
2016-12-27 08:12:37 +01:00
Daniel Marjamäki
1b21767954
Fixed #5666 (False positive when modifiying std::string by pointer)
2016-12-26 17:13:35 +01:00
Daniel Marjamäki
7e7aa21029
astyle formatting
...
[ci skip]
2016-12-26 14:14:48 +01:00
Daniel Marjamäki
770abcf453
Fixed #5398 (False positive: Scope of variable can be reduced does not account for other variables not reduceable)
2016-12-26 14:14:40 +01:00
Daniel Marjamäki
c8bc1c8f0e
Merge pull request #852 from boos/cwe-mapping-16
...
CWE mapping of accessMoved, accessForwarded, nullPointerArithmeticRedundantCheck, nullPointerArithmetic
2016-12-25 22:45:08 +01:00
Daniel Marjamäki
c8a450c9be
uninitvar: Fixed a FP seen in daca2
2016-12-25 22:43:29 +01:00
Roberto Martelloni
04f24b4220
CWE mapping of accessMoved, accessForwarded, nullPointerArithmeticRedundantCheck, nullPointerArithmetic
2016-12-24 23:07:37 +00:00
PKEuS
ea53bd22b7
Fixed false positive returnTempReference with operator++ ( #7874 )
2016-12-22 11:49:59 +01:00
Daniel Marjamäki
2ce4811998
astyle formatting
...
[ci skip]
2016-12-22 09:40:39 +01:00
Daniel Marjamäki
df6ae9f3b4
Fixed #7847 (Can't detect shift negative values when some op is executed)
2016-12-22 09:40:19 +01:00
Daniel Marjamäki
d79688c40b
Fixed #7822 (False positive for uninitialized variable if array type is used)
2016-12-21 23:11:11 +01:00
Daniel Marjamäki
28af5c0379
Integer Overflow: Don't warn about left-shift expressions with negative result like '1<<31'. That is common practice.
2016-12-21 18:19:59 +01:00
Daniel Marjamäki
426d1b4196
Merge pull request #846 from simartin/ticket_7805
...
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-21 17:58:48 +01:00
Daniel Marjamäki
f40bdddbab
ValueFlow: Better handling when casting calculation result
2016-12-20 23:09:50 +01:00
Daniel Marjamäki
f0d91fb74b
Fixed #7869 (False positive: Array index out of bounds)
2016-12-20 22:01:19 +01:00
Daniel Marjamäki
44ccbdedec
ValueFlow: Improved value for cast
2016-12-20 21:37:25 +01:00
Daniel Marjamäki
606bb78297
ValueFlow: Better handling of casts
2016-12-20 19:32:21 +01:00
Daniel Marjamäki
e14e86c103
ValueFlow: only set values in conditional code in subfunctions when sure
2016-12-20 11:06:20 +01:00
Daniel Marjamäki
807b653739
ValueFlow: Fix FP in for loops when 2nd expression is 0
2016-12-20 07:54:38 +01:00
Daniel Marjamäki
f1ad7368f6
ValueFlow: bool values
2016-12-19 21:21:18 +01:00
Daniel Marjamäki
aaf19c1e4f
Fixed #7839 (Prefix increment triggers parameter modification warning)
2016-12-19 15:25:36 +01:00
Daniel Marjamäki
f5ad7482a8
CheckBufferOverrun: Skip warnings about array index out of bounds in unions. Theoretically, the array is at least as large as the biggest union member.
2016-12-18 22:10:30 +01:00
Daniel Marjamäki
4558701c08
varid: don't generate varid and symboldatabase variable for function call parameter
2016-12-18 20:16:38 +01:00
Daniel Marjamäki
17aaecbd6b
ValueFlow: Improved handling of sizeof
2016-12-18 14:03:48 +01:00
Daniel Marjamäki
461e5cc5c9
CheckBufferOverrun: Moved check from simplified to normal. This fixes a FP in asterisk.
2016-12-18 11:14:05 +01:00
Daniel Marjamäki
4ac5c78e0c
Fix wrong iterator usage. Iterator that is erased must be non-const.
2016-12-17 22:20:50 +01:00
Daniel Marjamäki
72e4bc9d88
ValueFlow: skip values that cause false assertion condition
2016-12-17 21:23:14 +01:00
Daniel Marjamäki
fd85b493bd
astyle formatting
...
[ci skip]
2016-12-17 18:51:16 +01:00
Frank Zingsheim
cb5a5e6a25
Improve Fix #6180 (Access of moved variable still allowed until function is called)
2016-12-17 16:42:46 +01:00
Frank Zingsheim
9a871d33f7
Improve Fix #6180 ("reset" and "clear" clears the move status)
2016-12-17 16:39:30 +01:00
Frank Zingsheim
f4ab45f13b
Improve Fix #6180 (Do not warn about move if it is part of a reassignment of the variable)
2016-12-17 16:39:30 +01:00
Simon Martin
5119ae84b8
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-17 14:05:26 +01:00
Daniel Marjamäki
31337dda27
ValueFlow: Better handling of && and || in for loop to avoid FP
2016-12-11 21:19:24 +01:00
Daniel Marjamäki
d4f2512421
Tokenizer::simplifyKnownVariables: Added bailout when pointer alias is simplified and loop is encountered
2016-12-11 19:12:23 +01:00
Frank Zingsheim
e0d4720e19
Fix #7829 (false-positive: knownConditionTrueFalse linked to virtual method)
...
Return values of virtual functions in valueflow are only possible values
since function might be overloaded.
2016-12-11 10:44:05 +01:00
Daniel Marjamäki
87abe1174f
floatConversionOverflow: Avoid warnings when 255.5 is converted to unsigned char etc.
2016-12-10 23:14:40 +01:00
Daniel Marjamäki
b098d5fbd6
ValueFlow: We need better handling of casts
2016-12-10 22:09:01 +01:00
Daniel Marjamäki
2ca85a1c40
dump: add isUnsigned/isSigned
2016-12-09 22:31:47 +01:00
Daniel Marjamäki
ea905c9a36
Unused Functions: use buildDir if specified. Otherwise use old approach.
2016-12-09 20:11:20 +01:00
Daniel Marjamäki
23280c366d
try to make Travis happy by fixing Cppcheck warning
2016-12-08 23:12:59 +01:00
Daniel Marjamäki
e9d950d4f5
Cppcheck build dir: Better handling when --project is used
2016-12-08 22:46:44 +01:00
PKEuS
120fe2e4d6
Fixed false positive: The function 'operatorstd::string' is never used. ( #7853 )
2016-12-08 13:54:54 +01:00
bug22
3bb6a27988
Fixed #7791 (Cppcheck does not expand Visual Studio macros):
...
--project option will now accumulate defines/includes of all applicable
item definition groups, and will push back FileSetting items per project
configurations only
2016-12-07 18:03:46 +02:00
PKEuS
cfac3b457d
Several small refactorizations
2016-12-06 22:12:02 +01:00
PKEuS
718fcfda46
Several small refactorizations
2016-12-06 20:02:43 +01:00
PKEuS
40401534d7
Refactorized Library
2016-12-06 14:50:27 +01:00
PKEuS
2f6350a0d0
Refactorized Library
2016-12-06 14:09:28 +01:00
PKEuS
6dfbddef43
Avoid std::string::pop_back() as long as travis uses an ancient standard library version
2016-12-05 22:55:57 +01:00
PKEuS
6e8ac13325
Refactorization:
...
- Optimized std::string usage
- Replaced list by vector
- Moved iterator into loop head
- Ran AStyle
2016-12-05 17:45:34 +01:00
PKEuS
d665641a76
Refactorizations:
...
- use std::string::pop_back() and std::string::back()
- pass argument as const std::string&
- Moved iterator into for loop head
2016-12-05 14:50:01 +01:00
Matthias Krüger
7197456c23
CheckCondition::checkIncorrectLogicOperator(): if we encounter a condition like 'A && (!A || B)', print the actual equivalent ('A && B') in the --verbose message.
2016-12-05 13:39:20 +01:00
Daniel Marjamäki
5df8e7f50c
Fixed #7596 (ValueFlow: better handling for 'x*(1-x-1)')
2016-12-04 22:39:59 +01:00
Daniel Marjamäki
1137c1e6b8
--project: fixing vcxproj load
2016-12-04 19:15:04 +01:00
Daniel Marjamäki
8b18b6229e
--project: refactorings
2016-12-04 18:50:59 +01:00
Daniel Marjamäki
c12cb69cc2
ValueType: Handle function pointers
2016-12-04 16:02:50 +01:00
Daniel Marjamäki
9c69546d72
Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well)
2016-12-03 11:59:48 +01:00
orbitcowboy
04d6b05da9
preprocessor: It is more efficient to seek for a single character rather than a string.
2016-12-01 17:54:45 +01:00
orbitcowboy
4a439b9308
It is more efficient to provide a character instead of a string when searching for a single character. This has been fixed in various places.
2016-11-30 12:01:22 +01:00
orbitcowboy
8a45c3192b
There is not need to clear a string directly after its creation.
2016-11-30 10:39:14 +01:00
amai2012
f66e7fb379
#7833 UB: member call on null pointer when --dumping configuration with unknown value
2016-11-28 18:19:19 +01:00
PKEuS
36d12d7866
SymbolDatabase: Function::retDef should not point at "static" or "extern"
2016-11-28 17:23:39 +01:00
Stefan Weil
57b57428c2
Fix some typos in comments (found by codespell)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki
b6cba4a55c
Fixed #7784 (Token: can't be both type and variable)
2016-11-26 22:39:47 +01:00
Matthias Krüger
b3ace258ab
there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already.
2016-11-26 17:22:30 +01:00
Daniel Marjamäki
a198422f0e
Fixed Coverity warning. Coverity assumes that 'bits < 64' means that bits can be 63. That is not true here but anyway I think the code needed to be fixed.
2016-11-25 15:19:18 +01:00
Matthias Krüger
213589ee68
ValueFlow: don't perform UB when a function returns shifts of/by negative values. Fixes #7814 .
2016-11-24 23:23:47 +01:00
Daniel Marjamäki
8be50fd822
--project: loading props when relative paths are given
2016-11-24 08:11:51 +01:00
Daniel Marjamäki
a61f4e9c94
Fixed #7831 (false-positive: terminateStrncpy)
2016-11-24 07:04:58 +01:00
Matthias Krüger
cf24ea5221
fix #7783 : false positive knownConditionTrueFalse on assert(0 && "message").
2016-11-23 21:54:38 +01:00
Matthias Krüger
01e5f14bf8
CheckClass::virtualDestructorError and a variation of CheckNullPointer::nullPointerError would print inconclusive,warning messages altough no --enable=warning was given. Fix.
2016-11-23 00:13:09 +01:00
Daniel Marjamäki
0b3751520b
Add a check for float conversion overflows
2016-11-22 22:37:13 +01:00
PKEuS
02d8f691f8
Fixed false positive: Do not show useInitializationList message for enums
2016-11-22 12:09:30 +01:00
Daniel Marjamäki
d40f4e4a55
Fixed #7778 (valueFlowAfterAssign: alias)
2016-11-21 17:26:36 +01:00
Daniel Marjamäki
21364b4401
Refactoring fix for #7816
2016-11-21 13:54:59 +01:00
amai2012
933815ee54
#7816 Segmentation fault at Tokenizer::simplifyAttribute() for stand-alone void. Throw syntax error on incomplete code
2016-11-21 12:19:47 +01:00
Daniel Marjamäki
9043436e67
Visual Studio: Improved --project handling.
2016-11-20 22:44:50 +01:00
Matthias Krüger
4cf85b72b6
CheckOther::checkAccessOfMovedVariable: don't warn if --enable=warning is not given.
2016-11-20 18:44:37 +01:00
Daniel Marjamäki
74fa69fe5e
Fixed #7821 (syntax error, first token is &)
2016-11-20 17:59:50 +01:00
Daniel Marjamäki
4388435ce1
Revert "checkautovariable: fix #7818 , crash when accessing nullpointer tok2->next()."
...
This reverts commit a5d32aa7a5
.
2016-11-20 17:21:56 +01:00
Daniel Marjamäki
c329887bfe
use const
2016-11-20 15:44:20 +01:00
Frank Zingsheim
c8ff96fe8f
Fixed #6180 (Usage of variable after std::move or std::forward)
2016-11-20 15:14:49 +01:00
PKEuS
e23dc5c1e2
Fixed wrong message shown if unused label appears directly after a switch() scope
2016-11-20 14:43:54 +01:00
Matthias Krüger
b6614d0aa4
valueflow: bail out earlier when encountering divisions by zero. Fixes #7819 .
...
This caused valueflow to actually try to divide by zero, detected by UBSAN.
2016-11-20 14:38:35 +01:00
Daniel Marjamäki
5b377ea2e4
Fixed #7821 (segmentation fault, invalid last token)
2016-11-20 14:15:51 +01:00
Daniel Marjamäki
1235815ae9
SymbolDatabase: refactoring condition
2016-11-18 22:01:15 +01:00
PKEuS
5344a5e098
Fixed race condition by properly constructing a local CheckUnusedFunctions instance in CppCheck::processFile(). Instantiating Checks is dangerous!
2016-11-18 21:09:41 +01:00
Daniel Marjamäki
2f27a0c8f6
Revert "SymbolDatabase: refactoring condition"
...
I don't see why, but this did not work well on appveyor.
This reverts commit 5d7a4d51ad
.
2016-11-17 22:53:03 +01:00
Daniel Marjamäki
79fc332511
Fixed #7810 (SymbolDatabase: method with redundant scope info)
2016-11-17 22:45:50 +01:00
Daniel Marjamäki
5d7a4d51ad
SymbolDatabase: refactoring condition
2016-11-17 22:20:01 +01:00
Matthias Krüger
a5d32aa7a5
checkautovariable: fix #7818 , crash when accessing nullpointer tok2->next().
...
Not test case added yet because I failed to add it as .h files to testgarbage.
2016-11-16 14:46:37 +01:00
Daniel Marjamäki
7d7212c465
--cppcheck-build-dir: generate unique analyzeinfo filenames when source files have same names
2016-11-14 20:50:08 +01:00
Daniel Marjamäki
3b57273ef1
Fix Cppcheck warnings
2016-11-14 07:21:10 +01:00
Daniel Marjamäki
1e31c6c01c
ValueFlow: Extended handling of float values
2016-11-14 06:42:52 +01:00
Daniel Marjamäki
e1e9eacccc
ValueFlow: Added float type
2016-11-13 22:59:56 +01:00
Daniel Marjamäki
4732667488
ValueFlow: allow more value types
2016-11-13 22:33:39 +01:00
Daniel Marjamäki
7ebfb10edd
Fixed #7806 (ValueFlow: better handling of subfunction with early return)
2016-11-13 18:19:51 +01:00
Daniel Marjamäki
ee56fbe3a1
Fixed #7791 (Cppcheck does not expand Visual Studio macros)
2016-11-13 12:16:09 +01:00
Daniel Marjamäki
621c1e59c6
--project: handle SolutionDir and ProjectDir. This is a partial fix for #7791 . custom build macros are still not handled.
2016-11-11 16:22:14 +01:00
Daniel Marjamäki
4de5dc75aa
Fixed #7807 (false positive: (error) Signed integer overflow for expression 'int32_max-1'.)
2016-11-07 22:29:40 +01:00
Daniel Marjamäki
1245f1d621
Unused Functions: Fix checking when --cppcheck-build-dir is used.
2016-11-07 21:49:58 +01:00
Daniel Marjamäki
ac7b351d1e
ValueFlow: Don't calculate x<<64 and x>>64
2016-11-06 20:40:58 +01:00
Daniel Marjamäki
dd69d5eabe
ValueFlow: Don't calculate result when there is UB
2016-11-06 17:42:01 +01:00
Daniel Marjamäki
483fd8682a
cleanup redundant info in comment. ticket numbers can be looked up with git blame. if the code says there is a syntax error then a comment that says 'invalid code' isn't much clarification.
2016-11-06 16:49:25 +01:00
Alexander Mai
ee11f0974a
#7769 segmentation fault at setTokenValue() on invalid code.
2016-11-06 14:20:58 +01:00
Daniel Marjamäki
b607e83648
Try to fix travis
2016-11-05 21:45:31 +01:00
Daniel Marjamäki
350e5a7142
UnusedFunctions: Perform checking using analyzeinfo
2016-11-05 21:26:56 +01:00
Frank Zingsheim
19706b3464
Fix #7789 (Missing error messages in repeated check on compile_commands.json in cppcheck-gui)
2016-11-05 20:14:01 +01:00
Daniel Marjamäki
ece4b1a06f
Fix ValueFlow
2016-11-05 09:59:48 +01:00
Daniel Marjamäki
f280061ff8
signed int overflow: warn about intmax+1
2016-11-05 09:29:52 +01:00
Daniel Marjamäki
2885a75ea6
ValueFlow: handle ~ in setTokenValue
2016-11-05 09:29:22 +01:00
Matthias Krüger
13bfe873f6
resolve mismatching tag reported by clang4.0-dev
...
was:
In file included from lib/checkunusedfunctions.cpp:21:
lib/checkunusedfunctions.h:114:15: warning: struct 'FunctionDecl' was previously declared as a class [-Wmismatched-tags]
std::list<struct FunctionDecl> _functionDecl;
^
lib/checkunusedfunctions.h:108:23: note: previous use is here
class CPPCHECKLIB FunctionDecl {
^
lib/checkunusedfunctions.h:114:15: note: did you mean class here?
std::list<struct FunctionDecl> _functionDecl;
^~~~~~
class
1 warning generated.
2016-11-04 15:51:36 +01:00
orbitcowboy
919f8ac323
Fixed typos. There are no real changes.
2016-11-04 15:01:05 +01:00
Daniel Marjamäki
223ce04986
Merge pull request #841 from zingsheim/FunctionParameter
...
Function parameter
2016-11-01 21:58:52 +01:00
Daniel Marjamäki
0e9810b7f6
CheckStl: validation of iterators returned from functions
2016-11-01 14:08:42 +01:00
Frank Zingsheim
d4f01583b6
Fixed TODO (check if function parameter is non-const reference etc..) by common function
2016-11-01 14:06:30 +01:00
Matthias Krüger
892a81055d
CheckUnusedFunctions::analyzerInfo(): remove unused parameter 'filename'.
...
Was:
lib/checkunusedfunctions.cpp: In member function ‘std::__cxx11::string CheckUnusedFunctions::analyzerInfo(const string&) const’:
lib/checkunusedfunctions.cpp:292:67: warning: unused parameter ‘filename’ [-Wunused-parameter]
std::string CheckUnusedFunctions::analyzerInfo(const std::string &filename) const
^~~~~~~~
2016-11-01 13:34:26 +01:00
Frank Zingsheim
34e8ed6e31
Fix travis; fix [lib/checkunusedfunctions.h:110]: (style) Class 'FunctionDecl' has a constructor with 1 argument that is not explicit.
2016-11-01 11:18:03 +01:00
Daniel Marjamäki
e77d76525e
CheckUnusedFunction: generate better analyzerinfo
2016-10-31 20:43:57 +01:00
orbitcowboy
4e3fdedff9
templatesimplifier: Improved const correctness. There are no functional changes.
2016-10-31 17:24:15 +01:00
orbitcowboy
2f8a24764f
tokenize: Improved const correctness. There are no functional changes.
2016-10-31 17:18:27 +01:00
orbitcowboy
b3c60bf6b2
tokenize: Improved const correctness. There are no functional changes.
2016-10-31 16:11:11 +01:00
orbitcowboy
a81920cae1
checkunusedvar: Check pointer against NULL before dereferencing it.
2016-10-31 15:57:34 +01:00
Frank Zingsheim
a91c54df72
Remove unused enums ValueFlow::Value::ValueKind::Max and ValueFlow::Value::ValueKind::Min
2016-10-30 09:44:52 +01:00
Daniel Marjamäki
2c3232affa
cppcheck-build-dir: Use settings and cppcheck version in checksum so results will be recalculated if cppcheck is upgraded or there is significant changes on the command line.
2016-10-29 22:40:44 +02:00
orbitcowboy
bc32ccc894
CheckUninitVar::isFunctionParUsage: Avoid implicit conversion from type bool to int.
2016-10-29 21:41:55 +02:00
orbitcowboy
960a0c6b11
Token: Improved const correctness of findsimplematch() and findmatch(). There are no functional changes.
2016-10-29 21:37:45 +02:00
Daniel Marjamäki
e76710c906
Revert "Revert "Fix potential uninitialized variable in Tokenizer::simplifyTypedef""
...
It does not _fix_ any potential uninitialized variable. So I reverted this. However I think that as a refactoring it was ok.
This reverts commit 5b2e4891c4
.
2016-10-29 19:04:10 +02:00
Daniel Marjamäki
d092631645
Disable VS warnings
2016-10-29 18:32:39 +02:00
Daniel Marjamäki
5b2e4891c4
Revert "Fix potential uninitialized variable in Tokenizer::simplifyTypedef"
...
This reverts commit bed2f66302
.
2016-10-29 18:29:05 +02:00