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