Commit Graph

10432 Commits

Author SHA1 Message Date
Daniel Marjamäki df8cfe2fc6 Travis: Fix Cppcheck warning 2019-03-10 12:24:41 +01:00
Rikard Falkeborn 6a3dd9a185 Handle concatenated string and char literals
This handles concatenated strings and characters from simplecpp.
Previously, L'c' would be preprocessed to the tokens  "L" and "'c'".
cppcheck would then remove the "L" token and set "'c'" to be a wide
character literal. Now, it needs to remove the prefix instead.

When doing this, add handling of utf32 encoded literals (U) and UTF-8
encoded literals (u8).
2019-03-10 10:38:50 +01:00
Daniel Marjamäki 3eb5de756c Buffer overrun: Refactorings; use range for loops and write in message 2019-03-09 22:19:09 +01:00
Daniel Marjamäki 4ce6de39c5 CheckCondition: Moved checks to 'normal' 2019-03-09 22:00:59 +01:00
Daniel Marjamäki ea9b2032c1 CheckClass: Moved checks to 'normal' 2019-03-09 21:38:36 +01:00
Daniel Marjamäki 69c05acd3b CheckBoost: Use 'normal' checking 2019-03-09 20:00:31 +01:00
Daniel Marjamäki 5a42c54d0f CheckBool: Use normal checking 2019-03-09 19:16:07 +01:00
Daniel Marjamäki ac42382cd9 Rewrite CheckBool::checkAssignBoolToPointer to use ValueType 2019-03-09 19:15:06 +01:00
Daniel Marjamäki e17ddfd964 Changed AST for variable declarations with initializations 2019-03-09 19:09:15 +01:00
Daniel Marjamäki 1b4895a579 ValueType: Set ValueType for false/true 2019-03-09 17:27:27 +01:00
Daniel Marjamäki 5a32d2d017 Moved CheckAutoVariables::autoVariables to normal checking 2019-03-09 16:53:43 +01:00
Daniel Marjamäki 38d5712aaa Moved CheckAssert::assertWithSideEffects to normal checking 2019-03-09 16:50:50 +01:00
Daniel Marjamäki b9ac77a31b Uninitialized variables: Fixed false positive 2019-03-09 11:30:45 +01:00
Daniel Marjamäki f36ca56e7d Moved CheckStl::redundantCondition to normal checking 2019-03-09 07:53:49 +01:00
Daniel Marjamäki f9fe6cc96a STL: Removed auto_ptr checking. 2019-03-09 07:48:01 +01:00
Daniel Marjamäki d7a645dcc3 Moved CheckStl::uselessCalls to normal checking 2019-03-09 07:37:08 +01:00
Rikard Falkeborn a53b016414 checknullpointer: Remove duplicated include (#1732) 2019-03-08 20:55:09 +01:00
Daniel Marjamäki 45a0c2ebf5 Revert "Moved CheckStl::checkAutoPointer to normal checking"
This reverts commit 6dc9727ffd.
2019-03-08 20:53:37 +01:00
Daniel Marjamäki 6dc9727ffd Moved CheckStl::checkAutoPointer to normal checking 2019-03-08 20:41:28 +01:00
Daniel Marjamäki 95a20c0233 Moved CheckStl::string_c_str to normal checking 2019-03-08 20:39:43 +01:00
Daniel Marjamäki fdf1d6fdee Moved CheckStl::erase to normal checking 2019-03-08 20:36:40 +01:00
Daniel Marjamäki fdfe39299c Moved CheckStl::pushback to normal checking 2019-03-08 20:33:16 +01:00
Daniel Marjamäki 5fe48f3cd2 Moved CheckStl::mismatchingContainers to normal checking 2019-03-08 20:31:00 +01:00
Daniel Marjamäki b91bb2e523 Moved CheckStl::iterators to normal checking 2019-03-08 20:28:28 +01:00
Daniel Marjamäki 8f2d70e61d Move CheckStl::if_find to normal checking 2019-03-08 20:23:37 +01:00
Daniel Marjamäki 725abbfac3 Move CheckStl::missingComparison to normal checks 2019-03-08 20:19:40 +01:00
Daniel Marjamäki 75ce67f4b8 Fixed #9027 (cppcheck on Centos 7 - segmentation fault below CheckCondition::multiCondition2) 2019-03-08 19:27:20 +01:00
Sebastian c8003d47e2
checkuninitvar.cpp: Use argument direction "out" info from library cfg (#1730)
CheckUninitVar::isMemberVariableAssignment uses argument direction "out"
now also to check for assignment when the member variable is handed over
to a function by reference.
testuninitvar.cpp: Improve tests, use a test library configuration.
2019-03-08 18:42:24 +01:00
amai2012 eb9edbc177 #9024 Crash caused by package "procserv" in lib/token.h:921 function Token::getKnownIntValue - Fix and test for alternative code example. 2019-03-08 11:07:33 +01:00
Daniel Marjamäki 6eaf2c03d9 CheckOther::checkInvalidFree: Move check to normal checking. And clarify the message. 2019-03-07 06:35:44 +01:00
Daniel Marjamäki 17e73fd144 Move CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse to Normal checking 2019-03-06 21:27:19 +01:00
Daniel Marjamäki f20936ed8a Moved CheckOther::checkPassByReference to normal checking 2019-03-06 20:59:45 +01:00
Daniel Marjamäki 9d5f672dbc Unused struct member: Fix FPs seen in daca@home results for template structs 2019-03-06 20:51:48 +01:00
Daniel Marjamäki 572d7eb86c Moved CheckOther::clarifyCalculation to normal checking 2019-03-06 20:43:28 +01:00
Daniel Marjamäki ee9053f219 Moved CheckOther::checkRedundantCopy() to normal checking 2019-03-06 20:38:13 +01:00
Sebastian 6228ea2266
checkuninitvar.cpp: Use argument direction info from library config. (#1728)
CheckUninitVar::isMemberVariableAssignment uses argument direction
to check for assignment when the member variable is handed over to a
function by reference. Currently implemented for "in" direction. "out"
will be added with another commit.
2019-03-06 19:26:38 +01:00
Daniel Marjamäki ad37664e86 Changed severities 2019-03-06 19:00:58 +01:00
Daniel Marjamäki c32d015337 Fixed false positives from terminateStrncpy 2019-03-06 18:50:50 +01:00
Daniel Marjamäki 3f37d5ac2d Refactoring strncpy/strncat checking to use ValueFlow and AST 2019-03-06 09:04:04 +01:00
Daniel Marjamäki 37814513f8 Revert "Moved all simplified CheckOther checks from simplified to normal checking"
This reverts commit 2900690881.
2019-03-06 07:08:56 +01:00
Daniel Marjamäki 2900690881 Moved all simplified CheckOther checks from simplified to normal checking 2019-03-06 06:33:51 +01:00
Daniel Marjamäki 06c2019676 Moved CheckOther::checkPipeParameterSize from simplified to normal checking 2019-03-06 06:28:13 +01:00
Carlo Marcelo Arenas Belón cb973cbb7b lib: reorders settings to match definition (-Wreorder) (#1727)
lib/settings.cpp:53:7: warning: field 'removeUnusedIncludedTemplates' will be
      initialized after field 'removeUnusedTemplates' [-Wreorder]
      removeUnusedIncludedTemplates(false),
      ^
lib/settings.cpp:54:7: warning: field 'removeUnusedTemplates' will be
      initialized after field 'checkConfiguration' [-Wreorder]
      removeUnusedTemplates(false),
      ^
2019-03-06 06:12:02 +01:00
Daniel Marjamäki fda0f52424 Add --remove-unused-templates flag to remove all unused templates 2019-03-05 14:58:02 +01:00
IOBYTE 5ee6c2138c Fixed #9016 (tokenizer: wrong simplification for operator ^ (){}) (#1724) 2019-03-05 11:35:45 +01:00
Sebastian 0934577dda
Library configuration: function argument direction fixes and enhancements (#1722)
* std.cfg: Add further argument directions (in, out, inout).

* testlibrary.cpp: Add test for function argument direction configuration.

* std.cfg: runastyle and add some more direction configurations.

* library.h: Add documentation for function argument direction enum.

* Do not use "direction" library information for pointer arguments.

Also fix further unmatched uninitvar messages in std configuration
tests.

* std.cfg: Add more argument direction configurations.

* test/cfg/std.c: Add test for argument direction configuration.

* astutils.cpp: Only ignore pointer arguments for out/inout arguments.

* library.h: Use suggested documentation for argument direction enum.
2019-03-04 22:57:40 +01:00
Daniel Marjamäki 3675318208 Added --remove-unused-included-templates option 2019-03-04 19:10:49 +01:00
Daniel Marjamäki c5a512338e --check-headers=no: remove more templates in headers that are not used in the source file 2019-03-03 20:18:54 +01:00
IOBYTE 40d7d5a3d0 template simplifier: fix return type of out of line member function when it is a template parameter (#1723) 2019-03-03 19:42:46 +01:00
Daniel Marjamäki 41db8afe87 --check-headers=no: remove templates in headers that are not used in the source file 2019-03-03 12:56:37 +01:00