Commit Graph

5526 Commits

Author SHA1 Message Date
PKEuS e0b34de090 Implemented #5262: VS solution copies cfg files to output folder. 2014-03-17 12:58:46 +01:00
PKEuS ebd0b43c4f Fixed #5382: False positive "scope can be reduced" when initializing two-dimensional array. 2014-03-17 12:34:39 +01:00
PKEuS d325d14b11 Fixed false positive #5535: Reference named like its type. 2014-03-17 12:01:39 +01:00
PKEuS 50f6bb5d36 Fixed crash #5511. 2014-03-17 11:50:45 +01:00
PKEuS 86e6bb430a New check: Warning, if positioning operation (fseek) is performed on a file opened in "a" mode 2014-03-17 11:02:03 +01:00
PKEuS 1e57f54917 Fixed #5481: std::array is POD, so using memcpy (etc.) is allowed on it. 2014-03-16 19:55:32 +01:00
Lucas Manuel Rodriguez 47ecdf58b2 Fixed #4804 (Improve check for 'std::string::data()' - identical to 'std::string::c_str()') 2014-03-16 15:04:44 -03:00
Lucas Manuel Rodriguez 9a08da17be Fixed #4928 (C++ operator aliases result in false 'assigned a value that is never used' warning) 2014-03-16 14:51:05 -03:00
PKEuS e05fb847df Fixed #3852: Support simplification of C++11 "enum class", fixed existing simplifications 2014-03-16 18:24:46 +01:00
PKEuS 6b16b519a2 Fixed crash on wrong __attribute__((constructor)) syntax 2014-03-16 16:39:07 +01:00
Alexander Mai 825bb0f027 Fixed #5286 (Add signal/exception handling to cppcheck and cppcheck-gui) 2014-03-16 12:04:13 +01:00
Alexander Mai cba1879fee Fixed #5571 (Clean up MathLib::isInt()) 2014-03-16 11:55:44 +01:00
Daniel Marjamäki 8c3f2c2ad9 Revert 894a65b0. abstract interpretation of for loops. there was some crashes and performance problems. I will fix those problems when I have time and recommit. 2014-03-16 08:38:52 +01:00
Alexander Mai 40ddcabab6 Fixed #4461 (Warn about memset/memcpy on class with references as members) 2014-03-15 18:22:29 +01:00
Daniel Marjamäki 894a65b0b1 ValueFlow: Refactor the for-loop handling. Use abstract interpretation. 2014-03-15 11:29:33 +01:00
Daniel Marjamäki ce1aa1e011 Library: I had misunderstood const/pure a little so I corrected cfg and code 2014-03-14 20:08:34 +01:00
Robert Reif 2ba3a36f2c Partial fix for #5555. Improved pure/const attributes handling 2014-03-14 19:06:05 +01:00
Robert Reif e26bd5b99c Fixed #5563 (add __attribute__((destructor)) and improve __attribute__((constructor)) support) 2014-03-14 18:17:21 +01:00
Daniel Marjamäki b2708987c3 Merge pull request #264 from thomasjfox/simplematch
Use simple match where possible
2014-03-14 17:51:45 +01:00
Alexander Mai ff5fc82704 Fixed #4722 (Debugging enhancement: Tokenizer::simplifyTokenList() shall continue) 2014-03-14 17:48:20 +01:00
Daniel Marjamäki a929b2146e Improved checking of const functions in checkIncorrectLogicOperator 2014-03-14 17:37:53 +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
Thomas Jarosch c625606f45 Remove redundant code 2014-03-14 15:56:40 +01:00
Thomas Jarosch c80f272176 Run astyle 2014-03-14 15:51:15 +01:00
Daniel Marjamäki 8c7cf090c4 Merge pull request #261 from orbitcowboy/master
MathLib:isHex(): fix detection of missing suffixes (U,L).
2014-03-14 13:00:35 +01:00
orbitcowboy 74d10cd6d9 Added function MathLib::isValidSuffix() 2014-03-14 11:46:41 +01:00
orbitcowboy 71ee625aab MathLib: replaced isHexDigit function by isxdigit. 2014-03-14 09:33:20 +01:00
Daniel Marjamäki 401b43c36a Merge pull request #263 from trulabs/master
Fix the detection of methods called from Qt's invokeMethod
2014-03-14 08:21:53 +01:00
Daniel Marjamäki 8d8913a168 Partial fix for #5555. Add const,pure attributes to library. 2014-03-14 06:38:45 +01:00
Robert Reif 8c993c1363 Partial fix for #5555. Remember function attributes: pure, const, constructor, destructor 2014-03-14 05:40:17 +01:00
Daniel Marjamäki 5698f7b337 astyle formatting 2014-03-14 05:36:44 +01:00
Sam Truscott 5dc13f3538 Tidy up the code for cppcheck style. 2014-03-13 16:47:00 +00:00
Sam Truscott 3d0524ecc6 Update the detection of the arguments in Qt's invokeMethod.
invokeMethod can invoke functions by name (string) rather than a
direct function call (i.e. reflection). The old code wasn't
correctly parsing out the argument which contained the name
of the function to call.

This resulted in that function being reported as unused when it is.
2014-03-13 16:43:25 +00:00
Daniel Marjamäki 61eb262244 Fixed #5215 (segmentation fault (invalid code) in TemplateSimplifier::useDefaultArgumentValues) 2014-03-12 19:36:22 +01:00
Robert Reif cb1fc06a80 Fixed #5079 (CheckIO::checkFileUsage doesn't support wide char and microsoft functions) 2014-03-12 19:22:44 +01:00
Frank Zingsheim b1dc51ba9c Fixed #4796 (Missing semicolon after simplified template class) 2014-03-12 06:09:45 +01:00
Robert Reif d1eb04c539 Fixed #4302 (Member variable not initialized in public delegate constructor) 2014-03-12 05:48:13 +01:00
Daniel Marjamäki 618c26f6bf Merge pull request #260 from orbitcowboy/master
MathLib::isOct() fix missing detection of U and L suffix combinations an...
2014-03-12 05:30:35 +01:00
Daniel Marjamäki 3b4d024e06 Reverted info message that only applies to CLI 2014-03-11 20:55:02 +01:00
orbitcowboy ed793793db MathLib:isHex(): fix detection of missing suffixes (U,L). 2014-03-11 20:02:04 +01:00
Daniel Marjamäki 94454df14f Fixed #2732 (Make it easier for users to tell 'How to supply header files') 2014-03-11 16:05:19 +01:00
Sam Truscott 385478d89e Reflection no longer part of markup. Some tokeniser not done on markup. 2014-03-11 15:57:28 +01:00
Daniel Marjamäki af0cf9bbc1 Merge pull request #258 from orbitcowboy/master
MathLib::isBin(): fix missing detection of U and L suffix combinations. ...
2014-03-11 06:36:31 +01:00
orbitcowboy 5b4ece4f9c MathLib::isBin(): fix missing detection of U and L suffix combinations. Added missing test cases. 2014-03-10 17:23:07 +01:00
Julian Santander fae8ef48b8 Fixed #5529 (Further control in selecting what configurations to consider) 2014-03-10 15:49:02 +01:00
Martin Ettl 0360840753 MathLib::isOct() fix missing detection of U and L suffix combinations and unittests. 2014-03-09 21:14:14 +01:00
Frank Zingsheim 5e0a575091 Optimization: tokenlist::addtoken 2014-03-09 17:54:49 +01:00
Frank Zingsheim bc1ab4c48a Optimization preprocessor.cpp use string::compare for charT 2014-03-09 14:26:16 +01:00
Frank Zingsheim 6e9e20d5b1 Optimization Tokenizer::simplifyMathFunctions. Make an a priori check whether the token combination can be a function call at all. 2014-03-09 13:22:58 +01:00
Daniel Marjamäki 4d06bc086d astyle formatting 2014-03-09 08:49:32 +01:00
Daniel Marjamäki 7fa73c0d64 Merge pull request #256 from xypron/5505
5505: FP: Array accessed out of bounds
2014-03-09 08:47:18 +01:00
Daniel Marjamäki c7f09d4350 Merge pull request #257 from simartin/ticket_5373_2
Ticket #5373: delete can match %type% in C (take #2)
2014-03-09 08:26:06 +01:00
Alexander Mai 3f30753122 Fixed #5537 (crash: clang ./lib/Basic/FileManager.cpp , since 354e84e7c8 , /lib/symboldatabase.h:288) 2014-03-09 08:17:24 +01:00
Simon Martin a3d1cac79c Ticket #5373: Keep track whether tokens come from a C or C++ file to properly handle %type% in Token::Match with "delete" 2014-03-08 21:26:06 +01:00
Heinrich Schuchardt bd67db96f1 5505: FP: Array accessed out of bounds
CheckBufferOverrun::checkFunctionParameter alreacy considered usage of a
function parameter inside an if block as a special case.

With the patch the same is done for switch statements.

A test is added.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-03-07 19:51:13 +01:00
Daniel Marjamäki 569db24756 astyle formatting 2014-03-06 16:21:57 +01:00
Alexander Mai 354e84e7c8 Fixed #2298 (new check: passing stack-address to free()) 2014-03-06 06:32:30 +01:00
Daniel Marjamäki ca0509e20b Library: Fixed bug I caused when I cleaned up patch 2014-03-06 06:27:01 +01:00
Alexander Mai 1d4839b8a6 Fixed #1374 (false negative: using uninitialized variable in printf) 2014-03-06 06:16:14 +01:00
Daniel Marjamäki bcd230d90d Merge pull request #251 from matthiaskrgr/copyright
man, htdocs, gui, test, tools: bump a few more copyrights to 2014
2014-03-04 05:44:50 +01:00
Daniel Marjamäki dbfe7e0b6b Fixed cppcheck warnings 2014-03-03 19:00:32 +01:00
Pranav Khanna f8a4fb91fe Fixed #3796 (new check: redundant initialization with empty string) 2014-03-03 18:27:45 +01:00
PKEuS 470f1579c1 Incremented version to 1.65dev/1.64.99 2014-03-03 15:07:54 +01:00
Matthias Krüger a9df4a3288 man, htdocs, gui, test, tools: bump a few more copyrights to 2014 2014-03-03 11:03:17 +01:00
Simon Martin 8baf8dbebb Ticket #5425: Avoid infinite recursion in checkMemsetType for invalid input 2014-03-03 07:19:32 +01:00
Daniel Marjamäki 4dee3da1bd Merge pull request #245 from simartin/ticket_5478
Ticket #5478: Only functions and equal operators might return a temporary
2014-03-02 14:53:25 +01:00
Daniel Marjamäki 4842115a56 1.64 : Update versions 2014-03-02 09:55:39 +01:00
Simon Martin 875a3f47e7 Ticket #5478: Only functions and equal operators might return a temporary. 2014-03-02 09:39:10 +01:00
Daniel Marjamäki aec3f18d77 Merge pull request #244 from simartin/ticket_5506
Ticket #5506: Don't crash upon invalid template declaration
2014-03-02 08:54:07 +01:00
Simon Martin 3518e02d23 Ticket #5506: Skip template parameters when determining whether a template is a declaration or a definition. 2014-03-01 14:58:47 +01:00
Daniel Marjamäki bef4739853 Library: the bug in tinyxml has been fixed so the workaround can be removed now 2014-03-01 14:09:03 +01:00
PKEuS 357f5076db Updated tinyxml 2014-03-01 11:15:08 +01:00
Daniel Marjamäki a41a32ba8a Fixed #5469 (CheckBufferOverrun: Use nullptr) 2014-02-28 17:02:03 +01:00
Alexander Mai 50a184c3e9 Fixed #5166 (segmentation fault (invalid code) in lib/checkother.cpp:329 ( void * f { } void b ( ) { * f } )) 2014-02-27 18:24:51 +01:00
Daniel Marjamäki 87c4508954 Spell fix: dont => do not 2014-02-27 16:40:42 +01:00
Alexander Mai a02bbfa47e Fixed #5492 (Fix small bug in MathLib::isFloat()) 2014-02-27 16:08:49 +01:00
Daniel Marjamäki dea4107245 Fix Cppcheck warning 2014-02-26 06:38:48 +01:00
Daniel Marjamäki 7dbfd67da3 Fixed #5493 (False positive: Found a statement that begins with numeric constant / string constant - in the presence of initialization list.) 2014-02-26 06:18:52 +01:00
Daniel Marjamäki 8550289722 Fixed #5452 (AST: wrong handling of unary ::) 2014-02-25 06:36:10 +01:00
Alexander Mai 0747b55485 Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0) 2014-02-24 18:52:31 +01:00
Daniel Marjamäki acf5723bdd AST: improved AST printout when --verbose is used 2014-02-24 17:22:29 +01:00
Daniel Marjamäki 8dd7f02e45 Fixed #5381 (Some false positives that came up when using --enable=performance file.c) 2014-02-23 11:02:39 +01:00
Daniel Marjamäki f6b42633e8 Fixed #5434 (FP: Out-of-bounds access with ternary operator in loop) 2014-02-22 17:59:12 +01:00
Daniel Marjamäki 34730f623a Fixed #5301 (False positive: (error) Division by zero - variables read from input stream) 2014-02-22 12:09:54 +01:00
Daniel Marjamäki 910a90e4c1 Revert "cxx11.h: removed the 'evil workaround'"
This reverts commit 2cb9032d76.
2014-02-21 20:06:55 +01:00
Alexander Mai 82a2279425 Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0) 2014-02-20 16:56:49 +01:00
Daniel Marjamäki ed9153ee80 Symbol database: added simple mismatch check in Scope::findFunction when passing address to function that expects a reference 2014-02-19 06:35:51 +01:00
Daniel Marjamäki 690c37633b ValueFlow: Fixed bad values after break/continue 2014-02-17 20:07:38 +01:00
Daniel Marjamäki c050a92bae Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure) 2014-02-17 17:37:39 +01:00
Daniel Marjamäki d37359217c Merge pull request #241 from lanurmi/more-nullptr
Change some more 0 literals into nullptr.
2014-02-16 23:29:23 +01:00
Lauri Nurmi 70a67eaf85 Change some more 0 literals into nullptr. 2014-02-16 13:38:50 +02:00
Daniel Marjamäki fdcb325d70 DuplicateBranch: Made warning inconclusive since it's in most cases noise 2014-02-16 11:04:27 +01:00
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Lucas Manuel Rodriguez 052840f8f5 Fixed #4818 (New check: Check memset() 2nd parameter) 2014-02-15 15:06:00 -03:00
Daniel Marjamäki 2cb9032d76 cxx11.h: removed the 'evil workaround' 2014-02-15 16:19:50 +01:00
Daniel Marjamäki f0220c5340 astyle formatting 2014-02-15 16:18:13 +01:00
Daniel Marjamäki 209dffbe1b use nullptr in lib/checkmemoryleak.cpp 2014-02-15 16:17:56 +01:00
Daniel Marjamäki 68119f0230 use nullptr in lib/checknullpointer.cpp 2014-02-15 16:12:37 +01:00
Daniel Marjamäki fb5c2d4b48 use nullptr in lib/checkother.cpp 2014-02-15 08:46:28 +01:00
Daniel Marjamäki 720bd48a98 use nullptr in lib/library.cpp 2014-02-15 08:41:17 +01:00