Matthias Krüger
b71c945ac4
fix build (CFG_DIR => CFGDIR) and run dmake.
2018-02-09 17:44:26 +01:00
Daniel Marjamäki
780bd7e63e
More flexible loading of platform files, when using --platform it should not be necessary to provide the full path
2018-02-09 16:22:22 +01:00
Daniel Marjamäki
85d8bbacb8
integerOverflow: Separate id for conditional integer overflows
2018-02-07 12:49:56 +01:00
Daniel Marjamäki
58066b1f0c
Remove whole program analysis from 'uninitialized variables' and 'null pointer dereference' checkers. I think this logic can more or less be added in ValueFlow instead and then all ValueFlow checkers should get whole program analysis.
2018-02-06 14:56:17 +01:00
Daniel Marjamäki
71511f3131
Refactor f487182
2018-02-06 08:59:36 +01:00
Daniel Marjamäki
13daaac264
astyle formatting
...
[ci skip]
2018-02-06 08:10:28 +01:00
Ivan Maidanski
f487182075
Suppressed unused functions should not lead to nonzero exit code ( #1026 ) ( #1078 )
...
This is a fix of commit 97ffec8
.
2018-02-06 07:44:53 +01:00
Daniel Marjamäki
8a3c25210d
SymbolDatabase: Remove useless break. As far as I know Tokenizer::syntaxError() throws an exception and therefore the break after the function call is unreachable
2018-02-05 23:28:33 +01:00
Alexander Mai
68eb6c4e6f
Refactoring: Add Tokenizer::findGarbageCode to time report. The method now calls syntaxError instead of returning an invalid token
2018-02-05 21:47:33 +01:00
Daniel Marjamäki
dbc6771a0b
Uninitialized variables: Fix FP for unknown macro like 'list_for_each'
2018-02-04 22:30:08 +01:00
Matthias Krüger
f009cfc845
fix some typos found by codespell.
2018-02-04 20:53:43 +01:00
Daniel Marjamäki
4998248501
Null pointers: Fixed false positives when running whole program analysis. Copied the fix from the CheckUninitVar::isUnsafeFunction.
2018-02-04 15:29:57 +01:00
Jørgen Kvalsvik
a61f21d1b6
Accept nested templates in tokenizer-simplify ( #1070 )
...
The following snippet triggerd the error:
template<typename DerivedT>
template<typename T>
auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
return Parser() | static_cast<DerivedT const &>( *this ) | other;
}
Whenever simplifyFunctionParameters was called on a templated class'
templated member function (and probably any nested template), the
tokenizer would recognise it as a syntax error, assuming that return
type *must* come after a template<> token.
2018-02-04 09:48:37 +01:00
Daniel Marjamäki
d47b7726fa
Uninitialized variables: Fix potential false positives in subfunction if there is early return or conditional writes
2018-02-04 09:40:57 +01:00
Daniel Marjamäki
1fe59faecb
changed message ids for uninitvar/nullpointer errors that was found by whole program analysis
2018-02-03 16:05:07 +01:00
IOBYTE
d721c6aca5
Fixed #8386 (syntax error not found (segmentation fault)) ( #1081 )
2018-02-03 15:50:05 +01:00
orbitcowboy
82c963d3a2
symboldatabase: Fix null pointer dereference, introduced by ee1ba85e15 (comments)
.
2018-02-02 08:45:13 +01:00
orbitcowboy
ee1ba85e15
symboldatabase: Fix potential null pointer dereference ( #1072 )
...
There is a potential `nullPointer` dereference in symboldatabase. This PR attempts to fix this. Additionally, this could be detected by Cppcheck as well.
Here is a reduced and compilable testcase, where Cppcheck fails to detect a potential `nullPointer` dereference:
```
class Scope
{
public:
bool bar();
int *definedType;
};
int f(Scope *new_scope)
{
int ret = 1;
if (new_scope)
{
if (new_scope->bar())
{
if (!new_scope->definedType) {} // check for null
ret = *new_scope->definedType; // dereference
}
}
return ret;
}
```
The corresponding ticket on track, addressing the false negative: https://trac.cppcheck.net/ticket/8375
2018-01-31 11:00:42 +01:00
orbitcowboy
f5e6ef9fd2
checkio: Fixed potential usage of invalid iterator. ( #1066 )
...
* checkio: Fixed potential usage of invalid iterator.
* formatted the code.
A ticket about FN (invalidIterator1) is created at https://trac.cppcheck.net/ticket/8373
2018-01-30 08:43:15 +01:00
Daniel Marjamäki
f5a11a6510
UninitVar: Speedup whole program analysis a bit
2018-01-29 15:15:35 +01:00
orbitcowboy
fb7f1efc49
token: Fixed potential null pointer dereference. ( #1062 )
2018-01-28 14:27:01 +01:00
Daniel Marjamäki
21a35de0d2
Tokenizer: Refactoring garbage check
2018-01-27 22:26:43 +01:00
David Hallas
4d18d3948f
Fixes issue with case inside switch that is not a compound statement ( #1031 )
...
* Fixes issue with case inside switch that is not a compound statement was treated as garbage
This fixes an issue with the check for case keywords outside of switch
detection that would treat a case statement inside a switch that is not
a compound statement as garbage, but this is perfectly valid C++. This
construct is used in several libraries, i.e. Google Test.
* Tweak check and handle missing semicolon
Tweaks the check with feedback from danmar.
Handle the case where there is no semicolon and document it with a unit
test.
2018-01-27 22:21:26 +01:00
Daniel Marjamäki
5b6ec49a6f
Pointer overflow: Fixed false positive
2018-01-27 22:09:43 +01:00
Daniel Marjamäki
189e0b3890
Fix Cppcheck warning about uninitialized variable
2018-01-27 22:05:29 +01:00
Daniel Marjamäki
bc40f5041d
Fixed #6356 (Improve checking: pointer arithmetic "ab.a + 100" overrun)
2018-01-27 15:39:39 +01:00
Daniel Marjamäki
c110770481
Fixed #8325 (False negative: address of auto variable being returned when assigned to another variable first)
2018-01-27 14:48:45 +01:00
orbitcowboy
27d9aaa8f5
checkother: Removed statement that is always true. ( #1059 )
2018-01-26 22:49:07 +01:00
Simon Martin
71ba513bdb
Ticket #8361 : Fix false positive in Tokenizer::findGarbageCode. ( #1061 )
2018-01-26 22:06:07 +01:00
Daniel Marjamäki
3ebedcd7f5
Fixed VS crash for torture test
2018-01-26 16:05:43 +01:00
Daniel Marjamäki
a5f202360a
Fixed crash for garbage code, found by fuzzing
2018-01-26 09:34:27 +01:00
Daniel Marjamäki
cb297a00fc
Auto variables: Assign address of local variable to global pointer ( #6825 )
2018-01-25 22:50:41 +01:00
Daniel Marjamäki
9109956c8c
UninitVar: Improve whole program analysis, used isVariableUsage()
2018-01-25 21:49:21 +01:00
Daniel Marjamäki
51c2ded23f
Fix crash
2018-01-25 19:42:50 +01:00
Daniel Marjamäki
1b3248b0fc
Dont write syntax error for lambda functions
2018-01-25 17:47:27 +01:00
Daniel Marjamäki
4d66609173
Fix Cppcheck warning, uninitialized member variable
2018-01-25 17:29:08 +01:00
Daniel Marjamäki
f73da16e94
Revert "UninitVar: Better checking in whole program analysis"
...
This reverts commit b2bdc2687b
.
2018-01-25 17:05:57 +01:00
Daniel Marjamäki
b2bdc2687b
UninitVar: Better checking in whole program analysis
2018-01-25 15:56:46 +01:00
Daniel Marjamäki
c04557eb73
Fix crashes detected with fuzzing
2018-01-25 15:53:58 +01:00
Daniel Marjamäki
ce60b326f4
Whole program analysis: Improved handling of nested calls
2018-01-24 22:53:14 +01:00
Daniel Marjamäki
599e038282
AutoVariables: Warn when address of local array is assigned to global pointer and pointer is not reassigned
2018-01-24 21:33:58 +01:00
IOBYTE
8ce496a127
Fix possible null pointer dereference cppcheck warning. ( #1056 )
2018-01-24 21:19:52 +01:00
Daniel Marjamäki
96e387a486
Fixed #8351 (segmentation fault on objective C code)
2018-01-24 18:06:11 +01:00
IOBYTE
558e0757c2
Fix simplifyTypedef crash on lambda. ( #1054 )
2018-01-24 15:04:33 +01:00
Daniel Marjamäki
0f561d0ed6
Fix crashes for garbage code, found by fuzzing
2018-01-24 13:53:03 +01:00
IOBYTE
4710d80a40
Fix #5766 (FP: typedef array throws off parser) ( #1052 )
...
* Fix #5766 (FP: typedef array throws off parser)
* Fix travis build.
2018-01-24 09:51:22 +01:00
IOBYTE
e6d285d3ca
Fixed #8357 (crash: cmake Tests/CMakeLib/testUTF8.cxx --debug --verbose) ( #1046 )
2018-01-22 08:06:56 +01:00
Daniel Marjamäki
512b9f512c
Refactoring whole program analysis for CheckUninitVar and CheckNullPointer
2018-01-21 22:56:46 +01:00
IOBYTE
3159d151d3
Fix symbol database crash on template type aliases by ignoring them. ( #1045 )
2018-01-21 21:22:26 +01:00
Daniel Marjamäki
351b382a7b
Null pointers: Whole program analysis
2018-01-21 19:51:15 +01:00
Martin Ettl
17a54681b8
tokenize: simplify empty string creation string("")->string().
2018-01-21 16:36:57 +01:00
Alexey Eryomenko
913fdf44b6
member access operators are allowed inside the embedded SQL block when ( #1043 )
...
passing arguments for a query
2018-01-21 15:58:12 +01:00
Daniel Marjamäki
ea63e52d98
UninitVar: Improved function/method matching in whole program analysis
2018-01-21 10:40:35 +01:00
IOBYTE
5673348215
Fixed #8350 (False positive: enum class static_cast to int is treated as non-primitive when type inference is used) ( #1042 )
2018-01-21 07:26:37 +01:00
orbitcowboy
ec0cc4e29c
templatesimplifier: Removed redundant local string variable. ( #1041 )
2018-01-20 22:26:48 +01:00
orbitcowboy
bf201328d1
Merge pull request #1039 from orbitcowboy/master
...
checkstring: Cleanup not needed variable.
2018-01-20 14:59:01 +01:00
Simon Martin
b4f32206af
Ticket #8337 : Fix false positive in copy constructor detection. ( #1040 )
2018-01-20 14:46:09 +01:00
Martin Ettl
9816358e8b
Cleanup not needed variable.
2018-01-19 22:41:51 +01:00
Simon Martin
8878e6dd0d
Ticket #8333 : Properly report a syntax error for functions with invalid parameter types. ( #1030 )
2018-01-18 08:51:35 +01:00
Daniel Marjamäki
c7c9b3cd65
Fixed Cppcheck warning about using const reference to avoid data copying
2018-01-15 22:31:15 +01:00
Daniel Marjamäki
a0a04be011
Fix Cppcheck warning about mismatching argument names
2018-01-15 22:25:55 +01:00
Daniel Marjamäki
b08c1868bc
Fixed Cppcheck warning
2018-01-15 22:03:23 +01:00
Daniel Marjamäki
c331a10fa7
Refactorings, and try to ensure that analyzer info is stored/loaded properly
2018-01-15 19:12:31 +01:00
Daniel Marjamäki
f2b2e87fb6
Uninitialized Variables: some additional tweaks. Try to fix Travis
2018-01-15 17:35:21 +01:00
Daniel Marjamäki
100887429d
Uninitialized variables: Whole program analysis for function calls
2018-01-15 15:54:09 +01:00
Daniel Marjamäki
2f508c0bba
1.82: Updated versions
2018-01-14 16:25:17 +01:00
Daniel Marjamäki
af26f00e04
gui: update copyright message in about dialog
2018-01-14 15:46:20 +01:00
Daniel Marjamäki
c4caee6b18
Updated copyright year
2018-01-14 15:37:52 +01:00
amai2012
2ef7c35cfd
Function isIterator() did not to set returned parameter always
2018-01-12 09:36:14 +01:00
Ivan Maidanski
97ffec85c0
Fixed #7502 (Correct exit code if never used function is found) ( #1026 )
2018-01-12 08:24:01 +01:00
IOBYTE
03603c85cf
Fixed #8331 (stack overflow: daca: firefox-58.0b14) ( #1027 )
2018-01-12 08:19:21 +01:00
Daniel Marjamäki
6fd157e93b
ValueFlow: Template arguments have 'possible' values
2018-01-11 14:22:27 +01:00
Daniel Marjamäki
bbeff99cc3
Fixed #6930 (Token: need function that says if the token comes from instantiated template argument)
2018-01-11 09:41:22 +01:00
Daniel Marjamäki
323e9ab509
astyle formatting
...
[ci skip]
2018-01-11 09:31:16 +01:00
IOBYTE
cefb2131c7
Add support for simple c++ 11 type ailases like: using INT = int; ( #1024 )
...
* Add support for simple c++ 11 type ailases like: using INT = int;
Only types supported by ValueType are supported. Complex types like
function pointers are not supported. Template type aliases are not
supported.
* Fix crash when type in using type alias is simplified away.
This fixes a crash when size_t is replaced with unsigned long in: using
size_t = unsigned long; by the tokenizer.
This does not fix the problem where Tokenizer::simplifyPlatformTypes()
simplifies away size_t in other cases. This is only a problem when the
new type is different from the platform type.
2018-01-10 22:16:18 +01:00
amai2012
b17807c568
#6572 False positive eraseDereference - in iterator class - flag error inconclusive if iterator is not STL type
2018-01-10 09:37:21 +01:00
PKEuS
b684e1f202
Updated AStyle to version 3.0.1
2018-01-08 20:20:33 +01:00
Daniel Marjamäki
fdbd6e688f
Remove unused function
2018-01-08 18:55:00 +01:00
Iván Matellanes
cfeea3d35c
Fixed #7331 : Detect copy and move constructors with default parameters ( #1018 )
2018-01-07 14:20:19 +01:00
Daniel Marjamäki
8c33a95b49
Refactoring: moved method from Tokenizer to TokenList
2018-01-07 14:07:34 +01:00
PKEuS
c8010fdf42
Fixed crash on garbage code ( #8307 )
2018-01-07 13:11:56 +01:00
PKEuS
817f66d74d
Fixed crash on garbage code ( #8317 )
2018-01-07 12:52:28 +01:00
Matthias Krüger
eb58df236e
CheckOther::accessMovedError() / accessMoved, accessForwarded warnings: put variable name into single quotes.
2018-01-07 10:57:19 +01:00
Daniel Marjamäki
83b87b54b4
Fixed #8191 (False positive iterators regression)
2018-01-06 22:25:13 +01:00
Daniel Marjamäki
61767d4932
Fixed #8125 (incorrect error iterators)
2018-01-06 16:08:12 +01:00
Daniel Marjamäki
98b45ffbc0
Fixed #8314 (TemplateSimplifer crash)
2018-01-06 15:16:03 +01:00
Daniel Marjamäki
943693acfb
TemplateSimplifier: Improved code for template aliases
2018-01-06 08:40:06 +01:00
Martin Ettl
e33fe91b1a
Micro optimize std::string::find() calls searching for a single space.
2018-01-05 22:24:28 +01:00
Daniel Marjamäki
d6dae27803
Fixed Cppcheck postincrement warnings
2018-01-05 17:29:40 +01:00
Daniel Marjamäki
2c5225af43
Fixed use-after-free found by asan
2018-01-05 17:06:02 +01:00
Daniel Marjamäki
04c57381ea
Fixed #8315 (heap use after free: templatesimplifier)
2018-01-05 16:10:13 +01:00
Matthias Krüger
94790620d6
templatesimplifier: fix two warnings about nonexplicit constructors.
...
Was:
[lib/templatesimplifier.cpp:37]: (style) Class 'FindToken' has a constructor with 1 argument that is not explicit.
[lib/templatesimplifier.cpp:47]: (style) Class 'FindName' has a constructor with 1 argument that is not explicit.
2018-01-05 15:53:13 +01:00
Daniel Marjamäki
f74c19bbed
Refactoring lookups in TemplateSimplifier
2018-01-05 15:27:43 +01:00
Daniel Marjamäki
a95108ebe3
TemplateSimplifier: Fix incorrect recursion when template is reused inside itself
2018-01-03 23:05:57 +01:00
Daniel Marjamäki
255b788d4d
Fixed #4903 (Improve check: allocated but not initialized (condition))
2018-01-02 23:20:46 +01:00
Daniel Marjamäki
1af69bd0d4
Tokenizer::createLinks2: fix link for >>
2018-01-01 15:20:21 +01:00
Daniel Marjamäki
03b0b35a9d
Refactor Token::findClosingBracket()
2018-01-01 12:22:04 +01:00
Matthias Krüger
1f3ca7ddf6
oops, remove some leftover commented-out debug code and run astyle.
2018-01-01 05:04:59 +01:00
Matthias Krüger
af9b9595ce
SymbolDatabase::createSymbolDatabaseFindAllScopes(): simplify match pattern.
2018-01-01 05:02:55 +01:00
Matthias Krüger
f2b2be2166
CheckInternal::checkRedundantTokCheck(): also catch patterns of the form if(!tok || !Token::Match(tok, "foo")).
2018-01-01 05:02:41 +01:00