Commit Graph

8221 Commits

Author SHA1 Message Date
Sebastian c39a3e3f1c
windows string macros: Handle _T, _TEXT and TEXT internally, add tests (#1163)
Remove TEXT() macro from windows.cfg and handle it internally where it
can be correctly simplified (Ansi vs. Unicode).
Also add handling of _TEXT() macro which is just a synonym for _T().
Add tests to verify correct function and macro simplification.
2018-04-12 08:52:31 +02:00
Sebastian a36dad918a std.cfg: Add std::make_pair() (#1165) 2018-04-11 19:16:55 +02:00
orbitcowboy ef62207ada std.cfg: Added more tests for some std::vector functions. 2018-04-11 17:21:26 +02:00
PKEuS b596b0d549 Refactorization: pass std::string directly to std::*fstream 2018-04-11 09:50:42 +02:00
PKEuS d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki a0c9de0048 Suppressions: Validate inline suppressions 2018-04-11 08:18:00 +02:00
Sebastian 3fc53eb122 std.cfg: Add std::[w]string::compare() with tests (#1162) 2018-04-10 21:07:39 +02:00
Daniel Marjamäki c5923fbdd3 astyle formatting 2018-04-09 22:21:17 +02:00
Daniel Marjamäki 8f84a493f4 remove foreach emulator 2018-04-09 22:09:10 +02:00
Daniel Marjamäki e6114a2321 glob patterns: wildcards also match path separators (like before) 2018-04-09 18:59:18 +02:00
IOBYTE 8734e4dd38 Fix SymbolDatabase bailout to also support struct (#1160) 2018-04-09 18:53:55 +02:00
Paul Fultz II d8b3fa5c70 Fix #8482: Regression with valueflow (#1159)
* Fix regression with valueflow

* Simplify test case
2018-04-09 16:13:17 +02:00
Daniel Marjamäki f677322c69 Suppressions: Allow symbol-based inline suppressions 2018-04-09 11:50:59 +02:00
PKEuS 17b4721bd2 C++17: Support "if constexpr" (by simplifying it to plain if() statement)
This might lead to complaints about constant expressions as if() statement, but should fix syntax errors.
2018-04-09 11:42:59 +02:00
PKEuS bbfcccf078 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:41:24 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
Paul Fultz II 95fc84a26b Find duplicate expressions assigned to the same variable (#1129)
* Check for duplicate assignments

* Improve checking of expression

* Add more tests

* Use simple match

* Improve robustness of check

* check for null

* Reduce side effects by checking for side effects

* Improve verbose message

* Reword the error message
2018-04-08 14:43:19 +02:00
Daniel Marjamäki 795b9f5e0f astyle formatting 2018-04-08 09:25:59 +02:00
Paul Fultz II aed84abfd5 Extend valueflow comparison ops (#1153)
* Handle else clause when doing a compare

* Break early

* Fix bug in checking no return else

* Escape quotes

* Add equal sign

* Simplify the logic
2018-04-08 09:24:01 +02:00
Paul Fultz II b85dda77da Add a check for identical inner conditions (#1156) 2018-04-08 08:13:44 +02:00
IOBYTE 90983303f0 Fix #8477 (False positive caused by anonymous enum in method body) (#1154) 2018-04-08 08:00:12 +02:00
IOBYTE 4f9073159a Fix another SymbolDatabase bailout (#1157) 2018-04-08 07:29:19 +02:00
orbitcowboy 270635eb1f wxwidgets.cfg: Improved support for wxString to number conversion functions. 2018-04-07 20:27:02 +02:00
IOBYTE 20f0784c06 Fix #8470 ((error) SymbolDatabase bailout; unhandled code) (#1155) 2018-04-07 16:41:39 +02:00
Daniel Marjamäki 0daa3bba30 ValueType: Improved type handling of containers when [] operator is used 2018-04-06 22:26:35 +02:00
IOBYTE 7e15e39f39 Fix some new SymbolDatabase bailout; unhandled code syntax errors. (#1152) 2018-04-06 21:32:32 +02:00
Daniel Marjamäki 05acf9b352 Fixed #8470 ((error) SymbolDatabase bailout; unhandled code) 2018-04-06 16:03:58 +02:00
IOBYTE 9f386d305a Fixed #8280 (False positive uninitMemberVar - initialized from nested overloaded function) (#1151) 2018-04-06 07:53:05 +02:00
Paul Fultz II b871c85b67 Improve valeflow analysis with comparison operators (#1131)
* Improve valeflow analysis with comparison operators

* Use simple match

* Dont add 0 on comparisons

* Check reverse comparisons

* Use nullptr

* Remove duplicate code tests
2018-04-05 06:51:31 +02:00
Paul Fultz II 54de7b48c9 Fix false positive when constructing with curly brace (#1148) 2018-04-05 06:47:59 +02:00
Paul Fultz II 0c6f184423 Fix false positive for opposite conditions when using different containers (#1143)
* Fix false positive for opposite conditions when using different containers

* Add additional test
2018-04-05 06:43:13 +02:00
orbitcowboy 6e21d5ab84 wxwidgets.cfg: Added support for wxAtoi, wxAtol and wxAtof. 2018-04-04 21:29:55 +02:00
amai2012 41a46364c8
Fix sorting order for test fixtures to get consistent behaviour across different platforms (#1145) 2018-04-04 20:51:47 +02:00
IOBYTE a62c932a8f Improve findFunction for function calls with function calls as arguments. (#1147)
Duplicate the existing logic for variable to variable type comparisons
for function return type to variable type comparisons.
2018-04-04 20:44:01 +02:00
amai b133d50ebe #6426 Regression now has platform dependent results 2018-04-04 16:07:07 +02:00
amai 7581231d9d #6426 FP duplicateExpressionTernary - (expr) ? ~0u : ~0ul. Add regression test 2018-04-04 14:31:48 +02:00
Daniel Marjamäki 0d434efc15 virtualCallInConstructor: Clarify warning message 2018-04-04 13:04:40 +02:00
Daniel Marjamäki b3b364b42f virtualCallInConstructor: Updated warning message 2018-04-04 12:52:58 +02:00
Daniel Marjamäki 7efc4dd26e astyle formatting
[ci skip]
2018-04-04 10:04:40 +02:00
IOBYTE fa968d75bd Partial fix for #8291: (False positive uninitMemberVar when calling delegated constructor) (#1142) 2018-04-04 08:29:12 +02:00
Paul Fultz II bce5fe5cef Improve duplicate expressions in the ternary op by checking for equal values as well (#1134)
* Improve duplicate expressions in the ternary op by checking for equal values as well

* Use value instead of expression
2018-04-03 21:43:55 +02:00
Paul d240a36a60 Extend nullPointerArithmetic to check for addition as well 2018-04-03 21:32:37 +02:00
Daniel Marjamäki ee22a325c7 virtual function call in constructor: don't warn about explicit scoped call 2018-04-03 14:02:59 +02:00
IOBYTE 2a418fa0f5 Fixed #8466 (False Positive: Member variable is not initialized in the constructor. When using overloaded constructors) (#1141) 2018-04-02 18:32:45 +02:00
Daniel Marjamäki 1046ca2120 Improve check: Warn about virtual function calls in constructor/destructor 2018-04-02 15:31:47 +02:00
Daniel Marjamäki e492932f19 Improve check: Variable is not initialized in private constructor (C++11 or later) 2018-04-02 15:26:15 +02:00
Daniel Marjamäki 9f92685b92 SymbolDatabase: Throw InternalError if parsing fails 2018-04-02 13:14:48 +02:00
Daniel Marjamäki af88d7c4a9 Makefile: updated for release 2018-04-02 09:02:50 +02:00
Daniel Marjamäki c0272fc2ef Fixed #8259 (Don't combine &= for anonymous reference parameters) 2018-04-01 10:27:16 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
Daniel Marjamäki 4af2e517b9 Fixed #8465 (SymbolDatabase: bailout if there is 'struct A::B ab[5];') 2018-03-31 17:54:47 +02:00
orbitcowboy e3977f7e51 Formatted test/cfg files and updated 'runastyle' script. The generated test files are exclued, since they are not style-compliant. 2018-03-31 13:49:47 +02:00
orbitcowboy d7072136dc wxwidgets.cfg: Added support for wxMenuBar::Append(). 2018-03-31 13:34:40 +02:00
orbitcowboy 43aac4696e wxwidgets.cfg: Added support for more functions. 2018-03-31 13:23:12 +02:00
Sebastian 3c5777fbc6
windows library: Add config for some Local* functions (#1139)
Add configuration and tests for LocalAlloc, LocalFree and some other
Local* functions.
LocalReAlloc is currently not configured as an alloc/dealloc function
(like realloc is not configured in std.cfg), i am not sure how to
correctly configure it.
2018-03-29 20:47:22 +02:00
Daniel Marjamäki 1bc8f7f29a astyle formatting 2018-03-29 17:25:20 +02:00
Paul Fultz II 70da3acb70 Add foreach emulation for older compilers (#1138) 2018-03-29 04:51:22 +02:00
Daniel Marjamäki 210b921062 Fixed #8462 (AST: no ast created for 'e = { std::move(address),httpPort, (httpsPort) };') 2018-03-27 13:44:28 +02:00
Dmitry-Me c76b593467 Resolve C4800 warning 2018-03-27 00:58:53 +03:00
Sebastian d3284d5d54 std.cfg: Add strncpy_s and strncat_s (#1136) 2018-03-26 18:38:26 +02:00
Paul 43be20a824 Check more opposite conditions 2018-03-24 07:58:37 +01:00
amai dbb7e98711 #8346 Add regression test 2018-03-24 07:28:02 +01:00
IOBYTE 5bc039b7da Fix #6367 and #8439 (improve sizeof value flow support) (#1132) 2018-03-23 08:28:12 +01:00
Daniel Marjamäki 5a444f764b Fixed one more syntax error FP related to #8390 2018-03-22 15:20:37 +01:00
Daniel Marjamäki 3d4b773fd1 Fixed #8390 (Syntax error from an MSVC internal header) 2018-03-22 09:07:58 +01:00
Sebastian e38ec41ded
windows.cfg: Add some commonly used macros (#1127) 2018-03-22 08:31:50 +01:00
Daniel Marjamäki dfd8ef5d52 generate_cfg_tests: fix argument count 2018-03-19 20:46:55 +01:00
Daniel Marjamäki 7202787435 posix: remove function 'remove' that is also configured in std.cfg 2018-03-19 20:04:58 +01:00
Daniel Marjamäki 3af7aef3f0 update generated cfg tests (aca16e3) 2018-03-19 16:25:44 +01:00
Daniel Marjamäki 6b00ca33bd posix.cfg: Removed rename function as this is configured in std.cfg 2018-03-19 15:29:47 +01:00
Daniel Marjamäki 4e1ad40c87 update generated cfg tests (113f1ef) 2018-03-19 13:51:51 +01:00
Daniel Marjamäki 6e66150feb posix.cfg: update configuration for rename 2018-03-19 11:51:19 +01:00
Daniel Marjamäki f94a02a61e update generated qt.cfg tests 2018-03-19 11:51:03 +01:00
Daniel Marjamäki b10dd5d21e 2 TODOs are fixed 2018-03-19 11:02:58 +01:00
Daniel Marjamäki 0d3ddd85b1 updated generated cfg tests 2018-03-19 09:46:16 +01:00
Daniel Marjamäki 7699f6432b Fixed #8288 (valueFlowGlobalVar: compound assignments) 2018-03-18 19:53:33 +01:00
Daniel Marjamäki e932c44ae6 generate cfg tests: updated NULL pointer testing 2018-03-18 19:04:17 +01:00
Daniel Marjamäki 0741c389c0 generated cfg tests: updates, most unmatched suppressions are removed now 2018-03-18 14:06:26 +01:00
Daniel Marjamäki c800ac5118 generate_cfg_tests: updating testing for not-null 2018-03-18 13:53:46 +01:00
Daniel Marjamäki 914eea7ed1 generated cfg tests: updated test files 2018-03-18 13:22:33 +01:00
Daniel Marjamäki cf180dcc6b add script to generate cfg tests 2018-03-18 13:03:19 +01:00
Paul Fultz II 73ac27cc79 Fix loading library when running tests from build directory (#1123) 2018-03-18 06:50:33 +01:00
Daniel Marjamäki ec6133aea2 Fixed #8182 (False positive uninitvar - variable initialized in function in ternary expression) 2018-03-16 19:13:48 +01:00
Sebastian 65c85cbb53
Windows library: Add intrinsics __noop and __nop (#1119) 2018-03-15 12:31:20 +01:00
Paul Fultz II 166e4cafcd Check for functions calls in sizeof calculations (#1111)
* Check for functions calls in sizeof calculations

* Use seperate message and id for sizeofFunction

* Check for overloads

* Using decltype with a function should not be an error

* Fix warning

* Fix false positives when running pass the close paren

* Fix test error

* Try to fix more false positives

* Traverse using astOperand2

* Only check first argument

* Update fixes from feedback from PR
2018-03-15 10:24:17 +01:00
Sebastian ed3cd2929e
Windows library: Enhance functions, add tests (#1117)
Enhance *Equal/*Compare/*Copy/*Move/*Zero/*Fill memory functions to
catch buffer access out of bounds errors and ignored return values.
Replaced some function configuration by according defines as it is done
in windows to avoid redundant (and error prone) configurations.
2018-03-14 15:01:37 +01:00
Daniel Marjamäki cb6ed0555c Fix testrunner 2018-03-14 11:11:35 +01:00
Hinterwaeldlers a9b1f4c640 Taking care of operation overloading functions (#1108) 2018-03-12 10:25:30 +01:00
Daniel Marjamäki 380ecc408f Fixed #8418 (AST: wrong ast for throw expression) 2018-03-10 22:30:21 +01:00
Sebastian 7ba9ab7e4c Gtk library: Add configuration to avoid syntax error, add test file (#1109)
Add configuration for G_UNLIKELY and G_LIKELY to avoid syntax errors
when these macros are used as condition without enclosing brackets.
Add test file to verify Gtk library configuration. Syntax check for the
test file is only done when Gtk+2.0 or Gtk+3.0 is found and working.
Tested on Cygwin and on Ubuntu 16.04.
2018-03-10 11:22:10 +01:00
Alexander Mai 70664e5857 Ensure wxWidgets installation is at least 2.9.5 2018-02-26 20:46:56 +01:00
Daniel Marjamäki 7701e4594a ValueFlowBeforeCondition: Fix wrong value in do-while condition when there is a break in the loop body 2018-02-24 22:07:34 +01:00
Sebastian 346704b2e2
windows library: Mainly add socket functions, some other stuff and tests. (#1095)
Add Windows Socket 2 type/function configuration. There are still many
(microsoft specific) socket functions that are not yet configured.
Add configuration for GetUserName(), GetWindowText() and _fileno().
On Windows __wchar_t is a synonym for wchar_t, so an according define is
added.
2018-02-23 12:51:37 +01:00
amai2012 1c38b3aae7 Fix warning in test on Cygwin 2018-02-22 12:27:46 +01:00
Sebastian 1d14919649
wxwidgets: Fix syntax checking errors and warning (#1093)
wxDebugContext is only defined if wxUSE_DEBUG_CONTEXT is 1, so otherwise
just skip it for syntax checking because it will fail.
Change wxT to wxT_2 and add wxT_2 to the config to remove a warning
during syntax check and be more compatible with newer/older wxwidgets
versions.
Be more precise when replacing function like macros, fix redundant macro
definition for "_".
2018-02-21 12:20:56 +01:00
orbitcowboy 2ce8a3fc95 wxwidgets.cfg: Improved support for some deprecated functions. 2018-02-20 23:34:01 +01:00
orbitcowboy a4ab30cbe3 Replace uint8_t with short to fix CI. 2018-02-20 00:22:14 +01:00
orbitcowboy 46b4a502df Added missing include. 2018-02-20 00:18:20 +01:00
orbitcowboy b7b376d901 checkTypes: Take into account type promotion to integer. 2018-02-19 23:55:38 +01:00