Commit Graph

8706 Commits

Author SHA1 Message Date
Alexander Mai 1bc7a89b3c Improve search patterns within Tokenizer::validateC() 2017-05-02 17:57:06 +02:00
Robert Reif e2bfe1c0ec Fixed #8044: Crash below SymbolDatabase::setValueType 2017-05-01 14:12:50 -04:00
Matthias Krüger cee0f724ff Fixed #8018: Tokenize::findGarbageCode: detect heads of for-loops with 1 or more than 2 semicolons as garbage code. 2017-05-01 18:28:26 +02:00
Daniel Marjamäki bc7799dccd Fixed #7888 (false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long)) 2017-05-01 12:23:28 +02:00
Daniel Marjamäki f51a709f80 add fixme comment 2017-05-01 11:25:58 +02:00
Daniel Marjamäki ce6cc5416a uninitvar: made ValueFlow check experimental 2017-05-01 11:13:30 +02:00
Daniel Marjamäki 9cdda53fb9 CheckFunctions::memsetZeroBytes: Add CHECK_WRONG_DATA to avoid crashes 2017-04-30 18:58:51 +02:00
Daniel Marjamäki 8a08cc0796 Fixed #8029 (Tokenizer::simplifyCAlternativeTokens: dont simplify 'eb.and + 1') 2017-04-30 14:40:41 +02:00
Daniel Marjamäki 7fd04cd8d0 Updated Token::expressionString(), write '->' instead of '.' 2017-04-30 14:22:18 +02:00
Simon Martin 28960a8bba Remove bailout and fix varid for template class member initialized in out-of-line constructor (#8031) 2017-04-30 08:59:47 +02:00
IOBYTE 8a668aa860 Add missing else that could cause an extra try scope to be added to the scope list (#8025)
Add an optional extended description…
2017-04-30 08:58:41 +02:00
Daniel Marjamäki 980ca39fe2 valueFlowForward: better handling of sizeof() in rhs in assignments 2017-04-29 08:25:55 +02:00
Garrett Bodily ddfd4c6348 Write access type of functions and variables to xml dump 2017-04-29 07:18:16 +02:00
Robert Reif 964b744c96 Fixed #7990 (crash: SymbolDatabase::printOut()) 2017-04-29 07:02:49 +02:00
Daniel Marjamäki 06102cb3d7 UninitVar: Don't warn for inconclusive values 2017-04-28 21:09:56 +02:00
Daniel Marjamäki a0a8f8ddd6 ValueFlowUninit: make it more strict 2017-04-28 13:29:09 +02:00
Daniel Marjamäki 5fd77d2518 Switch CHECK_WRONG_DATA macro so crashes/hangs are avoided 2017-04-28 10:48:41 +02:00
Daniel Marjamäki 589fabd0b1 Fixed #8027 (hang after AST_MAX_DEPTH is exceeded in array initialization) 2017-04-27 20:53:27 +02:00
Daniel Marjamäki d9f72d5f8c AST: Handle 'x = { [ID] = 1, .. }' when ID is unexpanded macro 2017-04-26 22:35:04 +02:00
Daniel Marjamäki bdf16b1157 Tokenizer::simplifyComma: dont simplify comma in '=(struct s){...}' 2017-04-26 20:48:08 +02:00
Daniel Marjamäki 89532cf8b9 Fixed #7968 (valueFlowBeforeCondition: better handling of compound assignments) 2017-04-25 20:45:02 +02:00
orbitcowboy 537045b176 Improved const correctness. There are no functional changes. 2017-04-25 14:57:48 +02:00
Daniel Marjamäki 140e086206 Fixed #7738 (False positive deallocret - delete and return NULL pointer) 2017-04-24 22:05:16 +02:00
Daniel Marjamäki 37fd60e879 Fixed #7293 (Use of uninitialized pointer not detected (worked in 1.71)) 2017-04-24 18:27:16 +02:00
Daniel Marjamäki 9a294496c1 ValueFlow::setTokenValue: Fix typo 2017-04-23 21:59:58 +02:00
Daniel Marjamäki a688402617 ValueFlow::setTokenValue: Don't calculate parent value for uninitialized values 2017-04-23 21:58:01 +02:00
Daniel Marjamäki 2f51b975ed valueFlowUninit: only check variables 2017-04-23 21:50:51 +02:00
Daniel Marjamäki 25a1ea3d18 use simpleMatch for simple pattern 2017-04-23 19:25:35 +02:00
Daniel Marjamäki 8a738eefab fixed #7998 (uninitialized variable is not found when used with switch/case) 2017-04-23 18:05:14 +02:00
Daniel Marjamäki 3f069d9e44 Write two FIXME comments, create library configuration to replace hardcoded checks 2017-04-23 15:34:45 +02:00
Daniel Marjamäki 198c8878ee Use Token::simpleMatch() for simple pattern 2017-04-23 12:14:14 +02:00
Daniel Marjamäki f2719ec6ca Refactoring CheckString::sprintfOverlappingData. Use AST, isSameExpression(), getArguments(), .. 2017-04-23 10:51:31 +02:00
Daniel Marjamäki f92ef7d8e2 Refactoring. Use 'endsWith()' 2017-04-23 10:17:35 +02:00
Daniel Marjamäki 101dc28afa Refactoring: Moved checkMemset.. from CheckOther to CheckFunctions 2017-04-23 07:53:41 +02:00
Daniel Marjamäki f6ab204dc6 Refactorings in CheckOther 2017-04-23 07:19:44 +02:00
Daniel Marjamäki f601a6903f Updated comment 2017-04-23 06:44:38 +02:00
Matthias Krüger 2744a9456f fix [lib/checkfunctions.cpp:300]: (warning) Found simple pattern inside Token::Match() call: "new" 2017-04-22 21:53:31 +02:00
Daniel Marjamäki e5b9e2a898 --check-library: less warnings 2017-04-22 21:23:46 +02:00
Daniel Marjamäki e72ec4282d Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well) 2017-04-22 12:44:57 +02:00
Daniel Marjamäki 1039c710e4 Fixed #8017 (AST: wrong ast for extra comma 's={1,}') 2017-04-22 11:23:11 +02:00
Daniel Marjamäki 7140bae226 Merge pull request #894 from simartin/ticket_7964
Ticket #7964: Don't crash on valid code using function pointers named strcpy or strcat in main()
2017-04-22 01:24:03 +02:00
Simon Martin b526fd7c49 Ticket #7964: Don't crash on valid code using function pointers named strcpy or strcat in main(). 2017-04-21 23:36:10 +02:00
Daniel Marjamäki 43454936e7 Fixed #8014 (FP: Uninitialized variable 'f(1,{..});') 2017-04-21 22:33:27 +02:00
Robert Reif 78ad9825af Add support for auto variables in regular for loop. 2017-04-21 15:25:02 -04:00
Daniel Marjamäki e827119856 Fix testrunner InternalError 2017-04-21 21:02:46 +02:00
Daniel Marjamäki 902eb87a8a Fixed #8016 (AST: wrong ast for 'x=(s){...};') 2017-04-21 17:44:11 +02:00
Daniel Marjamäki eec8c77774 Merge pull request #892 from IOBYTE/master
Add support for auto variable initialized from function return type.
2017-04-20 22:17:23 +02:00
Daniel Marjamäki f8e9071de1 CheckFunction: In the <valid> check handle possible/conditional/inconclusive values better 2017-04-20 22:14:54 +02:00
Robert Reif 0ff8e49b69 Add support for auto variable initialized from function return type. 2017-04-20 15:22:57 -04:00
Daniel Marjamäki 95dd16892b Merge pull request #891 from IOBYTE/master
Fix #7963: crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTra…
2017-04-20 20:51:40 +02:00
Daniel Marjamäki 3fbcc0cd3b Refactor CheckFunctions::invalidFunctionUsage 2017-04-20 19:57:39 +02:00
Daniel Marjamäki e43c078c5e checkfunctions: code cleanup 2017-04-20 17:42:25 +02:00
Robert Reif 69d18d9c29 Fix #7963: crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTransformFeedback.cpp 2017-04-20 10:03:29 -04:00
Daniel Marjamäki 7a26e046a8 Fixed #8001 (AST: Wrong AST for lambda function with 'std::string const&' result type) 2017-04-18 21:21:30 +02:00
Daniel Marjamäki 0edb0dbf3c Fix redundant assignment found by Cppcheck 2017-04-17 22:33:15 +02:00
Daniel Marjamäki d911eeba75 astyle formatting
[ci skip]
2017-04-17 22:16:02 +02:00
Daniel Marjamäki 1a95dc9bd6 Fixed #7979 (Tokenizer: Detect and reject c++ code in .c file) 2017-04-17 22:15:29 +02:00
Daniel Marjamäki bb015c6a2b Fixed #8006 (AST: Wrong tree with complex for loops and casts) 2017-04-17 21:11:53 +02:00
Simon Martin 5fd686c878 Ticket #4544: Also handle Foo<struct Bar> constructs. 2017-04-17 11:24:28 +02:00
Daniel Marjamäki 4f64e67298 Misra: Add rule 8.11 2017-04-17 07:45:27 +02:00
Daniel Marjamäki 1045ece946 dump: refactor valueType dump 2017-04-16 09:11:20 +02:00
Daniel Marjamäki f90d8c9987 dump: fix xml format 2017-04-15 14:03:49 +02:00
Daniel Marjamäki b3b0a796b9 dump: fix xml format 2017-04-15 12:38:00 +02:00
Daniel Marjamäki e71b428740 dump: Add platform info and valueType info 2017-04-15 12:25:44 +02:00
Daniel Marjamäki 174bcc8d34 Misra: Add rule 16.3 2017-04-14 10:46:35 +02:00
Daniel Marjamäki d252a64ec8 Cleanup CheckFunctions::checkIgnoredReturnValue 2017-04-12 10:44:08 +02:00
Daniel Marjamäki 41a64f6d1f Fix crash 2017-04-11 20:16:33 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
Daniel Marjamäki 4d1a64301c AST: Fixed Match pattern '|*' => '*|' 2017-04-10 23:44:30 +02:00
Daniel Marjamäki 632a6b664c AST: Harden handling of C++11 2017-04-10 23:29:15 +02:00
Daniel Marjamäki 2c43075ece AST: weird clang syntax 2017-04-10 23:05:41 +02:00
Daniel Marjamäki df90ff9f5e Merge pull request #888 from simartin/ticket_7942
Don't generate invalid syntax for out of line template class constructors during instantiation
2017-04-10 22:18:20 +02:00
Daniel Marjamäki 5e1b6aee8c AST: Fix hang for weird VLA code 2017-04-10 22:17:34 +02:00
Daniel Marjamäki ffeadbdde4 AST: improved handling for struct initialization 's = { [0] = 123 }' 2017-04-10 07:25:18 +02:00
Daniel Marjamäki d92c529aa6 AST: Fix wrong handling of struct initialization, caused hang 2017-04-09 22:06:13 +02:00
Daniel Marjamäki 45d2d66df3 Remove redundant space in Token::Match pattern 2017-04-09 19:27:11 +02:00
Daniel Marjamäki e6005dfa3c AST: Fix AST for lambda '[&]{..}' 2017-04-09 17:49:55 +02:00
Matthias Krüger 7d12e1f3a6 valueFlowGetArrayIndexes: convert Token::Match to Token::simpleMatch.
The pattern is a sole "[", but since "[" is also used for complexe patterns, the internal check that finds potential simple match patterns bailed out here.
2017-04-09 17:27:46 +02:00
Simon Martin ee05fe7d77 Ticket #7942: Don't generate invalid syntax for out of line template class constructors during instantiation. 2017-04-09 16:12:59 +02:00
Daniel Marjamäki 6e0af5d01f MISRA 19 and 28 2017-04-09 10:11:54 +02:00
Robert Reif bcf0c5f010 Add ValueType and auto type information to debug output.
Print out ValueType for variables and function return type.
Print out complete type for variables and function return type.
Print out ValueType for variable auto token.
2017-04-07 19:57:10 -04:00
Daniel Marjamäki f5f141ff42 astyle formatting
[ci skip]
2017-04-07 19:19:41 +02:00
Daniel Marjamäki 8ffed6862d Tokenizer: Add --check-config warning for macro with semicolon in argument 2017-04-07 19:19:10 +02:00
Daniel Marjamäki 7d8af7bdca Fixed #7979 (crash (nr 2): CheckFunctions::checkIgnoredReturnValue()) 2017-04-07 13:18:53 +02:00
Daniel Marjamäki 392a06a44b AST: better handling of '(struct X){...}' 2017-04-06 21:28:13 +02:00
Daniel Marjamäki 70a7915173 CppCheck: Improve output when first configuration is not empty. 2017-04-06 19:52:21 +02:00
Daniel Marjamäki 50da7d4919 Tokenizer: Write syntax error if there is C++ code in C file. 2017-04-06 08:50:35 +02:00
Daniel Marjamäki fd2651909c Fixed #7978 (ValueType: container type not set properly) 2017-04-06 07:07:20 +02:00
Daniel Marjamäki fee86b9684 ValueType: Better handling of 'new Container' 2017-04-05 22:05:29 +02:00
PKEuS 47570f5791 Set version to 1.78.99/1.79 dev 2017-04-05 11:24:26 +02:00
Daniel Marjamäki e6ed08c4d8 Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression)) 2017-04-05 11:00:02 +02:00
Daniel Marjamäki 9c5a136f04 Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>) 2017-04-03 21:48:22 +02:00
Matthias Krüger 79010eecea lib: fix a bunch of warnings about differing function arguments in definition and declaration.
[lib/token.h:72] -> [lib/token.cpp:36]: (style, inconclusive) Function 'Token' argument 1 names different: declaration 'tokensBack' definition 't'.
    [lib/token.h:445] -> [lib/token.cpp:497]: (style, inconclusive) Function 'multiCompare' argument 1 names different: declaration 'needle' definition 'tok'.
    [lib/checkio.h:73] -> [lib/checkio.cpp:1385]: (style, inconclusive) Function 'ArgumentInfo' argument 3 names different: declaration 'isCPP' definition '_isCPP'.
    [lib/checkother.h:216] -> [lib/checkother.cpp:2136]: (style, inconclusive) Function 'checkComparisonFunctionIsAlwaysTrueOrFalseError' argument 2 names different: declaration 'strFunctionName' definition 'functionName'.
    [lib/errorlogger.h:214] -> [lib/errorlogger.cpp:51]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
    [lib/errorlogger.h:215] -> [lib/errorlogger.cpp:65]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
    [lib/library.h:327] -> [lib/library.cpp:1043]: (style, inconclusive) Function 'ignorefunction' argument 1 names different: declaration 'function' definition 'functionName'.
    [lib/mathlib.h:112] -> [lib/mathlib.cpp:1275]: (style, inconclusive) Function 'isNullValue' argument 1 names different: declaration 'tok' definition 'str'.
    [lib/preprocessor.h:91] -> [lib/preprocessor.cpp:122]: (style, inconclusive) Function 'setDirectives' argument 1 names different: declaration 'tokens' definition 'tokens1'.
    [lib/symboldatabase.h:860] -> [lib/symboldatabase.cpp:1801]: (style, inconclusive) Function 'argsMatch' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1171] -> [lib/symboldatabase.cpp:2048]: (style, inconclusive) Function 'addClassFunction' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1174] -> [lib/symboldatabase.cpp:2208]: (style, inconclusive) Function 'addNewFunction' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1090] -> [lib/symboldatabase.cpp:3648]: (style, inconclusive) Function 'findVariableType' argument 2 names different: declaration 'type' definition 'typeTok'.
    [lib/symboldatabase.h:1101] -> [lib/symboldatabase.cpp:4308]: (style, inconclusive) Function 'findType' argument 1 names different: declaration 'tok' definition 'startTok'.
    [lib/symboldatabase.h:1176] -> [lib/symboldatabase.cpp:4349]: (style, inconclusive) Function 'findTypeInNested' argument 1 names different: declaration 'tok' definition 'startTok'.
    [lib/symboldatabase.h:1193] -> [lib/symboldatabase.cpp:4501]: (style, inconclusive) Function 'setValueType' argument 2 names different: declaration 'enumerators' definition 'enumerator'.
    [lib/path.h:159] -> [lib/path.cpp:247]: (style, inconclusive) Function 'isCPP' argument 1 names different: declaration 'extensionInLowerCase' definition 'path'.
    [lib/path.h:145] -> [lib/path.cpp:266]: (style, inconclusive) Function 'acceptFile' argument 1 names different: declaration 'filename' definition 'path'.
2017-04-03 00:06:46 +02:00
Daniel Marjamäki abb43b6a81 Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))') 2017-04-02 19:44:33 +02:00
Daniel Marjamäki de80d41ef4 CheckFunctions::checkIgnoredReturnValue: Dont warn in C++11 initializer lists in function arguments 2017-04-02 19:44:27 +02:00
Daniel Marjamäki 6f2db1a312 CHECK_WRONG_DATA: restore debug macro so crashes are seen. 2017-04-02 17:23:30 +02:00
Daniel Marjamäki d403a6a883 Preprocessor::getConfigs: Remove bad configurations when #error is seen 2017-04-02 12:15:53 +02:00
Daniel Marjamäki 7eb95aac2a Preprocessor::getConfigs: Handle #error in '#if !A' better 2017-04-02 10:06:39 +02:00
Daniel Marjamäki 87bc667289 astyle formatting
[ci skip]
2017-04-02 09:26:14 +02:00
Daniel Marjamäki edd1c32e5b Preprocessor::getConfigs: Better handling of ! in #if 2017-04-02 09:03:43 +02:00