Commit Graph

1301 Commits

Author SHA1 Message Date
PKEuS b4b38fb7ce Use ValueType in CheckOther::invalidPointerCast()
False negative: operator new is currently not supported by ValueType.
2016-02-05 20:28:43 +01:00
PKEuS 841f17776b Set ValueType for assignment operators, detect division by zero for %= and /= again (#7322) 2016-02-02 17:17:55 +01:00
PKEuS 9d2258677d Improved CheckOther::checkUnusedLabel(): Write a warning instead of a style message if it happens inside a switch() 2016-01-31 12:07:24 +01:00
Daniel Marjamäki 5e10e680da CWE: refactoring. use constants instead of magic numbers. 2016-01-25 20:01:48 +01:00
Roberto Martelloni 5ce69da02d Mapped 26 errors to their CWEs ID. 2016-01-24 20:53:05 +00:00
Daniel Marjamäki 79aec559d5 Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause) 2016-01-18 16:10:51 +01:00
Matthias Krüger 7b1710a44f redundantAssignment: change from severity 'performance' to 'style' since avoiding unneccessary stores is a basic optimization done by compilers. 2016-01-15 22:01:40 +01:00
Matthias Krüger e9e496199c CheckOther::memsetZeroBytesError: remove now unused parameter.
was:
lib/checkother.cpp:1116:76: warning: unused parameter ‘varname’ [-Wunused-parameter]
 void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varname)
                                                                            ^
2016-01-12 23:55:02 +01:00
Alexander Mai 7802517a69 #7285 wrong var name: memset() called to fill 0 bytes of '&' memset with pointer: remove var name from message. Correct some entries in posix.cfg. 2016-01-12 23:20:48 +01:00
Daniel Marjamäki b2386fa011 minor refactoring, use 'else if' when appropriate 2016-01-06 15:49:44 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 8171154e12 Fixed #7230 (Confusing code snippet in error message) 2015-12-31 01:15:49 +01:00
Daniel Marjamäki bd1037e95b Fixed #7242 (False positive unknownEvaluationOrder - comma expression in function argument) 2015-12-29 12:06:42 +01:00
Daniel Marjamäki 0ddb5c12ce Fixed #7238 (False positive unknownEvaluationOrder for comma operator on C code) 2015-12-28 13:45:55 +01:00
Daniel Marjamäki 908bc664a4 Evaluation order: ignore usage in sizeof 2015-12-27 14:08:16 +01:00
Daniel Marjamäki c672210e06 Evaluation order: don't warn for 'dostuff(expr++, &expr)' 2015-12-26 15:48:43 +01:00
Daniel Marjamäki e6ff77d825 Evaluation order: Don't use this checker on C++11 code 2015-12-25 18:57:59 +01:00
Daniel Marjamäki 90148ce2a1 Evaluation order: Only use this checker on non-C++11 code 2015-12-25 18:49:34 +01:00
Daniel Marjamäki 55779a5772 Evaluation order: Only use this checker on non-C++11 code 2015-12-25 18:45:46 +01:00
Daniel Marjamäki 24438c326e Fixed #7233 (Fasle negative 'unknownEvaluationOrder in case of macro) 2015-12-25 18:31:21 +01:00
Daniel Marjamäki 27af1bcfd8 Fixed #7229 (Improve check; unknown evaluation order, write different message for self assignment) 2015-12-25 18:00:19 +01:00
Daniel Marjamäki 90a54b1fae Fixed #7232 (False positive unknownEvaluationOrder on id = Remap( id += 42 );) 2015-12-25 16:45:11 +01:00
PKEuS 940d569980 Refactorization: Removed redundant %any% patterns. 2015-12-24 14:40:48 +01:00
Daniel Marjamäki 81f0597316 Fixed #3206 and #7226 (New check: Undefined execution order) 2015-12-24 09:13:20 +01:00
Daniel Marjamäki 0baad496f2 Fixed #6383 (FP shiftNegative - value converted to unsigned in function argument) 2015-12-14 10:55:23 +01:00
PKEuS 57e9954390 Merge pull request #715 from Dmitry-Me/eliminateRepeatedLookup3
Remove repeated lookup
2015-12-07 10:47:37 +01:00
Dmitry-Me f00a73f1a1 Remove repeated lookup 2015-12-07 11:57:04 +03:00
Alexander Mai 9d8dffbd79 #6269 false positives in case of overloaded standard library functions. Detect memset() with proper argument cound, using new function numberOfArguments() 2015-12-06 12:50:05 +01:00
PKEuS b8d39a2229 Refactorizations:
- Improve performance of simplifyTypedef by using Token::simpleMatch by ~15%
- Simplified code in simplifyTypedef
- Ran AStyle
2015-12-02 23:32:50 +01:00
Dmitry-Me 0a3959f201 Remove duplicate check 2015-12-02 17:28:21 +03:00
Dmitry-Me 8f8a0097fe Detect more non-interlocked accesses 2015-12-02 10:58:57 +03:00
Daniel Marjamäki fb8cce647c invalidTestForOverflow: Refactor; move from checkother to checkcondition 2015-11-30 08:51:15 +01:00
Daniel Marjamäki f6f4f27636 CheckOther::checkInvalidTestForOverflow: minor fix, only warn when warnings are enabled. 2015-11-29 22:03:42 +01:00
Daniel Marjamäki 26a07265a8 Fixed #7184 (Invalid test for overflow 'p + x < p') 2015-11-29 20:59:50 +01:00
Daniel Marjamäki 4fa888ec44 Warn when shifting a negative value, it is UB. (#4931) 2015-11-29 16:28:55 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
PKEuS f516de8633 Moved a few checks from CheckOther to CheckFunctions 2015-11-22 13:49:10 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Alexander Mai 65666a1ba4 Makefile: explicit list directories which should be used with ctags. Run astyle. 2015-11-15 19:03:18 +01:00
amai2012 f0bf749621 #7133 crash: Variable::declarationId(). 2015-11-15 19:01:29 +01:00
PKEuS 1589841cb6 Fixed crash in clang test suite with member variable pointers 2015-11-11 18:26:59 +01:00
PKEuS 36c5815ddb Fixed false positive about redundant variable assignment in try-scopes if the variable is read in catch block (#6555) 2015-11-11 17:21:55 +01:00
Simon Martin 1ec3175c99 Silence clang warning (-Wparentheses mode). 2015-11-10 08:12:36 +01:00
PKEuS f15f8514f6 Fixed crash on garbage code (#7120) 2015-11-09 17:25:20 +01:00
PKEuS c7987ad11a Refactorization: Removed redundant nullptr checks. The existence of the tokens is guaranteed by previous Token::Match() call 2015-11-09 11:12:32 +01:00
PKEuS ee58587706 Fixed false positive unreachableCode when ternary operator is used (#6664) 2015-10-26 08:29:43 +01:00
PKEuS f637b84192 Fixed various false positives with --check-library (#6545, #6630) 2015-10-26 08:16:50 +01:00
PKEuS 2eb8492993 Fixed crash on garbage code #7034 2015-10-09 13:49:17 +02:00
Daniel Marjamäki a500f6f703 Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better. 2015-10-08 19:50:10 +02:00
Daniel Marjamäki f5d9ba9cf3 Rewrote the charvar checker. It now uses valueflow also to limit false negatives. 2015-10-06 17:30:51 +02:00
Dmitry-Me 662e3c8b8c Omit unneeded match checks 2015-09-07 18:35:15 +03:00
Dmitry-Me cd4f3cf8db Treat checks as mutually exclusive 2015-09-04 10:42:26 +03:00
Dmitry-Me 7287b1a251 Avoid unneeded match checks 2015-09-03 18:30:05 +03:00
Dmitry-Me 0f073ad27e Quick check to omit useless heavy matches 2015-09-03 13:09:57 +03:00
PKEuS c5a8ecb6f9 New check: Detect unused 'goto' labels (#5124) 2015-08-30 16:45:47 +02:00
Simon Martin 6fb19b02d0 Properly differentiate arrays of pointers and pointers to arrays. 2015-08-25 21:19:19 +02:00
PKEuS ab8afec3eb Refactorizations:
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
PKEuS b77912a0b5 Support namespaces in CheckOther::checkIgnoredReturnValue() 2015-08-15 12:19:14 +02:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Matthias Krüger 391194579c CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates" 2015-08-11 13:27:55 +02:00
Alexander Mai 66676b8e55 Warning selfAssignment was only issued if style was enabled. 2015-08-09 13:45:35 +02:00
Daniel Marjamäki c9e239afbf Fixed #6908 (False positive: Same expression on both sides of '+='.) 2015-08-07 20:28:25 +02:00
Daniel Marjamäki ec3d76be5e astyle formatting 2015-08-07 20:27:32 +02:00
amai2012 53feb88614 Merge pull request #630 from Dmitry-Me/detectRaceInInterlockedAccess
Prototype for detecting non-interlocked check after InterlockedDecrement()
2015-08-06 15:43:10 +02:00
Dmitry-Me 43800a9419 Detect non-interlocked check after InterlockedDecrement() 2015-08-05 12:20:28 +03:00
Daniel Marjamäki e598b07a6d Moved functions to astutils 2015-08-03 09:20:50 +02:00
Alexander Mai 96c3c111fc Refactoring: Move some AST related functions to distinct source file 2015-08-02 21:57:32 +02:00
Alexander Mai 965a034afd Fix some more false positives on zerodiv: error should be issued if type of epxression is known to be integral 2015-08-01 18:42:17 +02:00
Alexander Mai f91ad9bbf6 5402 false positive: (error) Division by zero -- with boost::format 2015-08-01 17:28:54 +02:00
Daniel Marjamäki 503fb485cf Removed hardcoding of functions from checkZeroDivision 2015-07-30 13:48:51 +02:00
Daniel Marjamäki 594d30f7ae Fix Cppcheck warning about unused variable 2015-07-29 20:26:00 +02:00
Daniel Marjamäki 6790d91fbb Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884. 2015-07-29 19:54:57 +02:00
PKEuS 738057229c Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
Handle sizeof in isSameExpression() (#6851)
2015-07-29 14:28:24 +02:00
Daniel Marjamäki 389aec51ae Fixed #6598 (False positive zerodivcond - cast to double ignored) 2015-07-26 22:08:36 +02:00
Daniel Marjamäki 75f922e799 cleanup checkother 2015-07-22 18:48:43 +02:00
Daniel Marjamäki 0dd008e068 Fixed Cppcheck warning about possible null pointer dereference 2015-07-08 16:06:35 +02:00
Daniel Marjamäki 5a9328f26a Fixed Cppcheck warning about possible null pointer dereference 2015-07-08 13:41:27 +02:00
Alexander Mai 56e90f95d9 Corrections for non-Microsoft compilers 2015-06-28 12:34:08 +02:00
amai2012 649a89d308 Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
amai2012 99524b1f59 #6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther 2015-06-22 11:12:46 +02:00
Alexander Mai 4172011e78 Missing update for Makefile. CheckMemoryLeakInFunction::getcode(): skip some C++ token matching in C mode. Minor refactoring 2015-06-20 22:49:28 +02:00
Daniel Marjamäki 63f39ea48f Change unusedScopedObject severity from error to style. The checker does not determine that there is ub or wrong behaviour. 2015-06-20 11:22:15 +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
Daniel Marjamäki 3986c0dc64 fixed cppcheck warnings 2015-06-10 19:07:04 +02:00
Daniel Marjamäki 0836bf3d33 astyle formatting 2015-05-27 20:26:26 +02:00
amai2012 729b240d9c Refactoring (compiler warnings and a typo) 2015-05-25 23:15:59 +02:00
Alexander Mai e28e9be82f Add TODO testcase for #5738. Refactoring: add some const 2015-05-25 08:20:14 +02:00
PKEuS 22fbc18fb7 Fixed false positive for *a++ in for-loop condition
Moved unit test to testgarbage.cpp
2015-05-07 20:34:57 +02:00
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +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
Matthias Krüger eedcb6abcb move setting flags checks out of for loops, make them const. 2015-04-07 07:23:28 +02:00
Matthias Krüger 988acf11b4 don't print warning message if --enable=warning is not given.
message was of type:
(warning) Passing value 0 to foo() leads to implementation-defined result.
2015-04-06 13:37:27 +02:00
Dmitry-Me ba423185b8 Omit uneeded checks 2015-04-02 10:26:19 +03:00
PKEuS d6751a7987 Merge pull request #537 from Dmitry-Me/decouplePatternMatchingFromOtherChecks
Decouple pattern matching from other checks
2015-03-15 08:50:59 +01:00
Dmitry-Me 43a19dee8b Remove unneded deep copy, make reference const 2015-03-14 13:45:21 +03:00
Dmitry-Me 74417699db Remove redundant break 2015-03-06 18:55:47 +01:00
Daniel Marjamäki 6646a896f9 Fixed #6446 (FP zerodivcond on double arithmetics) 2015-03-03 15:50:31 +01:00
Dmitry-Me 10b762da98 Decouple pattern matching from other checks 2015-02-27 13:09:06 +03:00
Dmitry-Me d7365519a5 Cache and reuse value 2015-02-26 11:48:15 +03:00
Daniel Marjamäki fb5cc6fded Fixed #5905 (isSameExpression: comparisons 'a<b' and 'a>b' are same) 2015-02-23 16:38:55 +01:00
PKEuS 5f31242ee8 CheckOther::checkRedundantAssignment(): Bail out on inline assembly (#6525) 2015-02-22 12:03:53 +01:00
PKEuS bae95b4560 Fixed noise in CheckOther::checkLibraryMatchFunctions(). 2015-02-21 12:39:02 +01:00
PKEuS 6227abac73 Fixed GCC (testsymboldatabase.cpp) and MSVC (checkother.cpp) warnings 2015-02-18 21:19:36 +01:00
Alexander Mai 0a6babea74 #6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg 2015-02-16 22:19:51 +01:00
Dmitry-Me 56747e4af9 Reorder checks 2015-02-16 12:11:13 +03:00
Dmitry-Me 5674b3c49d early break in loop for readability 2015-02-13 16:36:20 +01:00
Dmitry-Me 1f31dd749b Break loop early 2015-02-04 10:47:58 +03: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 0488f45a5f Removed standalone check CheckOther::checkDoubleFree(), integrated (most of) the functionality into CheckLeakAutoVar. Added support for new/delete to checkLeakAutoVar. 2015-01-28 17:38:43 +01:00
Daniel Marjamäki 3285f85ebf Fixed #6460 (Library: better function/type matching) 2015-01-27 17:55:18 +01:00
Thomas Jarosch 58cb6cc116 Add new "style" check to catch redundant pointer operations
Doing "&*some_ptr_var" is redundant and might be the remainder
of a refactoring. Warnings for expanded macros are excluded though:
They are often used with and without pointers and
do something like this: "func(&(*macroarg))".

The new check is fully AST based and was given
strong false positive testing on a large code base.
2015-01-18 00:34:07 +01:00
Daniel Marjamäki 6a8293a8b7 Library: More strict matching of functions 2015-01-08 19:31:41 +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 fb685f096a CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?: 2015-01-05 10:01:04 +01:00
PKEuS 267552779d Improved check (#6391): Detect identical code in both branches of ternary operator 2015-01-03 18:01:49 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS a3fbc5aee5 Refactorization: Avoid stringification of second branch if first branch was empty in CheckOther::checkDuplicateBranch() 2015-01-02 11:24:28 +01:00
PKEuS 9e8a66ee40 Fixed #6373: Support bitops in clarifyCalculation check 2014-12-30 17:55:29 +01:00
PKEuS 990d14f3e2 Fixed #6328: Use isAttributeNoreturn() whereever we also check Library::isnoreturn(). 2014-12-27 11:07:36 +01:00
Daniel Marjamäki 0c086cf247 Incomplete statement: tweaked bailout for '0;' statement using isExpandedMacro() 2014-12-24 21:47:37 +01:00
Daniel Marjamäki 90bd38a972 Renamed isCasted to isCast 2014-12-24 10:35:40 +01:00
Daniel Marjamäki de1a91f30d Incomplete statement: tweaked bailout for '(void*)0' using isCasted() 2014-12-23 18:19:33 +01:00
Thomas Jarosch d5e10c18d3 checkUnreachableCode(): fix FP for statements that just hide compiler warnings about unused function arguments
Seen throughout the rockbox codebase.
2014-12-22 11:18:23 +01:00
Daniel Marjamäki 293dc1efc7 Fixed #6327 (Unwanted constStatement on (void)0) 2014-12-21 13:42:21 +01:00
Dmitry-Me c0d2933ec7 Reorder checks to avoid redundant actions 2014-11-30 16:14:53 +03:00
PKEuS 4163f1e122 Fixed #6260 - C++11 style array initialization 2014-11-18 19:50:09 +01:00
Dmitry-Me 353b885948 CheckOther::invalidPointerCast: Incorrect interpretation of settings 2014-11-14 20:22:17 +01:00
Dmitry-Me fefb0ca912 Reuse previously computed values 2014-11-14 13:24:56 +03:00
Dmitry-Me cb9a6c1cb5 Don't show warning for same expressions alongside == in static_assert 2014-11-13 16:04:34 +01:00
Frank Zingsheim 7e0fc3d481 Fixed #6252 (False positive "freed twice")
--HG--
extra : rebase_source : 24f801452fbefa3a59ab2cca62c3cf02aea513b6
2014-11-03 21:24:34 +01:00
PKEuS 662283cab8 Refactorization: Avoid iterations over whole token list, limited several checks to function scopes. 2014-10-31 11:42:54 +01:00
PKEuS b5ea677180 Some fixes for CheckOther::checkIgnoredReturnValue():
- Fixed name of the function
- Fixed false positive for code like "class strcmp { strcmp() {} };"
- Fixed FP #6233 on checking side (no AST generated for function call)
2014-10-30 23:24:13 +01:00
PKEuS b7996bd0b0 Handle overloads and custom implementations of functions checkReturnIgnoredReturnValue() to avoid false positives 2014-10-30 21:26:32 +01:00
Daniel Marjamäki 0a1a34b9b7 Fixed Cppcheck warning, possible null pointer dereference of tok. 2014-10-18 10:59:48 +02:00
Samuel Degrande 96e8b83bf8 Fixed newline in verbose message 2014-10-16 09:08:39 +02:00
orbitcowboy 5a4526e997 Fixed typos in comments, no functional changes. 2014-10-02 04:39:41 +02:00
PKEuS 374ea8f039 Fixed false positive ignoredReturnValue on unknown member function log() (#6197) 2014-09-29 19:55:32 +02:00
Martin Ettl a7c870bdc8 Fixed crash on garbage code in CheckOther::checkVariableScope(). The corresponding backtrace is hosted at https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash223.cpp 2014-09-29 19:44:25 +02:00
PKEuS 1495a411eb Fixed false positive ignoredReturnValue for variables initialized with constructor syntax (#6194) 2014-09-29 10:15:29 +02:00
PKEuS 03b1afc28c Loops over all varIds should start at 1. 2014-09-28 09:47:11 +02:00
PKEuS 210294443e New check: Check for unused return values (#653) 2014-09-27 21:31:04 +02:00
PKEuS cafddcb109 Fixed wrong function log10 being recommended instead of log1p 2014-09-14 13:36:12 +02:00
Daniel Marjamäki 0e55f12140 Fixed #6165 (Remove old checkUnsignedDivision checker that uses neither AST nor ValueFlow. The CheckType::checkSignConversion should be much more accurate) 2014-09-12 16:59:16 +02:00
PKEuS 6f92557478 Use information about pure/leak-ignore from library to improve accuracy of several bailouts 2014-09-11 20:27:07 +02:00
PKEuS c1b0bfe4ee Simplified code 2014-09-11 20:27:01 +02:00
PKEuS fb0d145b34 Don't show inconclusive message redundantCopyLocalConst if --inconclusive is not set.
Ran AStyle
2014-09-11 19:45:52 +02:00
Daniel Marjamäki 7847263451 Fixed #6158 (New check: dangerous sign conversion) 2014-09-11 18:10:19 +02:00
PKEuS 865fc9aa67 Fixed #6154: Don't suggest to reduce scope if inner scope is a lambda. 2014-09-10 20:56:34 +02:00
Daniel Marjamäki a46f5c00a8 Minor tweaks for new CheckOther::checkIntegerOverflow checker 2014-09-10 17:26:20 +02:00
Daniel Marjamäki 974c8688c3 Fixed #1751 (Undefined Behavior: Signed integer overflow) 2014-09-10 17:02:18 +02:00
Daniel Marjamäki a36b0e55be CheckOther::checkTooBigBitwiseShift: improving error messages 2014-09-09 17:06:45 +02:00
Daniel Marjamäki f111a89639 Fixed #1757 (Undefined Behavior: Shift too many bits) 2014-09-09 07:24:59 +02:00
Martin Ettl 0ced0c33e5 Fixed #6149: (gcc) warning: comparing floating point with == or != is unsafe. Using Tokenizer::isOneNumber function to compare a floating point number being 1.0. 2014-09-08 20:02:04 +02:00
PKEuS 301b668eb5 Fixed internal warning of cppcheck 2014-09-07 11:47:40 +02:00
PKEuS ff4fc6a234 New check: Recommend expm1, log1p, erfc (#5392) 2014-09-07 11:38:49 +02:00
Alexander Mai efab840b50 #5230 Explicit reinterpret_cast should not give a warning. Lower all invalidPointerCast messages to 'portability' 2014-09-06 13:09:02 +02:00
Alexander Mai 29b46cb505 #6132 crash: daca: kvirc CheckOther::checkRedundantAssignment() 2014-09-05 20:03:34 +02:00
PKEuS e8f7279039 Refactorization: Moved detection of STL strings to SymbolDatabase 2014-09-05 12:03:08 +02:00
PKEuS 800b57d87e Merge pull request #415 from Dmitry-Me/reducePatternsDuplication
Reduce patterns duplication
2014-09-04 07:46:59 +02:00
Alexander Mai 45dc4ca6be Fix compiler warning. Re-order if-expression for performance reasons 2014-09-02 19:18:30 +02:00
Dmitry-Me 46d24c7bfb Reduce patterns duplication 2014-09-02 19:51:22 +04:00
PKEuS ddc19febb5 Merge pull request #413 from Dmitry-Me/improveCStyleCastsDetection
Improve C style casts detection
2014-09-02 08:07:53 +02:00
PKEuS 428f7a6f26 Attempt to fix crashs on clang test suite. 2014-09-01 23:29:15 +02:00
PKEuS 00044aabb0 Handle ternary operator in redundantAssignment check (#5964) 2014-09-01 23:16:52 +02:00
Alexander Mai a4ff30301a #5805 'Passing value -1.0 to sqrt() leads to undefined result' is incorrect. Degrade wrongmathcall from error to warning, since it deals with implementation-defined behaviour 2014-09-01 19:31:32 +02:00
Dmitry-Me f937dde1e0 Improve C style casts detection 2014-09-01 16:40:28 +04:00
PKEuS c92230dfee Fixed crash on garbage code introduced by recent commit. 2014-09-01 12:41:30 +02:00
PKEuS 20a066bb14 Run unreachableCode checking only on executable scopes (#5789) 2014-09-01 11:29:39 +02:00
PKEuS b5e064e737 Fixed unreachableCode message if a lambda is returned (#6008). 2014-09-01 11:10:42 +02:00
PKEuS 353a9e9a64 Bailout for duplicateBranch check if branches are empty (#5354) 2014-09-01 10:19:14 +02:00
PKEuS e9fdfc6cd0 Fix on checking side for #6099 2014-08-30 11:18:48 +02:00
PKEuS 06a92e8981 Moved several condition checks from checkOther to checkCondition (former checkAssignIf) 2014-08-29 17:06:46 +02:00
PKEuS eba8c6f6c5 Refactorization:
- Added missing separating comments between checks in checkother.cpp
- Moved checks related to strings into own file
2014-08-27 09:42:09 +02:00
PKEuS 7f2be2f57c Fixed template bracket linkage in while loop simplification
Ran AStyle
2014-08-23 12:28:54 +02:00
amai2012 976966fe81 #5639 String literal compared with char buffer in a struct. 2014-08-23 09:41:40 +02:00
PKEuS 0bf7b03f96 Refactorization: Support :: in some places in checkother.cpp 2014-08-18 10:25:30 +02:00
Daniel Marjamäki d44d6ad94a incorrect logic operator: fixed crashes 2014-08-18 05:37:07 +02:00
Daniel Marjamäki ebc0b6cd44 astIsFloat: Fix crash when there is no second operand for '.' 2014-08-17 14:28:31 +02:00
Daniel Marjamäki f7f44f24c7 Fixed #5132 (False negative: incorrectLogicOperator in simple if-clause) 2014-08-17 14:04:40 +02:00
Daniel Marjamäki 364c975701 Fixed #5557 (astIsFloat: better handling of '.') 2014-08-15 16:48:53 +02:00
PKEuS 5d302716e7 Refactorized Variable::isIntegralType() and Variable::isFloatType():
- Cached property
- Make use of it in several checks
- float* is flagged as floating point type
2014-08-09 11:45:13 +02:00
PKEuS c3577bc8dd Fixed crash, simplified code in testassert.cpp 2014-08-06 12:24:21 +02:00
PKEuS d3a567bf96 Fixed false positive #5824: Variables that might be used for va_start() must not be passed by reference. 2014-08-06 12:06:36 +02:00
PKEuS 4a3d719386 Fixed recently introduced FP when C-Style casting nullpointers 2014-08-04 11:42:14 +02:00
PKEuS 4c80ca4e8e Improved cstyleCast check:
- Detect casting of literals
- Check initializer lists (#3630)
2014-08-04 11:21:25 +02:00
Daniel Marjamäki 8a1c5d6fce Fixed #6011 (crash: libreoffice/binfilter svt_enhwmf.cxx) 2014-07-28 16:33:42 +02:00
Daniel Marjamäki fdfea717c6 Suspicious string comparison: Refactoring using AST. Fixed FP in Lac. 2014-07-28 14:27:35 +02:00
Daniel Marjamäki 76020d2ad0 astIsFloat: expression 'floatvar ? 0x40 : 0' is not float 2014-07-26 09:09:58 +02:00
Dmitry-Me 07c120f1af Cache option flags and check them first. 2014-07-23 17:06:27 +04:00
Daniel Marjamäki 2cc31acabb Fixed #5922 (FP: passedByValue for std::string::value_type) 2014-07-18 15:51:59 +02:00
Daniel Marjamäki bf5b4d9ece astyle formatting
[ci skip]
2014-07-14 14:38:40 +02:00
Dmitry-Me 9829e0b48a Clearer variable names, fix typo in comment. 2014-07-11 11:33:09 +04:00
Dmitry-Me ba3757dfd3 Bring variables decalaration to where they are really needed. 2014-07-10 11:23:14 +04:00
Daniel Marjamäki d40b77dce2 Removed special 'else if' handling. this is redundant since these are simplified. 2014-07-02 16:16:19 +02:00
Daniel Marjamäki 5e9e90b1c1 Fixed Token::Match pattern. In x|y|.. patterns, all %cmd% should be placed before plain-text operands. 2014-07-01 15:55:29 +02:00
Daniel Marjamäki 41baffdda1 Fixed #5850 (Wrong Message on self assignment) 2014-06-28 15:26:22 +02:00
orbitcowboy 16352ca674 Reverted fix 6d0f490138, but keeping the testcase in the testsuite. 2014-06-06 14:44:22 +02:00
orbitcowboy 6d0f490138 #5895 - Fixed potential signed integer overflow in Checkother:getvalue. Added regression test. 2014-06-05 16:41:10 +02:00
orbitcowboy e9144d1a78 Fixed #5890 - crash: wesnoth desktop_util.cpp / unicode.hpp. 2014-05-29 02:58:18 +02:00
Daniel Marjamäki 66ad3c97b9 Fixed #5857 (strPlusChar: Crash on invalid code 'int+;') 2014-05-31 10:34:00 +02:00