Commit Graph

8063 Commits

Author SHA1 Message Date
IOBYTE d68f07e50c Add purgedConfiguration to list of error ids. (#1087)
purgedConfiguration was not showing up in the GUI supression list.
2018-02-10 22:30:49 +01:00
Simon Martin 66d16b51f0 Ticket #8352: Properly detect AST cycles. (#1060) 2018-02-10 14:39:57 +01:00
Sebastian 9eb6d38c06 std library: Add tests for wide character string functions, fix config (#1085)
Add equivalent tests for the wide character string functions like they
are already done for the normal string functions.
Fixed some issues with the configuration of the wide character string
functions that arised through the tests and were already fixed for the
normal string functions.
2018-02-09 21:17:01 +01:00
Sebastian 170d60712f wxwidgets library tests: Add syntax checking, fix test file. (#1084)
For the syntax check g++ needs to know the wxWidgets include paths which
are retrieved via wx-config. If includes are missing or not working the
syntax check is skipped.
wxwidgets.cpp: Fixed syntax, includes and added code so the syntax check
does not fail if some special features are not present.
2018-02-09 20:34:15 +01:00
Lauri Nurmi e0e664f996 Fix permissions of certain non-executable files (#1083)
mode 0755 => 0644
2018-02-09 19:46:38 +01:00
orbitcowboy dccf96cb7b wxwidgets.cfg: Added more deprecated functions. 2018-02-07 13:33:15 +01:00
orbitcowboy dea662891a wxwidgets.cfg: Added some functions from the deprecated wxWidets-list (http://docs.wxwidgets.org/trunk/deprecated.html). 2018-02-07 11:40:42 +01:00
Sebastian 14e45f9dcb
wxwidgets library: Fix/Enhance cfg, add test file (#1082)
Add test file for wxwidgets configuration, fix found issues and enhance
the cfg a bit:
Fix declarations in comments for wxLog* functions.
Merge the two wxTextFile::Create overloaded function configurations into
one that works for both now.
Removed use-retval attribute from wxBoxSizer::AddSpacer and
wxButton::SetDefault configuration since the functions have side effects
and there is no need to use the return value.
Add some function configurations, the macro _(str) and POD wxLogLevel.
2018-02-06 15:33:45 +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
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 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
IOBYTE d721c6aca5 Fixed #8386 (syntax error not found (segmentation fault)) (#1081) 2018-02-03 15:50:05 +01:00
Sebastian 2e5d7a8391 Fix #8381: false positives for swprintf_ and stprintf_s (#1080)
This fixes false positives because of wrong configuration in
windows.cfg.
Add tests in testio.cpp and test/cfg/windows.cpp to avoid regression.
2018-02-03 05:10:52 +01:00
Sebastian c235930539
windows library: Add function configurations with tests (#1079)
Add function configurations with tests for:
GetLocalTime, GetSystemTime, GetLastError, SetLastError,
AllocateAndInitializeSid, FreeSid, HeapAlloc, HeapReAlloc, HeapFree,
HeapSize, HeapValidate and GetProcessHeap.
test/cfg/runtests.sh: Enable --inconclusive for the windows tests to
avoid some issues in the future.
2018-02-02 11:28:54 +01:00
Sebastian 1ad22ae231 windows library: Add strlwr/strupr configuration, fixing tests (#1076)
Add configuration for the deprecated strlwr/strupr functions with
according warning.
test/cfg/windows.cpp: Added tests for strlwr and strupr. Moved function
call that does not return (FreeLibraryAndExitThread) to the end of the
function to fix analysis that was silently aborted at that point
(reported as issue #8378).
2018-01-31 17:43:19 +01:00
Sebastian 7b02b45a76 posix library: Add strtok tests (#1069)
* posix library: Add strtok tests

In the posix library there is the same configuration for strtok but a
warning is added.

* posix.cfg: Remove redundant configuration for strtok, add comment.
2018-01-31 10:58:30 +01:00
Sebastian c62abee07a
windows library: Add _malloca/_freea and _alloca configuration with tests (#1071) 2018-01-30 16:40:38 +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
Sebastian 4b5e4f989a std config: Remove misspelled function "strbprk" (#1065)
Remove misspelled function configuration "strbprk" (also from the
tests). The correct function "strpbrk" is already configured and tested.
2018-01-29 17:28:44 +01:00
Sebastian 30b9391461
windows library: Enhance Event function configuration, add tests (#1064) 2018-01-29 14:08:56 +01:00
Sebastian e8a262a1f2
posix.cfg: Enable/Add fdopen tests (#1063)
* posix.cfg: Enable/Add fdopen tests

* posix.cfg: Add missing empty line
2018-01-29 11:19:31 +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 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
Simon Martin 71ba513bdb Ticket #8361: Fix false positive in Tokenizer::findGarbageCode. (#1061) 2018-01-26 22:06:07 +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 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
Sebastian eabe5787ba Add windows configuration tests (#1053)
Implemented tests for the following windows configurations (more will
follow):
-Semaphore usage
-lstrcat function configuration
-_countof macro configuration
-Mutex usage
-Library usage (LoadLibrary, GetProcAddress, ...)
2018-01-24 20:05:16 +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
Daniel Marjamäki ce44a5805c astyle formatting
[ci skip]
2018-01-23 18:15:37 +01:00
Sebastian b78d714037 posix.cfg: access(): Removed redundant configuration, added tests (#1048)
I intentionally removed the second access() configuraion because it was
missing the use-retval attribute. But calling access() without using the
return value is absolutely senseless.
I added tests to posix.c to verify the correct configuration of
access().
2018-01-22 14:54:14 +01:00
IOBYTE e6d285d3ca Fixed #8357 (crash: cmake Tests/CMakeLib/testUTF8.cxx --debug --verbose) (#1046) 2018-01-22 08:06:56 +01:00
IOBYTE 3159d151d3 Fix symbol database crash on template type aliases by ignoring them. (#1045) 2018-01-21 21:22:26 +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
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
Simon Martin b4f32206af Ticket #8337: Fix false positive in copy constructor detection. (#1040) 2018-01-20 14:46:09 +01:00