Commit Graph

8359 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 0a70b8794c astyle formatting
[ci skip]
2018-01-19 23:26:28 +01:00
Sebastian de7aa8f513 Fix #7504: posix: open() was twice in configuration file (#1032)
* Fix #7504: posix: open() was twice in configuration file

This fixes ticket #7504: Problems with the open function were not always
detected because the open function was twice in posix.cfg and only the
second configuration was used by cppcheck. Like suggested now only
one configuration is used and the third parameter has a default value
and is thereby optional.
use-retval has been removed to avoid duplicate warnings because the
alloc/dealloc configuration already warns about unused retval.
According tests to verify that open is configured
correctly now have been added to test/cfg/posix.c.

* posix.cfg: open(): Add TODO for use-retval configuration
2018-01-18 13:56:36 +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 100887429d Uninitialized variables: Whole program analysis for function calls 2018-01-15 15:54:09 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +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 1b13490ac1 Move code 2018-01-11 14:27:41 +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
Daniel Marjamäki 58034dee86 Fixed #8076 (unmatched suppression when calling ./runtests.sh (test/cfg)) 2018-01-10 15:52:06 +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
Iván Matellanes cfeea3d35c Fixed #7331: Detect copy and move constructors with default parameters (#1018) 2018-01-07 14:20:19 +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 53fbfc9fdb test: Various micro optimizations: Replaced std::string() with std::string(). Use std::string::clear() instead of s = and prefer std::string::empty() instead of (s == ) for checking a string is empty. 2018-01-05 22:03:49 +01:00
Daniel Marjamäki 04c57381ea Fixed #8315 (heap use after free: templatesimplifier) 2018-01-05 16:10:13 +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
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
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 f6fcf01cc6 Fixed #7868 (TemplateSimplifier: template specialization fails) 2017-12-30 22:14:48 +01:00
Daniel Marjamäki a8f73055ad Templates: Fixed scope problem 2017-12-30 09:00:19 +01:00
Daniel Marjamäki fc1ac180e6 Fixed #6218 (Template type aliasing misdetection) 2017-12-29 22:47:07 +01:00
Daniel Marjamäki 469cb7e6df TemplateSimplifier: Fix instantiations when template parameter is a template 2017-12-26 22:34:39 +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
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 326765c632 TemplateSimplifier: Better handling of scopes 2017-12-23 08:20:24 +01: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
versat cc435c3e92 Add missing tests for strncpy
Add tests for verifying that the bufferoverrun tests are correct.
2017-12-11 10:25:59 +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
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 20eaf3fcca Tests for intmax_t passed as %ld and %lld into scanf 2017-11-20 22:34:31 +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 125daec71b Tests for std::intmax_t passed as %ju and %jx into scanf 2017-11-20 22:14:00 +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 9191e6f112 Fixed #8246 (ValueFlow: known value, function pointer argument) 2017-11-17 23:04:54 +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 7f48283b98 Improve test coverage for %I64x used with scanf 2017-11-13 21:47:56 +03:00
Dmitry-Me ee4831ca2b Tests for %u, %x with various length specifiers used with printf 2017-11-13 21:46:26 +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
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
Dmitry-Me 24aa6a858a Tests for %u, %x with various length specifiers used with printf 2017-11-10 23:53:53 +03: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 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
Dmitry-Me 432ea03f59 Expect warning for wrong argument sign 2017-11-09 19:07:41 +03:00
Daniel Marjamäki b67cf0a475 Improved handling of varid in complex scopes 2017-11-09 15:58:08 +01:00
Daniel Marjamäki ced3f4cde8 astyle formatting
[ci skip]
2017-11-09 15:57:03 +01: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 054444167d Improve test coverage for %lx used with scanf 2017-11-09 14:15:02 +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 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 c563917a5d Improve test coverage for intmax_t, uintmax_t, intptr_t, uintptr_t used as scanf read targets 2017-11-08 18:13:45 +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 3d2f86cef7 Improve test coverage for %zd used with scanf 2017-11-08 13:43:10 +03:00
Dmitry-Me 4fcef2f0c7 Improve test coverage for %llu, %llx, %Lu, %lx used with scanf 2017-11-08 12:18:35 +03:00
Dmitry-Me 9d53b70a56 Improve test coverage for Iu, Ix used with scanf 2017-11-08 08:06:05 +03:00
Dmitry-Me 1985d75442 Improve test coverage for %llx, %Lx, %I64x used with scanf 2017-11-08 00:05:21 +03:00
Dmitry-Me d31107451b Improve test coverage for void* passed as scanf read target 2017-11-07 23:43:30 +03:00
Dmitry-Me d4a1c0d8bd Improve test coverage for %lu and %llu used with printf 2017-11-07 21:44:46 +03:00
Dmitry-Me 043a565f5d Improve test coverage for %jx, %tx, %zx used with scanf 2017-11-07 00:27:47 +03:00
Dmitry-Me 95b37f665d Improve test coverage for %lx, %hx, %hhx used with scanf 2017-11-06 23:13:48 +03:00
Dmitry-Me 4681c7e4cf Improve test coverage for unsigned ptrdiff_t used as scanf read target 2017-11-06 22:04:59 +03:00
Dmitry-Me 41cffe40cf Improve test coverage for ptrdiff_t used as scanf read target with %Id 2017-11-06 21:01:34 +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
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
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
orbitcowboy 5ba5ea3aaf testsuite: Improved const correctness of arguments. 2017-10-30 10:57:03 +01:00
Dmitry-Me 3089352edb Improve test coverage for %lld used with printf 2017-10-27 22:25:34 +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 02e00a970b Restore test coverage for "x" conversion used with scanf 2017-10-26 23:36:55 +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 2b717c6c31 Improve test coverage for %zd used with scanf 2017-10-24 23:47:04 +03:00
Dmitry-Me eaa12db761 scanf with %zd expects ssize_t, not ptrdiff_t 2017-10-24 22:01:23 +03:00
Dmitry-Me 709ee6e278 Revert "Initial test coverage for %zd used with scanf"
This reverts commit a260b5157a.
2017-10-24 00:20:04 +03:00
Dmitry-Me a748ced9da Improve test coverage for %zx, %zu used with printf 2017-10-23 23:44:22 +03:00
Dmitry-Me a260b5157a Initial test coverage for %zd used with scanf 2017-10-23 23:42:29 +03:00
Dmitry-Me 481ab0f930 Tests for passing non-pointers as scanf read targets 2017-10-23 23:35:32 +03: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 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
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 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 8a7411abdb CheckClass: Fix wrong 'public interface' warnings 2017-10-20 22:10:55 +02:00
Dmitry-Me 5bf29fae49 Tests for unrecognized conversion specifiers 2017-10-20 21:46:24 +03:00
Dmitry-Me 4e881e98cc Improve test coverage for %I used with printf 2017-10-20 21:13:14 +03: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
Dmitry-Me 7e2cef4952 Improve test coverage for %z used with printf 2017-10-19 19:05:16 +03:00
Dmitry-Me f070fa1977 Improve test coverage for passing pointers into printf 2017-10-19 19:03:12 +03:00
Dmitry-Me 975132bc62 Improve test coverage for %td used with printf 2017-10-18 19:00:40 +03:00
Dmitry-Me b278436069 Improve test coverage for %j used with printf 2017-10-18 18:22:51 +03:00
Dmitry-Me a7d58a2468 Fix macro parameters list 2017-10-17 23:53:14 +03:00
Dmitry-Me 35a4822b77 Initial test coverage for %td used with scanf 2017-10-17 18:09:10 +03:00
Dmitry-Me 5beea50d3f Improve test coverage for %ld, %lld, %I64x used with scanf 2017-10-17 18:07:42 +03:00
Daniel Marjamäki ad1749738e Fixed #6153 (ValueFlowBeforeCondition: Handle global variables) 2017-10-17 16:55:37 +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
Dmitry-Me f27e98f910 Fix macro parameters list 2017-10-16 18:49:53 +03:00
Daniel Marjamäki 0425f1d46d Fixed #8241 (FP: Same expression on both sides of operator) 2017-10-16 17:39:50 +02:00
Dmitry-Me 2c61f40c35 Initial test coverage for %hd, %hhd, %jd, %I64d, %I32d used with scanf 2017-10-16 18:07:08 +03:00
Dmitry-Me 0ed8126b15 Tests for missing width specifier for scanf 2017-10-16 17:53:46 +03:00
Dmitry-Me d6cac72784 Test for %I without width specifier used with printf 2017-10-16 17:51:38 +03:00
Robert Reif 69b75c43b4 SymbolDatabase: fix wrong type in union test. 2017-10-15 09:45:02 -04:00
IOBYTE 352fd7a381 SymbolDatabase: Add support for functions in unions. (#973) 2017-10-15 11:49:36 +02:00
Dmitry-Me cad30446e4 Resolve C4800 2017-10-14 22:50:56 +03:00
Dmitry-Me 2c040096ca Improve test coverage for va_end() called before va_start() 2017-10-14 19:28:26 +03:00
Dmitry-Me b678f3c4c4 Improve test coverage for %c used with scanf_s 2017-10-13 19:08:14 +03:00
Dmitry-Me d32a8884bf Initial test coverage for %lx, %ld, %llx, %lld, %hx, %hhx, %Lx, %jx, %zx and %tx used with scanf 2017-10-13 18:36:12 +03:00
Dmitry-Me 7a7f34fb11 Improve test coverage for %zx, %zu used with printf 2017-10-13 18:17:33 +03:00
Dmitry-Me d4a435a520 Tests for %Id, %Ld, %I32x used with scanf 2017-10-12 18:18:38 +03:00
Dmitry-Me 2a6f63d995 Resolve C4305 - double constant truncated to float 2017-10-11 23:36:51 +03:00
Dmitry-Me d12db51771 Function parameter was not used 2017-10-11 00:43:50 +03:00
Daniel Marjamäki f9d8dd9f4d testsuite: don't compare doubles with != 2017-10-10 22:40:49 +02:00
Dmitry-Me e59ebed3b0 Remove rather unexpected empty line 2017-10-10 23:18:30 +03:00
Dmitry-Me bef6d6f446 Improve test coverage for %I used with scanf 2017-10-10 17:27:33 +03:00
Dmitry-Me fcba5b88c2 Improve test coverage for string literals passed as read target into scanf 2017-10-09 18:50:24 +03: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
Daniel Marjamäki 92673afc8f fixed 'make checkcfg' 2017-10-06 15:16:25 +02:00
Daniel Marjamäki e4676b70dd Remove wrong testcase test/cfg/windows.cpp, there is missing configuration for that given code 2017-10-06 14:42:19 +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
Dmitry-Me d170b496ba Improve test coverage for wide string literals passed into printf 2017-10-05 17:45:06 +03:00
orbitcowboy 00bff02e13 Formatted the code. There are no functional changes [ci skip]. 2017-10-05 09:02:55 +02:00
Dmitry-Me da0185387f Improve coverage for %j used with printf 2017-10-04 17:51:35 +03: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
Dmitry-Me 9564442167 Improve test coverage for detecting wrong file mode 2017-10-03 18:25:15 +03:00
Dmitry-Me 2b7ef7156a Improve test coverage for accessing closed files 2017-09-29 17:12:50 +03:00
Daniel Marjamäki 04c2be33a6 Unit testing visual studio import 2017-09-24 22:57:24 +02:00
Daniel Marjamäki 5993c40d5b Improve 'opposite inner condition' check 2017-09-22 14:01:20 +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 71d207c034 Fixed #8226 (Tokenizer: Wrong handling of string literal u"abc") 2017-09-21 13:33:14 +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 4318521fc1 Fixed #8187 (isVariableChangedByFunctionCall: Constructor reference argument) 2017-09-20 12:53:25 +02:00
Daniel Marjamäki b73f5fec7d Fix invalid code in TestStl test case 2017-09-19 23:22:17 +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
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 fe0a514a7c Fix testrunner 2017-09-16 02:13:48 +02: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
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
Dmitry-Me 6cfcf8610d Improve coverage for operator= return type detection.
This adds a testcase with parameter being a reference to non-const.
2017-09-14 00:12:10 +03:00
Daniel Marjamäki bb20c0504e CheckCondition: Fix FP in daca (iqtree) 'in >> ch' 2017-09-13 22:46:36 +02:00
Daniel Marjamäki 8f6c98e3d6 Remove TestGarbage testcase with unhandled characters 2017-09-12 22:48:30 +02:00
Daniel Marjamäki 5c7cf584ef bump simplecpp 2017-09-12 22:42:10 +02:00
Daniel Marjamäki 56544ac936 Fixed #8211 (Crash on incomplete code in isVariableChanged ()) 2017-09-11 13:45:36 +02:00
Daniel Marjamäki 9f4fc7b323 Rename sameConditionAfterEarlyExit to identicalConditionAfterEarlyExit 2017-09-10 22:59:39 +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 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
Daniel Marjamäki f2d56363d3 CheckCondition: Fix TODO assertion 2017-09-06 22:53:36 +02:00
Daniel Marjamäki e0c7f7f8f2 CheckCondition: Fix FP when there are method calls in condition 2017-09-06 22:26:00 +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
Daniel Marjamäki c1000998f0 CheckCondition: Fix FP found in daca results (ace) 2017-09-05 09:33:35 +02:00
Daniel Marjamäki d82805b7fe CheckCondition: Improved checking for same conditions 2017-09-04 22:40:34 +02: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
Daniel Marjamäki ad494b996c TestCondition: break out tests to functions 2017-09-04 22:11:53 +02:00
Daniel Marjamäki d838dc2129 CheckCondition::multiCondition2: Fix FN for pointers 2017-09-04 15:58:22 +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 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 0b751dcc1b Opposite conditions: Better matching when outer condition uses && 2017-09-01 23:24:15 +02: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
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 9c99bc43c2 ValueFlow: Skip wrong handling of lambda functions. TODO: handle lambda functions properly. 2017-08-28 22:39:12 +02: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
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
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
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 2679b576c2 Fixed #1693 (false negative: std::vector, negative index) 2017-08-22 11:04:02 +02:00
Heiko Eißfeldt 04bcc86d59 Fixed #439 (Patch: Cppcheck reports wrong filename for filenames containing 8-bit ASCII) 2017-08-21 12:52:15 +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 94c5c3703c astyle formatting
[ci skip]
2017-08-16 18:56:02 +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
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
orbitcowboy 61e47208eb Removed hard coded avr8 platform and moved it into a platform file (avr8.xml). 2017-08-09 11:58:27 +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 e6f6efc684 astyle formatting
[ci skip]
2017-08-02 07:48:38 +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
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 91eb0f1fad Removed XML version 1 2017-07-29 18:56:22 +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 515e84ed00 Renamed PathMatch::Match to PathMatch::match 2017-07-28 11:27:04 +02:00
Daniel Marjamäki eb288ec2a1 CheckStl: Use AST to handle iterator comparisons better 2017-07-26 23:13:01 +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 e58344c2c9 Fixed compiler warning 2017-07-22 16:23:33 +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
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
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 32fe0aba41 Fixed #8037 (ValueFlow: global variable might be modified by function call) 2017-07-09 12:50:17 +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 6b48781fdc Fixed #7105 (False positive resourceLeak - socket handle wiped after close) 2017-07-07 21:51:48 +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 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 f4dba4ad3d testrunner: Remove TestPath::simplify_path as these tests has been moved to simplecpp 2017-06-23 20:32:00 +02:00
Daniel Marjamäki 1e12ec241c reuse simplecpp::simplifyPath 2017-06-21 14:27:46 +02:00
Daniel Marjamäki 453058c059 AST: Better handling of C++11 initializer lists 2017-06-09 22:35:46 +02:00
Alexander Mai d3e79b71b5 #8051 Add regression test. Issue got fixed before. 2017-06-08 19:22:01 +02:00
Daniel Marjamäki fd74d455ce AST: Better handling of case 2017-06-08 15:32:35 +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 18abe4a142 Fixed #6021 (TemplateSimplifier::simplifyCalculations causes heap corruption on invalid code) 2017-06-07 19:32:56 +02:00
Daniel Marjamäki 0967700f4b Refactoring tests 2017-06-06 08:59:18 +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
Ayaz Salikhov 3dc4188292 Improve Python code 2017-06-05 13:23:00 +02:00
Ayaz Salikhov 2dd6168258 Improve Python code 2017-06-04 22:51:48 +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 bbde3cc23a Merge pull request #910 from mathbunnyru/asalikhov/improve_readability
improve readability
2017-06-03 14:33:21 +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
Ayaz Salikhov 3cd2f2d092 Don't cast bool to bool 2017-06-01 01:49:40 +03:00
Ville Skyttä 5ab158fec2 Spelling fixes 2017-05-30 08:03:15 +03: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
Daniel Marjamäki be6e0cbf85 Tokenizer: I dont think its safe to calculate floating point equality comparisons, changing TODO assertion to normal assertion. 2017-05-28 12:34:29 +02:00