Commit Graph

502 Commits

Author SHA1 Message Date
Daniel Marjamäki 7ede9de502 Removed unused code. The isVariableUsed is used instead. 2015-08-15 07:43:39 +02:00
Daniel Marjamäki e71ab70356 Fixed #6871 (False positive uninitvar - pointer to uninitialized char[]) 2015-08-08 14:52:46 +02:00
Daniel Marjamäki 7ec8adeb93 Fixed #6701 (Uninitialized variable warning when header could not be found) 2015-08-08 08:53:08 +02:00
Daniel Marjamäki 4bebb80300 Fixed #6869 (False positive: uninitvar, array passed to function) 2015-08-05 10:19:17 +02:00
Daniel Marjamäki e598b07a6d Moved functions to astutils 2015-08-03 09:20:50 +02:00
Daniel Marjamäki acc1566f64 uninitvar: Improved condition handling. Fixes one problem when running 'tools/run_more_tests.sh test/testuninitvar.cpp' 2015-07-25 17:55:01 +02:00
Daniel Marjamäki 234669b02b Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected. 2015-07-24 08:30:38 +02:00
Daniel Marjamäki ea933e9873 CheckUninitVar: Removed ExecutionPath based checker 2015-07-23 17:28:18 +02:00
Daniel Marjamäki 0b81a267f4 uninitvar: handling arrays in non-executionpath checker 2015-07-23 14:51:38 +02:00
Daniel Marjamäki 8d8c03dad8 uninitvar: removed returns from new checking to fix 'more' tests. these returns should be readded when the executionpath checking is removed. 2015-07-23 09:21:53 +02:00
Daniel Marjamäki 79067ac031 uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases. 2015-07-23 08:46:59 +02:00
Daniel Marjamäki 1de1aaa2f4 CheckUninitVar: Fix crash when AST is not created properly 2015-07-22 22:17:12 +02:00
Daniel Marjamäki 1f5eea98b5 CheckUninitVar: Fix a FP reported for invalid code 2015-07-22 21:58:06 +02:00
Daniel Marjamäki 42ed436e9d Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath 2015-07-22 20:31:58 +02:00
PKEuS bdd53b4142 Fixed false positive #6717 2015-07-21 12:13:59 +02:00
amai2012 1604e751e5 Fix some compiler warnings which got introduced recently 2015-06-30 20:11:51 +02:00
amai2012 4a47b8b3ae Refactoring: Better distinguish between C and C++ in a few checks. 2015-06-28 16:49:16 +02:00
Martin Ettl 272cf27ec3 Improved constness of local variable, no functional changes. 2015-06-20 11:33:27 +02:00
Daniel Marjamäki 02df692b0b Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2015-06-19 18:21:46 +02:00
Alexander Mai 13c1c2c035 Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code. 2015-06-17 22:28:15 +02:00
PKEuS 3ce4e68ca6 Refactorization: Make use of do-loops to avoid redundant Token::Match() calls 2015-05-13 13:40:40 +02:00
Simon Martin da302b3912 Ticket #6680: Members can be initialized by operator>>. 2015-05-10 14:27:15 +02:00
amai2012 8d8fffb20f #6651 Don't call member function on NULL pointer - even if call is "safe" 2015-04-17 08:47:59 +02:00
Matthias Krüger 42f0955e3f Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
Follow up to eedcb6abcb .
2015-04-10 14:31:19 +02:00
Daniel Marjamäki d563bd73f4 Fixed #6583 (False positive uninitvar - exit() ignored?!) 2015-04-08 15:35:04 +02:00
Dmitry-Me 5f6aaa4573 Make the check slightly less convoluted 2015-03-20 11:03:11 +03:00
Daniel Marjamäki 42c4aa1c49 Fixed #4880 (false negative: uninitialized variable, handling of conditional noreturn scopes) 2015-03-14 17:59:11 +01:00
Dmitry-Me 89ec9058a8 Proper if-else-if chain for mutually exclusive conditions 2015-03-14 15:09:46 +03:00
Daniel Marjamäki b1e9d9b86f Coverity CID 1270450: Removed redundant conditions 2015-02-17 19:32:59 +01:00
Dmitry-Me 5517c22524 Omit redundant token match 2015-02-03 15:01:09 +03:00
PKEuS 789665dadf Fixed #6455: Show uninitvar even for const variables 2015-01-31 13:21:22 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
PKEuS 0d151b45b5 Better support for funciton pointers in checkuninitvar.cpp (#6404) 2015-01-30 19:16:25 +01:00
PKEuS ee046af20c Fixed false positives #6450 and #6451 2015-01-23 19:38:39 +01:00
PKEuS da35a74589 Fixed false negative: Passing uninitialized variable to stream (#4673) 2015-01-22 22:56:41 +01:00
PKEuS da5a04f071 Fixed recently introduced FP in checkuninitvar.cpp if address of variable is passed to a function 2015-01-22 21:22:02 +01:00
PKEuS f4d11a4209 Fixed false negatives on try and non-executable scopes in checkUninitVar, removed unnecessary function parameters 2015-01-22 13:55:19 +01:00
PKEuS 331a6b66be Fixed internal message 2015-01-22 10:53:53 +01:00
PKEuS 7c60fe4aef Fixed crash introduced by last commit. 2015-01-22 10:51:06 +01:00
PKEuS 7364cc8040 Fixed false positive in fityk: operator new calling constructor 2015-01-22 10:37:31 +01:00
PKEuS 60b2b655df Support new/delete in new uninitialized variable checking; realloc() requires an initialized first argument. 2015-01-21 23:46:52 +01:00
PKEuS c3e47f7eaa Fixed false positive in CheckUninitVar and internal message 2015-01-21 22:26:44 +01:00
PKEuS 94c3c45350 CheckUninitVar: Use function information from library, bailout for '?' 2015-01-21 22:02:25 +01:00
PKEuS ecb9d87e42 Fixed false positive: Bailout in checkuninitvar.cpp if setjmp is found 2015-01-21 16:49:34 +01:00
PKEuS 5334aaa25f Refactorization:
- Removed a few unit tests of old uninitialized variable checking expecting other results than same test for new checking
- A few tweaks to new uninitvar checking to improve results when run on tests for old check
- switched some (TODO) tests to new check if the TODO is fixed
2015-01-21 16:17:58 +01:00
PKEuS d8e282fe76 Refactorization: Made checkUninitVar::isVariableUsage() non-static 2015-01-21 13:52:03 +01:00
PKEuS 346532d312 Fixed false positives in CheckUninitVar::checkStruct() 2015-01-21 13:11:48 +01:00
PKEuS 54de731cac Refactorized CheckUninitVar::checkScope(), fixed false negative 2015-01-21 12:20:03 +01:00
Robert Reif ba1c24ee65 Fixed #6422 (symbol database: put function flags into a single flag variable) 2015-01-08 05:45:31 +01:00
Daniel Marjamäki a87fb96eaf Uninitialized variables: fix fp when 'a=((b)=c)' is used 2015-01-06 18:03:40 +01:00
Daniel Marjamäki f2e5fbd30d Uninitialized variables: bailout when ({..}) are used to avoid fp. it can be handled better. 2015-01-06 07:44:04 +01:00
Daniel Marjamäki b3c2ea2c4f CheckUninitVar: Fix fp for 'int x=2+x();' when x() is an unseen preprocessor macro 2015-01-04 11:13:20 +01:00
Daniel Marjamäki 8dd569b9e1 Refactoring: Use AST in CheckUninitVar::isVariableUsage() to determine if & operator is address-of. This fixes FP in linux. 2015-01-04 09:23:24 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki f24e1b82cf astyle formatting 2014-12-20 18:47:40 +01:00
Daniel Marjamäki b8371ebd87 Revert 2e45df3b. Because there are FP. 2014-12-18 06:37:15 +01:00
Matthias Krüger cc7f69da54 fix two internal warnings:
[lib/checkuninitvar.cpp:1668]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
[lib/checkuninitvar.cpp:1669]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
2014-12-17 19:06:13 +01:00
orbitcowboy 2e45df3b72 Fixed #6341: false negative uninitvar pattern "return foo ( %var%" 2014-12-17 17:43:31 +01:00
Daniel Marjamäki 0b9d80c95d Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis 2014-12-02 06:41:18 +01:00
Daniel Marjamäki a002654c47 Reverted refactoring 828417c for now. It caused a major slowdown in the unused functions checking. 2014-11-24 06:37:08 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
Daniel Marjamäki 828417c934 CheckUnusedFunction: Refactorings to use same infrastructure for whole program analysis as CheckUninitVar and CheckBufferOverrun 2014-11-15 18:44:23 +01:00
Daniel Marjamäki de7e9223b8 Fixed #6272 (Improve check: multifile checking in checkbufferoverrun) 2014-11-15 10:43:49 +01:00
Daniel Marjamäki b766071272 Fixed #4970 (false positive: conditionally initialized variable used in if-clause (git/notes.c)) 2014-11-01 14:03:02 +01:00
Frank Zingsheim 41a54fceba Fixed false positives about uninitialized member variables if variable has a default value (#5500) 2014-10-16 21:57:43 +02:00
Daniel Marjamäki bbbe2c1b94 Fixed #6169 (False positive: passing uninitialized struct buffer member to strncpy) 2014-09-15 15:58:21 +02:00
Daniel Marjamäki 865a252c89 astyle formatting
[ci skip]
2014-09-14 10:29:12 +02:00
PKEuS 0b7281803e Merge pull request #428 from Dmitry-Me/detectArrowAccessesViaUninitPtrs
Detect -> accesses on uninitialized pointers
2014-09-12 09:19:59 +02:00
Dmitry-Me a2b30c7801 Detect -> accesses on uninitialized pointers 2014-09-12 10:19:00 +04:00
Dmitry-Me f58a25bebd Reorder checks, move declaration closer to where it's needed 2014-09-11 17:14:06 +04:00
Dmitry-Me 0a1b8c22d6 Simplify null pointer handling 2014-09-09 13:11:41 +04:00
PKEuS a8dc17c1d9 Fixed false positive #5566. 2014-08-26 11:29:26 +02:00
PKEuS 8188578cf2 SymbolDatabase: Fixed handling of nested types for function arguments
Removed unnecessary loops between var->typeStartToken() and var->typeEndToken()
2014-08-19 11:55:00 +02:00
PKEuS 8130fda4ae Implemented support for C++11 uniform initialization in several checks. 2014-08-05 16:11:42 +02:00
Daniel Marjamäki a2f776b1b7 Dead pointer: Added checking for dead pointer usage when pointer alias local variable that has gone out of scope. 2014-08-05 06:24:23 +02:00
Alexander Mai b6a40fceb7 Fix some compiler warnings 2014-06-26 20:34:07 +02:00
orbitcowboy d299cae5ef Fixed typo in comment, no functional changes [ci-skip] 2014-05-23 22:31:01 +02:00
PKEuS 5fbd58d98d Fixed messages of CheckInternal, fixed a false positive. 2014-05-18 20:39:52 +02:00
Daniel Marjamäki 8cc1f664d8 Uninitialized member variable: Fixed false negative when struct is read 2014-05-10 20:20:55 +02:00
Daniel Marjamäki 4c344adcf1 Uninitialized struct member: fixed false negative when struct assignment is seen 2014-05-10 19:56:44 +02:00
Daniel Marjamäki a202956471 Uninitvar: Refactoring. Use AST instead of token matching to see if variable is used in RHS of assignment. 2014-04-21 12:01:02 +02:00
Daniel Marjamäki 04cd261ee2 Fixed #5664 (false positive: (error) Uninitialized variable: j (Comma operator in for loop)) 2014-04-21 10:32:29 +02:00
Daniel Marjamäki c8ae1e4751 Fixed #5658 (false positive: (error) Uninitialized variable: s) 2014-04-10 15:59:37 +02:00
XhmikosR be0fcefe1d Tabs to spaces.
[ci skip]
2014-03-20 09:02:14 +02:00
Daniel Marjamäki 22a5881bee Uninitialized variables: Experimental checking for passing const pointer to partially initialized struct to function. Ticket: #5586 2014-03-20 07:19:35 +01:00
Daniel Marjamäki 8de4246713 Uninitialized variables: Improved handling of function calls when struct members are checked 2014-03-20 06:48:17 +01:00
PKEuS b564986d5d Added missing casts causing assertion failures on Windows (#5391)
-> Changed much more occurences, especially in preprocessor.cpp.
2014-03-18 21:41:47 +01:00
Thomas Jarosch 93341f4449 Use simple match where possible
Fixes these warnings found by "--enable=internal":

[lib/checkclass.cpp:972]: (warning) Found simple pattern inside Token::Match() call: "* *"
[lib/checkbufferoverrun.cpp:635]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checkbufferoverrun.cpp:1397]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/checksizeof.cpp:299]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checksizeof.cpp:301]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checksizeof.cpp:303]: (warning) Found simple pattern inside Token::Match() call: "]"
[lib/checksizeof.cpp:318]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checknullpointer.cpp:413]: (warning) Found simple pattern inside Token::Match() call: "delete"
[lib/checkio.cpp:1336]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkstl.cpp:1509]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1512]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1594]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkstl.cpp:1598]: (warning) Found simple pattern inside Token::Match() call: "] ="
[lib/checkunusedvar.cpp:755]: (warning) Found simple pattern inside Token::Match() call: "goto"
[lib/checkunusedvar.cpp:793]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkuninitvar.cpp:376]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:86]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:2181]: (warning) Found simple pattern inside Token::Match() call: "> {"
[lib/valueflow.cpp:54]: (warning) Found simple pattern inside Token::Match() call: "&"
[lib/valueflow.cpp:409]: (warning) Found simple pattern inside Token::Match() call: "do"
[lib/valueflow.cpp:425]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:487]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:511]: (warning) Found simple pattern inside Token::Match() call: "} else {"
[lib/valueflow.cpp:615]: (warning) Found simple pattern inside Token::Match() call: "for ("
[lib/symboldatabase.cpp:80]: (warning) Found simple pattern inside Token::Match() call: "= {"
[lib/symboldatabase.cpp:1069]: (warning) Found simple pattern inside Token::Match() call: "std ::"
[lib/tokenize.cpp:2207]: (warning) Found simple pattern inside Token::Match() call: "< >"
[lib/tokenize.cpp:2730]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/tokenize.cpp:4234]: (warning) Found simple pattern inside Token::Match() call: "try {"
[lib/tokenize.cpp:4235]: (warning) Found simple pattern inside Token::Match() call: "} catch ("
[lib/tokenize.cpp:5500]: (warning) Found simple pattern inside Token::Match() call: "INT8"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "}"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "do"
2014-03-14 16:27:47 +01:00
Daniel Marjamäki fb5c2d4b48 use nullptr in lib/checkother.cpp 2014-02-15 08:46:28 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki bc9ad08831 Fixed #5245 (false positive: Uninitialized variable (assignment inside ternary operator)) 2014-01-25 10:12:50 +01:00
Daniel Marjamäki e45a2e2c61 Fixed #5347 (False positive: uninitialized variable (try catch)) 2014-01-14 06:24:09 +01:00
Daniel Marjamäki 6182394966 Uninitialized variables: Fixed false positive taking value of pointer that is allocated but not initialized 2013-12-25 14:00:27 +01:00
Daniel Marjamäki 26dfddac6b UninitVar: Fixed false positive when checking if allocated pointer is null 2013-12-24 12:48:17 +01:00
Daniel Marjamäki 753559fff3 Uninitialized variables: Don't warn about try/catch exception variables 2013-12-24 07:39:15 +01:00
Daniel Marjamäki 661784a170 Fixed #5255 (False positive (error) Uninitialized variable: ptr2 - calling a static member function) 2013-12-23 16:50:27 +01:00
Daniel Marjamäki e2fa6a291c Uninitialized variables: Fixed false negatives for loop variables / pointer dereference 2013-12-23 12:27:00 +01:00
Daniel Marjamäki 80dec5a976 Uninitialized variables: Fixed FP when taking address of uninitialized variable 2013-12-13 20:10:22 +01:00
Daniel Marjamäki 7fe923bfc5 Uninitialized variables: Fixed FP when the variable is initialized in do-while condition 2013-12-13 13:27:01 +01:00
Daniel Marjamäki 3e6fbc6517 Fixed uninitialized variable FP after realloc if it fails. Related with ticket: #5240 2013-12-13 07:15:59 +01:00
Daniel Marjamäki 35189e80f2 Uninitialized variables: Fixed false positive for '*p=..' 2013-12-12 15:33:31 +01:00
Daniel Marjamäki 7321f92eff CheckUninitVar: Fix Coverity warning about possible null pointer. 2013-12-12 12:36:49 +01:00
Daniel Marjamäki 1b86615a69 Uninitialized variables: Fixed false positive for 'p=malloc; if (p) {}' 2013-12-12 11:44:07 +01:00
Daniel Marjamäki 4e7594748d Uninitialized variables: Fixed false positive for 'p=malloc; if (python tools/daca2.py b)' 2013-12-12 09:17:41 +01:00
Daniel Marjamäki 9f62740e1d Fixed #5236 (varid 0: vlc: src/misc/objects.c:126) 2013-12-12 08:44:00 +01:00
Daniel Marjamäki a4f9cb78d5 Uninitialized variables: Fixed false positives when passing allocated pointer to function 2013-12-11 05:54:42 +01:00
Daniel Marjamäki ef15e40de5 Uninitialized variables: error when passing uninit pointer to function 2013-12-10 18:36:16 +01:00
Daniel Marjamäki be5c00d215 Uninitialized variables: check function arguments 2013-12-09 15:58:42 +01:00
Daniel Marjamäki 14a00046a3 Fixed #5207 (Struct uninitialized members useage is not giving error (malloc).) 2013-12-04 20:32:20 +01:00
Daniel Marjamäki d8b25da73c Fixed #4740 (False Positive: Uninitialised variable 'int *a[2][19]; int **b = a[0];') 2013-11-25 06:38:23 +01:00
Daniel Marjamäki 7fc07989a7 UninitVar: Fixed false positive 'data is allocated but not initialized' when there is assignment 2013-11-23 10:24:29 +01:00
Daniel Marjamäki 71e61fb1ed Uninitialized variables: Fixed false positive when using ?: 2013-11-17 12:42:53 +01:00
Daniel Marjamäki 77e09d72a1 Uninitialized variables: Fixed false negatives when using ({}) 2013-11-17 12:11:18 +01:00
Daniel Marjamäki d342387b95 Uninitialized var: Fixed false negatives for self assignment 2013-11-16 18:07:33 +01:00
Daniel Marjamäki cfd6b0c384 UninitVar: fixed false negatives for function calls 2013-11-16 12:02:21 +01:00
Daniel Marjamäki 85b41059c5 astyle formatting 2013-11-10 15:49:53 +01:00
Simon Martin 185b88c6e3 Ticket #5073: Don't crash upon invalid do-while loop. 2013-11-08 23:13:21 +01:00
Daniel Marjamäki 86358694fb Uninitvar: Added comment to clarify that the old logic for function calls has been removed because it had FP and the 'same' checking in the new checker will be used to catch these errors instead. 2013-10-26 18:46:06 +02:00
Daniel Marjamäki 51ad9ab6ac Fixed #4896 (FP Uninitialized variable on template function) 2013-10-26 18:39:40 +02:00
Felipe Pena ed565f1ab1 - Fix comment 2013-10-12 13:49:35 -03:00
Felipe Pena c37ba4cbcf - Fixed false positive when using typeof/__alignof__ 2013-10-12 13:46:14 -03:00
XhmikosR 2762a30e48 Prefer prefix operator. 2013-10-01 09:20:19 +03:00
Daniel Marjamäki e3b7bce72b Fixed #4907 (False positive 'uninitStructMember' on structs with unions) 2013-09-30 06:35:31 +02:00
Daniel Marjamäki 698e9e2b59 reverted ee14ea4f. I think this fix was too generic. If there is a union in the struct then only the union members should be skipped. 2013-09-23 17:52:42 +02:00
Daniel Marjamäki ee14ea4fc2 Fixed #4907 (False positive "uninitStructMember" on structs with unions) 2013-09-23 07:20:20 +02:00
Daniel Marjamäki 64454068ec Fixed #4934 (false positive: Uninitialized variable (loop with inner condition '(x=1)')) 2013-09-23 06:07:01 +02:00
Simon Martin 894f537eba Remove warnings emitted by clang's -Wsign-conversion 2013-09-22 13:22:52 +02:00
Lucas Manuel Rodriguez acd65a6829 Fixed #4991: False Positive - Dangerous usage of 'arr' (not null-terminated) 2013-08-29 08:12:05 -03:00
Alexander Mai 7a324cef25 Fixed various Cppcheck inconclusive warnings 2013-07-30 12:52:27 +02:00
Daniel Marjamäki 2a1af1acda CheckUninitVar: Assertion for '} while (' after 'do {..' in debug builds. Bail out in release builds to avoid segfaults. 2013-07-28 12:41:38 +02:00
Daniel Marjamäki 9c67af058a SymbolDatabase: Renamed Variable::varId() to Variable::declarationId() to make it more clear how it works. 2013-07-20 12:31:04 +02:00
Daniel Marjamäki 7443883b9c Library: Improved handling in CheckNullPointer::parseFunctionCall for Library data 2013-07-15 18:55:40 +02:00
Daniel Marjamäki 66d8fa62d1 Library: added init attribute to <alloc> 2013-07-15 08:44:00 +02:00
Daniel Marjamäki 8f332af849 Uninitialized variables: Avoid FP when using '?:' 2013-07-10 16:44:35 +02:00
Daniel Marjamäki 2875ee1ecf astyle formatting 2013-07-07 10:26:20 +02:00
Daniel Marjamäki 2ef0a40aec Fixed #4893 (FP Uninitialized variable on sizeof of itself) 2013-07-06 08:52:47 +02:00
Daniel Marjamäki ef83525cd0 CheckUninitVar: Fixed GCC warning 2013-07-04 07:58:30 +02:00
Daniel Marjamäki ba23b65179 Fixed #4885 (FP Uninitialized variable when using comma) 2013-06-29 09:33:51 +02:00
Daniel Marjamäki 6997d38881 Uninitialized variables: fixed false positive in while loop 2013-06-27 18:28:00 +02:00
Daniel Marjamäki 6b01d2d5a8 Fixed #4747 (Can not find uninitialized variable (variable used in rhs in assignment)) 2013-06-27 16:53:15 +02:00
Daniel Marjamäki 9624a89b34 Uninitialized variables: improved debug warning when bailing out 2013-06-26 20:59:08 +02:00
Daniel Marjamäki 2265c61734 Fixed #4879 (false positive: uninitialized variable in inner for inside while (regression)) 2013-06-26 17:02:57 +02:00
Daniel Marjamäki cfd960d794 Fixed #3765 (false negative: unitialized variable) 2013-06-25 18:40:41 +02:00
Daniel Marjamäki ae36472a1b Fixed #4778 (FP: Uninitialized variable: av) 2013-06-14 07:21:53 +02:00
Daniel Marjamäki 065853a59a Fixed #4652 (False positive: variable value tracking into loop body) 2013-05-29 16:16:12 +02:00
Frank Zingsheim bca751b9f4 Fixed #4773 (Regression: wrong detection of unitialized variable) 2013-05-06 18:45:00 +02:00
Daniel Marjamäki bfb1bc50e3 Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2013-05-02 20:34:15 +02:00
Daniel Marjamäki 44cb070e13 Fixed #4737 (False positive: Uninitialized variable 'do_something(&((char*)&var)[0],1);') 2013-05-01 13:52:28 +02:00
Daniel Marjamäki 7fdaba43ed Uninitialized variables: Fixed fp when initializing struct with function in loop body 2013-04-10 20:46:44 +02:00
Daniel Marjamäki 96a5429cee Uninitialized variables: Assume that function initializes struct if it is unknown if it does 2013-04-10 20:04:32 +02:00
Daniel Marjamäki 4c8b17c040 Fixed #4717 (False positive: Uninitialized variable inside ({..})) 2013-04-09 17:02:11 +02:00
Daniel Marjamäki 0a17829021 removed extra newline 2013-04-08 19:52:48 +02:00
Daniel Marjamäki 894a2435ae Fixed #4718 (False positive: unititialized variable (value flow)) 2013-04-08 19:34:39 +02:00
Daniel Marjamäki c9469993e2 Uninitialized variables: Fixed false positives when using sizeof inside loop 2013-03-22 08:10:46 +01:00
Daniel Marjamäki a79354d51c Uninitialized variables: Fixed false positive when taking address of uninitialized array that is a struct member 2013-03-20 16:59:45 +01:00
Daniel Marjamäki 1f04e2c228 Fixed #4439 (False positive: Uninitialized variable (casting address)) 2013-03-13 17:32:47 +01:00
PKEuS 66a3555897 Implement initial support for Types in Symboldatabase:
- For each class/struct/union, a Type instance is added to SymbolDatabase::typeList.
- A scope is no longer created for declared but not defined types

Fixed name detection for classes when they are declared like this: "class ::Foo::Sub {..."
2013-03-05 04:33:38 -08:00
PKEuS 0105f8223c Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
PKEuS f899e6ca30 Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op% 2013-03-01 02:43:59 -08:00
PKEuS 670c4de8a9 Changed behaviour of Token::is*Op() functions:
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
Daniel Marjamki ee435bf885 Fixed #4600 (False positive Uninitialized struct member when using it as 'out parameter') 2013-02-23 15:57:58 +01:00
Daniel Marjamäki 382d7a10e8 Uninitialized variables: improved checking of c++ code 2013-02-15 18:13:47 +01:00
Thomas Jarosch 72a40b4da4 Use Token::simpleMatch for simple patterns
"internal" check reported:
[lib/checkuninitvar.cpp:1101]: (warning) Found simple pattern inside Token::Match() call: "if ("
2013-02-14 12:35:13 +01:00
Daniel Marjamäki 28e38a9e56 Fixed #4519 (false positive: (error) Uninitialized variable: eax (inline assembly usage)) 2013-02-12 15:59:23 +01:00
Daniel Marjamäki 442db6cdf9 Fixed #4569 (False Positive: Uninitialised variable) 2013-02-11 18:31:14 +01:00
Daniel Marjamäki 94f1d34dcb Fixed #4560 (false positive: (error) Uninitialized variable: s) 2013-02-11 17:05:59 +01:00
Daniel Marjamäki b660cf89ef astyle formatting 2013-02-10 23:53:01 +01:00
Mathias De Maré dfd557888d Fixed #4565 (false positive: dangerous usage (not null-terminated)) 2013-02-10 13:36:40 +01:00
Daniel Marjamäki 4ac5648656 Uninitialized struct: Fixed false positive in for loop 2013-02-05 17:01:46 +01:00
Daniel Marjamki 9124847211 Uninitialized variable: Refactoring. Use Token::variable() instead of symboldatabase lookup. Ticket: #4535 2013-02-02 16:27:12 +01:00
Daniel Marjamki 9c8d600ca9 Uninitialized variables: Refactor CheckUninitVar::isVariableUsage 2013-02-02 15:21:54 +01:00
Daniel Marjamäki a04f7b1a94 CheckNullPointer::isPointerDeRef: Refactoring - use tok->variable(). Ticket: #4535 2013-02-01 19:10:14 +01:00
Robert Reif ec1c86c152 Symbol database: more function/variable cleanup. Ticket: #4494 2013-01-31 06:41:18 +01:00
Daniel Marjamäki 3679a809dd Uninitialized variables: fixed false positive 2013-01-28 18:08:20 +01:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Daniel Marjamki 8738223e82 Fixed #4512 (Improve check: Uninitialized variable not detected) 2013-01-26 08:16:53 +01:00
Daniel Marjamki 04ceae7ea7 Uninitialized variables: minor refactorings 2013-01-26 07:28:11 +01:00
Daniel Marjamäki ae43b12bf1 Fixed #4511 (False positive: uninitialized struct member) 2013-01-25 18:20:57 +01:00
Daniel Marjamäki c235737b6c Uninitialized variables: improved checking of loops 2013-01-24 19:41:15 +01:00
Daniel Marjamki 76534ccd1b Uninitialized struct member: Fixed false negatives for return statements 2013-01-20 17:54:32 +01:00
Daniel Marjamki e63f2c3b5b Uninitialized struct member: Avoid false positive when struct member is passed by address 2013-01-20 13:12:40 +01:00
Daniel Marjamki f1c195e652 Fixed #3506 (false negative: not initialized variables ( struct timeval)) 2013-01-19 12:48:56 +01:00
Thomas Jarosch 7c4f0e594b astyle formatting 2013-01-19 11:49:35 +01:00
Daniel Marjamki 3cf0e88fbe Uninitialized struct members: Improved checking when struct member is used in expression 2013-01-19 10:09:58 +01:00
Daniel Marjamäki 7c615f0f12 Fixed #4497 (False positive: uninitialized struct (writing/reading member)) 2013-01-18 21:26:28 +01:00
Daniel Marjamäki c59dab2738 uninitialized struct member: changed severity from warning to error since it is UB 2013-01-17 23:18:37 +01:00
Daniel Marjamäki 2c6b383822 Uninitialized member variables: Improvements 2013-01-17 21:04:22 +01:00
Daniel Marjamäki e32ab4bf65 uninitialized struct members: improved fix 2013-01-17 17:21:21 +01:00
Daniel Marjamäki 93fb6b0c6a Fixed #4493 (FP: uninit struct member (struct is assigned)) 2013-01-17 17:01:04 +01:00
Daniel Marjamäki 5773e69ab1 Uninitialized variables: Add experimental checking of struct members 2013-01-16 20:28:29 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki de2c133f6a Fixed #4426 (False positive: Unitialized variable warning when comparing addresses) 2012-12-28 12:32:15 +01:00
Daniel Marjamäki 6770cc80be Uninitialized variables: Added debug warning for bailout 2012-12-28 11:42:50 +01:00
Daniel Marjamäki b914466285 Uninitialized variables: fixed false positives by bailing out when variable is conditionally initialized and then there is a conditional return. 2012-12-27 18:45:00 +01:00
acm4me 7da155c8ba Support for Sun Studio C++ compiler 2012-12-27 11:51:12 +01:00
Daniel Marjamäki f16c30248a Uninitialized variables: fixed FP when there are function calls where type* is converted to unknown_type 2012-12-25 14:05:29 +01:00
Daniel Marjamäki f381058293 Uninitialized variables: fixed FP when there are suspicious function calls where type** is converted to type* 2012-12-25 13:58:15 +01:00
Daniel Marjamäki bcc5a82b1d Uninitialized variables: Fixed FP when using typeof on uninitialized data in return statement 2012-12-25 13:31:54 +01:00