Commit Graph

5260 Commits

Author SHA1 Message Date
orbitcowboy b74db1b791 Tokenize:simplifyFloatCast(): added corresponding suffix, incase of type 'float'. 2013-11-20 23:58:43 -08:00
Alexander Mai 7d45e9be73 Fixed #5122 (duplInheritedMember on private variables) 2013-11-21 05:39:23 +01:00
Daniel Marjamäki ef108c49ec Tokenizer: simplify enums better. add parentheses to enforce operator precedence. 2013-11-20 18:04:28 +01:00
Daniel Marjamäki e8eeb90adb AST: Fixed 'same expression' false positives (git merge --squash s, <<, >>) 2013-11-20 16:18:09 +01:00
orbitcowboy 1798fc3645 testtokenize:simplifyFloatCasts(): Added testcases for double and long double. 2013-11-17 08:44:05 -08:00
Daniel Marjamäki 27a40b10e1 AST/incorrectLogicOperator: Better handling of large doubles where x+1=>x 2013-11-20 06:33:34 +01:00
Daniel Marjamäki 6869d0de30 AST: Handle L'x' 2013-11-20 05:57:56 +01:00
Daniel Marjamäki 47b98470eb Tokenizer: Simplify float casts of integer constants 2013-11-19 18:07:12 +01:00
Daniel Marjamäki f8cf64afef Fixed #4710 (Template parser bug: const in constructor changes template names) 2013-11-19 06:07:25 +01:00
Daniel Marjamäki ff5f223a1d Fixed #5116 (false positive: memset on class (nested struct)) 2013-11-18 16:56:00 +01:00
Daniel Marjamäki 033cb19656 Same expression: Don't write warnings for same expression on both sides of arithmetical operators 2013-11-17 17:21:39 +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 2a640a59c2 Tokenizer: Improved handling of pointer aliases. This fixes some false negatives. 2013-11-16 17:30:04 +01:00
Daniel Marjamäki cfd6b0c384 UninitVar: fixed false negatives for function calls 2013-11-16 12:02:21 +01:00
Daniel Marjamäki 8c7e3d14aa Fixed #5119 (Preprocessor: Using -D suppresses __cplusplus for C++ files) 2013-11-15 19:21:21 +01:00
Daniel Marjamäki 30720affd6 Tokenizer::setVarId: Fixed hang when checking libgc 2013-11-15 16:16:22 +01:00
Daniel Marjamäki 5af2fe6e5b AST: improved 'incorrect logic' checking when there are nested expressions 2013-11-15 06:51:35 +01:00
Daniel Marjamäki d1721b9d1b AST: Improved 'same expression on both sides of operator' checking for nested operators 2013-11-15 06:35:46 +01:00
Daniel Marjamäki 203d3e916b Fixed #5173 (false positive Variable XX is reassigned a value before the old one has been used) 2013-11-14 16:10:00 +01:00
Daniel Marjamäki 673400920d AST: Fixed 'a[1][2]' 2013-11-13 17:52:56 +01:00
Daniel Marjamäki 7fe51eb58b Fixed #4989 (False positive: Wrong processing of __asm block) 2013-11-13 06:04:00 +01:00
Daniel Marjamäki 1ecade2657 AST: don't warn about duplicate expressions around '+' operator. It might be more efficient than using for instance '*2' 2013-11-11 20:03:59 +01:00
Daniel Marjamäki 58d7caded1 AST: improved handling of casts 2013-11-11 16:39:34 +01:00
Daniel Marjamäki 4027848761 incorrectLogicOperator: fixed FP when comparing char values. improved handling of float comparisons. 2013-11-10 18:06:51 +01:00
Daniel Marjamäki 807f62520c Fixed crash caused by endless recursion in redundant assignments check 2013-11-10 17:20:40 +01:00
Alexander Mai 687aeb4f5f Fixed #5158 (segmentation fault (valid code)) 2013-11-10 16:22:52 +01:00
Daniel Marjamäki bb746261d3 AST: Fixed crash 2013-11-10 15:51:33 +01:00
Daniel Marjamäki 0dd17f9fad Merge pull request #198 from simartin/ticket_5073
Ticket #5073: Don't crash upon invalid do-while loop.
2013-11-10 03:09:16 -08:00
Daniel Marjamäki cadb284a3d Refactored the AST checking of CheckOther::checkIncorrectLogicOperator() 2013-11-10 11:59:18 +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 20b84fcdee Null pointers: Don't warn when first argument to freopen() is NULL 2013-11-08 13:22:07 +01:00
Robert Reif 52df31b501 Fixed #5153 ((debug) Scope::checkVariable found variable ')') 2013-11-08 12:56:32 +01:00
Robert Reif a6ef3a224a Fixed #5151 (false negative: improper formatstring - vector::at()) 2013-11-08 12:44:05 +01:00
Daniel Marjamäki b0ce42565e AST: Added experimental new implementations for CheckAssignIf::comparison, CheckOther::checkIncorrectLogicOperator and CheckOther::checkDuplicateExpression 2013-11-07 14:38:08 +01:00
Daniel Marjamäki fb04c8ff84 Fixed #5107 (redundantAssignment when pointer changes) 2013-11-04 23:46:07 +01:00
Daniel Marjamäki 7996d609be Fixed #5108 (false positive: uninitialized variable (assignment in function parameter)) 2013-11-04 23:09:15 +01:00
Daniel Marjamäki 6ad2491817 AST: uninstantiated template 2013-11-04 22:58:47 +01:00
Daniel Marjamäki 8ff412fcee Fixed #5142 (False positive with floating-point special cases in conditions) 2013-11-04 11:56:43 +01:00
Daniel Marjamäki de29991c11 AST: Rewrite using standard approach 2013-11-04 11:26:16 +01:00
Daniel Marjamki 9959c2866c AST: fixed hang for ',&x..' 2013-11-03 15:05:58 +01:00
Daniel Marjamki 8910bae801 Fixed #5137 (Defining empty macro from commandline does not seem to work) 2013-11-03 09:46:03 +01:00
Daniel Marjamki bcc8384a95 Fixed #5145 (False Positive: Variable 'A' hides enumerator with same name) 2013-11-03 09:34:48 +01:00
Daniel Marjamäki 5f0cfa0ee4 Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0]) 2013-11-02 23:56:10 +01:00
Daniel Marjamäki 11abd23fa7 astyle formatting 2013-11-02 22:58:47 +01:00
Daniel Marjamäki 769b4617c3 Fixed #5142 (False positive with floating-point special cases in conditions) 2013-11-02 22:58:23 +01:00
Daniel Marjamäki a50e5c2c23 Merge pull request #195 from simartin/ticket_5139
Ticket #5139: Properly handle recursive macro definitions
2013-11-02 11:21:13 -07:00
Daniel Marjamäki c505f5ea23 Fixed AST problem for 'if ((a.b&c)==d){}' 2013-11-02 19:18:58 +01:00
Daniel Marjamäki bbdfd8b5c7 Make it possible to create AST, by using the --ast flag 2013-11-02 18:37:35 +01:00
Simon Martin 95c08d5613 Ticket #5139: Properly simplify recursive macro definitions 2013-11-01 16:47:22 +01:00
Martin Ettl 5f89777182 testoptions: reverted commit 184db3900e 2013-11-01 01:28:05 +01:00
Martin Ettl 63d9fd4210 Merge branch 'master' of https://github.com/danmar/cppcheck 2013-10-29 01:48:58 +01:00
Daniel Marjamäki e446a28b3d Refactoring FileLister and Path so they don't depend on Library 2013-10-31 19:09:01 +01:00
Martin Ettl 184db3900e testoptions: fixed buffer access out of bounds issue. The ctor of options requires an array of at least two elements, but. 2013-10-29 01:48:30 +01:00
Daniel Marjamäki d3bd373798 Fixed #5131 (False Positive: %u in format string requires 'unsigned int' but the argument type is 'int'.) 2013-10-31 17:20:00 +01:00
Daniel Marjamäki 352c459e28 Merge pull request #194 from simartin/ticket_5121
Ticket #5121: Handle static variable declarations depending on one another
2013-10-30 22:09:44 -07:00
Alexander Mai 14787cde99 Fixed #5129 (FP:arithOperationsOnVoidPointer on void**) 2013-10-31 06:04:51 +01:00
Daniel Marjamäki 06c5bd0daa Fixed #5128 (False positive zerodivcond 'a ? 1 / a : 0') 2013-10-30 16:51:00 +01:00
Simon Martin d67722ebdf Ticket #5121: Handle comma separated static variable declarations depending on one another 2013-10-30 15:48:00 +01:00
Simon Martin 463ef2e71e Ticket #5120: New test case, that works now that #5125 is fixed 2013-10-30 10:15:03 +01:00
Simon Martin 052be76635 Ticket #5125: Avoid infinite recursion for recursive class definitions 2013-10-29 21:41:47 +01:00
orbitcowboy 097510c4ef Tokenizer:simplifyMathFunctions_fma: added a todo testcase. 2013-10-29 09:26:26 -07:00
Daniel Marjamäki 5c072993e3 CheckBool: Fixed false negative when assigning bool to pointer '; s.p = true; ' 2013-10-29 16:16:52 +01:00
orbitcowboy e8fdf4cdd2 Tokenizer:simplifyMathExpressions: added more testcases. 2013-10-24 21:33:00 -07:00
PKEuS bd752cabcf Let TinyXML2 handle fopen/fclose. Added testlibrary.cpp to VS10 solution 2013-10-27 17:32:38 +01:00
Daniel Marjamäki 569a29bc4a Library: Added simple testing 2013-10-27 17:10:43 +01:00
Robert Reif 94187c41c2 Fixed #5104 (False positive: Invalid argument in printf and scanf for vector template) 2013-10-27 10:48:49 +01:00
Daniel Marjamäki 4a6274dcc0 Merge pull request #183 from felipensp/null_ptr_typeof
- Fixed false positive when passing pointer to typeof()
2013-10-27 02:37:31 -07:00
Daniel Marjamäki ec3ab74631 Preprocessor: Use set instead of list to track '#pragma once' usage 2013-10-27 10:33:37 +01:00
Daniel Marjamäki 51ad9ab6ac Fixed #4896 (FP Uninitialized variable on template function) 2013-10-26 18:39:40 +02:00
Daniel Marjamäki 8687e85e56 Fixed #4850 (False positive: invalidIterator1 detected when iterator container is member of some struct) 2013-10-26 17:48:20 +02:00
Daniel Marjamäki 853d9dd7a9 Fixed #4956 (false positive: Variable 'myIsFirst' is assigned a value that is never used.) 2013-10-26 15:22:28 +02:00
XhmikosR 32e2a5b879 test/testother.cpp: Fix a C4800 MSVC warning. 2013-10-25 18:14:16 +03:00
Daniel Marjamäki 364757e1e1 Fixed #5089 ('inconclusive' output printed although --inconclusive not specified) 2013-10-23 06:42:52 +02:00
Daniel Marjamäki d1b03d9c31 Fixed false positive for 'object is destroyed immediately' when there is no code after the object 2013-10-22 19:37:11 +02:00
Daniel Marjamäki a55056c770 Fixed #5105 (false positive: (warning) Either the condition 'b!=0' is useless or there is division by zero) 2013-10-22 16:18:42 +02:00
Daniel Marjamäki fd0f2d7900 Fixed #4929 (False positive: possible null pointer deref (checks dont handle && and || well)) 2013-10-22 10:47:48 +02:00
Sam Truscott 6806fd8135 Extended Qt support through Library 2013-10-20 14:09:10 +02:00
Daniel Marjamäki fc26de89a9 Fixed #5082 (False positive: (error) Possible null pointer dereference: p2) 2013-10-20 13:37:36 +02:00
Daniel Marjamäki 5d7e0aebf4 Fixed #5084 (False positive: (style) Same expression on both sides of '&&') 2013-10-19 18:04:53 +02:00
Daniel Marjamäki 6aa03efa2f Fixed #5103 (Don't show 'The scope of the variable can be reduced' if there is no explicit block with { }) 2013-10-19 17:27:02 +02:00
Daniel Marjamäki f8710cb984 Fixed #5102 (Crash if -D is used when scanning simple preprocessor code.) 2013-10-18 06:47:55 +02:00
Robert Reif b41ab8a4d5 Fixed #5088 (Token::Match called with varid 0. in libreoffice sd/source/ui/table/TableDesignPane.cxx) 2013-10-14 21:05:54 +02:00
Felipe Pena ecb0e70250 - Fixed false positive when passing pointer to typeof() 2013-10-12 10:19:15 -03:00
Robert Reif 1fccfd50eb Fixed #5080 ((error) Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers) 2013-10-12 10:50:59 +02:00
orbitcowboy 9debeab47c Tokenizer:simplifyMathExpressions: fixed false negative patterns for simplification. 2013-10-11 11:58:37 -07:00
Daniel Marjamäki bb0385321f Fixed #5074 (False positive: Duplicate expression (macro)) 2013-10-13 17:42:06 +02:00
Martin Ettl a674ed1aa9 Tokenizer:simplifyMathFunction: added simplifcation for fma[f|l]() functions. 2013-10-13 16:28:02 +02:00
Martin Ettl e18ebf313f Tokenizer:simplifyMathFunctions: added support for more math functions. 2013-10-13 15:41:47 +02:00
Martin Ettl cdb47813d5 Tokenizer:simplifyMathFunctions: added support for cosh[f|l], cos[f|l] and erfc[f|l] functions. 2013-10-13 14:23:10 +02:00
Felipe Pena c37ba4cbcf - Fixed false positive when using typeof/__alignof__ 2013-10-12 13:46:14 -03:00
Daniel Marjamäki 783bb6eb0b Test that there is no segfault in CheckOther::checkZeroDivisionOrUselessCondition when the SymbolDatabase is invalid. Ticket: #5045 2013-10-10 22:23:52 +02:00
orbitcowboy 6eaa2f2444 Tokenizer:simplifyMathFunctions: added support for acos[f|l] functions. 2013-10-09 07:59:32 -07:00
orbitcowboy 58c09f80b6 Testother: split up a large testfunction, no functional change. 2013-10-09 07:48:46 -07:00
Daniel Marjamäki 682e68b1b6 Fixed #5077 (False positive: Comparison of boolean result with relational operator ((X + (Y < 0)) <= b)) 2013-10-09 05:43:50 +02:00
Martin Ettl f08325284c Tokenizer:simplifyMathFunctions: added support for acosh[f|l]() functions. 2013-10-07 22:10:58 +02:00
Daniel Marjamäki 9ce7efc6e4 commaSeparatedReturn: made checking experimental for now because there are false positives (#5076) 2013-10-08 18:05:07 +02:00
orbitcowboy 90b2c5ddce testtokenize: split up large testcases for simplifying math functions. 2013-10-08 07:05:05 -07:00
Daniel Marjamäki 4f88fdcf4a Check64Bit: Fixed false positive about returning integer for 'p+(n*80)' 2013-10-08 06:36:45 +02:00
Robert Reif 1959377423 Fixed #4963 (cppcheck and testrunner Visual Studio 2008 build failure) 2013-10-08 05:36:52 +02:00
Daniel Marjamäki f9cf148012 CheckBool: Skip 'bool' type checking in C code 2013-10-07 18:41:07 +02:00
Daniel Marjamäki b81de5494e CheckBool: Fixed false positive for calculation using bool result in rhs 2013-10-07 18:01:08 +02:00
Daniel Marjamäki d2025363d0 CheckBool: Fix false positive for '(a != boolexpr || c)' if a is a int 2013-10-07 17:44:19 +02:00
Daniel Marjamäki 83f9503839 CheckBool: Fixed false positives for non-bool expressions that contain ! operator 2013-10-07 16:37:51 +02:00
Daniel Marjamäki 023d0e7cb8 Fixed #5072 (False positive: comparisonOfBoolWithInvalidComparator even without explicit bool type) 2013-10-07 16:16:07 +02:00
Daniel Marjamäki 4cd0108b93 Fixed #4976 (False positive: (style) A pointer can not be negative (git/sha1_file.c)) 2013-10-06 16:52:27 +02:00
Daniel Marjamäki 0ef1529ba5 Fixed #5005 (false positive: (warning) Assignment of function parameter has no effect outside the function.) 2013-10-06 16:07:27 +02:00
Daniel Marjamäki 1234ec95f0 Fixed #4998 (False positive: Address of local auto-variable assigned to a function parameter) 2013-10-06 14:23:26 +02:00
Daniel Marjamäki 9f23b7a1b4 Fixed #5063 (False positive for comparisonOfBoolWithInvalidComparator) 2013-10-06 10:39:08 +02:00
Daniel Marjamäki c234cace6d Fixed #5064 (Tokenizer::simplifySizeof: Doesn't simplify 'sizeof !! (a==1);' properly) 2013-10-06 08:20:10 +02:00
Daniel Marjamäki 946722faf0 Fixed #4968 (False positive: Structure with 'read' member is confused with read() function.) 2013-10-05 18:25:44 +02:00
Robert Reif 7098fc6039 CheckIO: fixed handling of unknown types. Ticket #5051 2013-10-05 16:47:06 +02:00
Daniel Marjamäki 6830d5f7a4 Fixed #5042 (false positive: Redundant code (set filled in initialization list)) 2013-10-05 12:26:09 +02:00
Daniel Marjamäki f2fdd967f5 Fixed #5046 (False positive: Boolean value assigned to pointer) 2013-10-05 08:53:37 +02:00
Daniel Marjamäki 348f3fa97f Fixed #5058 (False positive: (warning) Comparison of a boolean expression with an integer.) 2013-10-05 08:33:33 +02:00
Robert Reif 5dbc02250f This patch adds pointer to format string support to printf. Ticket: #5051 2013-10-05 07:47:52 +02:00
Robert Reif 44559a1fb2 Fixed #5069 (sizeof(void) when variable name is override) 2013-10-05 07:40:59 +02:00
Robert Reif 6c06cdd24d CheckIO fixes. Ticket: #5051 2013-10-04 17:30:55 +02:00
Martin Ettl a8cf8f0984 Tokenizer:simplifyMathFunctions: fixed false positives when simplifying special pow() cases. 2013-10-03 22:54:45 +02:00
Martin Ettl f8bd33f2bc Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made. 2013-10-03 20:52:07 +02:00
Martin Ettl 548e2f3fbf Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities. 2013-10-03 15:41:12 +02:00
Robert Reif 59de30823e CheckIO: This patch adds support for fprintf_s, fscanf_s and %I. Ticket: #5051 2013-10-03 06:37:40 +02:00
Robert Reif 5aba841499 CheckIO: Handling of casts (#4964) 2013-10-02 04:12:46 +02:00
Martin Ettl fa5ee8fd13 Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions. 2013-10-01 20:30:59 +02:00
orbitcowboy b6d7e797a2 Testtoken:matchNumeric(): extended testing about some missing testcases. 2013-09-30 15:55:36 -07:00
orbitcowboy 5a158987ce Added todo testcase for false positive: Comparison of boolean with expression with an integer. 2013-09-30 11:21:28 -07:00
Robert Reif cc6745fef6 CheckIO: Fixed false positives when using _snprintf_s and _snwprintf_s. Ticket: #5057 2013-10-01 05:49:44 +02:00
Martin Ettl f0cbeb5233 simplifyMathFunctions: added support for exp(),sqrt(),cbrt() functions. 2013-09-29 18:11:17 +02:00
Robert Reif c37c6617d3 Fixed #5057 (Microsoft secure printf/scanf support.) 2013-09-30 19:55:21 +02: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 1c513f330a Fixed #5055 (False negatives when using -I (external source code)) 2013-09-29 18:59:27 +02:00
Robert Reif d3798958f4 CheckIO: Fixed false positive when using wchar_t (#5051) 2013-09-29 15:25:18 +02:00
Martin Ettl 0527aefb11 Improved simplifyMathFunctions when simplifying special cases of pow(x,y)-function. 2013-09-29 15:11:09 +02:00
Daniel Marjamäki 973bdcc6d8 Fixed #4929 (false positive: Division by zero (standard function div())) 2013-09-29 11:13:49 +02:00
Robert Reif c5723ab46a CheckIO: Clarify format check warnings 2013-09-29 10:42:47 +02:00
Martin Ettl 5aaaff46ee Fixed #5049: new check: (warning) Comparison of two identical variables with isgreater(result,result) evaluates always to false. 2013-09-26 07:07:48 +02:00
Martin Ettl 805d082cd1 Tokenizer:simplifyMathFunction: added support for [ll]div() functions and corresponding unittests. The simplifcation is only performed, if a division by 1 is detected. 2013-09-26 07:01:08 +02:00
Steve Duan cf0c666d79 Fixed #5041 (Improve check: support 'auto' for 'Iterator used after element has been erased') 2013-09-28 11:50:45 +02:00
Daniel Marjamäki 4a02ca8202 SymbolDatabase: handle method with unknown macro 'void f() MACRO {..}' 2013-09-28 11:44:26 +02:00
Daniel Marjamäki c2a8f6f59a astyle formatting 2013-09-28 09:32:41 +02:00
Simon Martin d67a0add47 Ticket #5024: Don't crash upon invalid code when checking auto variables. 2013-09-28 00:14:12 +02:00
Frank Zingsheim 67915749b0 Fixed #4723 (False positive: Pure virtual call within conditional clause)
conditional clauses directly in constructor/destructor cannot prevent
pure virtual function call otherwise this part of the code would never been called
2013-09-27 09:25:38 +02:00
Martin Ettl 32e1831716 #5046 - Added todo testcase 2013-09-26 01:03:34 +02:00
Martin Ettl ea5bcfaa35 Fixed #5040 - simplify more math functions. 2013-09-26 00:44:16 +02:00
Frank Zingsheim 445d08d082 Fixed #4723 (False positive: Pure virtual call within conditional clause) 2013-09-26 17:25:16 +02:00
Robert Reif 44d86e97c0 Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking) 2013-09-26 16:20:01 +02:00
Robert Reif 2de3ebcb1e CheckIO: fixed some more false negatives. Ticket: #4964 2013-09-24 06:43:03 +02:00
Daniel Marjamäki 17c0bb3cab revert 027e5cc8. the div() standard function should not be reimplemented. create a different fix. Ticket: #4929 2013-09-23 18:01:15 +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
Daniel Marjamäki 027e5cc860 Fixed #4929 (false positive: Division by zero (standard function div())) 2013-09-22 09:52:12 +02:00
Robert Reif 5c4c397372 CheckIO: add scanf argument type checking. Floating point and integer checking is complete but string checking is incomplete and character checking is missing. Ticket #4099 2013-09-22 06:56:31 +02:00
Alexander Mai 6eab4abaf2 Fixed #5030 (Segmentation fault below CheckMemoryLeakStructMember::isMalloc()) 2013-09-21 18:10:29 +02:00
Daniel Marjamäki 965d8f0ecc Fixed #5033 (segmentation fault (valid code) in CheckOther::checkZeroDivisionOrUselessCondition) 2013-09-21 17:44:25 +02:00
Martin Ettl 4cc153a6f3 Fixed #5032: fix wrong unittest case in testtoken::matchNumeric. 2013-09-21 17:40:18 +02:00
Martin Ettl d5f514c820 Fixed #5031: simplify labs|fabs|abs(-1) to 1. 2013-09-21 16:59:06 +02:00
Daniel Marjamki 3de9431507 Fixed #5022 (Improve check: Division by zero or useless condition, function call) 2013-09-15 17:46:52 +02:00
Robert Reif 19745bbb7d Fixed #5021 (Confusing message about %lf format in printf()) 2013-09-15 16:38:45 +02:00
Ettl Martin 5a671f8914 Fixed #5023 (Add support for asinf,acosf,asinl,acosl (...) functions) 2013-09-13 19:49:25 +02:00
Robert Reif 4d82e37078 Fixed #5021 (Confusing message about %lf format in printf()) 2013-09-12 05:54:05 +02:00
PKEuS 0439f25bbd Fixed wrong unittest introduced in b36a887608 2013-09-10 12:57:28 +02:00
Robert Reif 9be2f6b5d4 Fixed #4964 (printf format argument check only supports simple variables) 2013-09-08 20:21:00 +02:00
Daniel Marjamäki 4b1254bc8d Merge pull request #168 from simartin/ticket_4994
Ticket #4994: Don't crash when checking variable scope for invalid input
2013-09-08 06:57:42 -07:00
Simon Martin 843833f907 Ticket #4994: Don't crash when checking variable scope for invalid input. 2013-09-07 21:16:25 +02:00
Daniel Marjamäki 51ad747317 Fixed false positive in new 'x>-1<5' check when using templates 2013-09-07 18:24:35 +02:00
Daniel Marjamäki 6bb6506ce2 checkZeroDivisionOrUselessCondition: Fixed false positive when function is called and variable is passed to it 2013-09-07 16:18:11 +02:00
Daniel Marjamäki 08556d071e Fixed #5016 (false negative: condition is always true / comparing boolean result with '<' (x > -1 < 5)) 2013-09-07 11:32:11 +02:00
Daniel Marjamäki 83c460fc56 Fixed #5017 (New check: division by zero, otherwise condition is redundant) 2013-09-07 07:40:10 +02:00
Daniel Marjamäki 40c5924292 CheckIO: Handle classes derived from STL 2013-09-07 07:20:06 +02:00
Robert Reif 489a3a6e53 Fixed #5015 (strings not being concatinated properly) 2013-09-06 05:36:33 +02:00
Daniel Marjamäki 9000c233fa Fixed #5012 (Hang when there is syntax error 'else }') 2013-09-05 06:38:07 +02:00
Robert Reif 2fe91e290c CheckIo: Improved %d handling 2013-09-05 06:04:41 +02:00
Robert Reif 921a1aaa4f CheckIO: Improved handling of %u 2013-09-05 01:46:58 +02:00
Daniel Marjamäki 3b8e9f5a2a Fixed #4899 (False positive on unused variable) 2013-09-03 17:02:46 +02:00
PKEuS 05af4f82ce Test GetShowErrorMessages in testcmdlineparser.cpp 2013-09-03 11:41:16 +02:00
PKEuS b36a887608 Fixed false positive #5004 2013-09-03 10:54:10 +02:00
PKEuS 6b47ed414a Fixed Function::retDef initialization:
- Move/Copy Constructors and Destructors do not have a return type neither
- Fixed crash in SymbolDatabase::printOut
- Added testing
2013-09-03 10:48:01 +02:00
Daniel Marjamäki 5d7518aa57 simplifyCalculations: Improved handling of casts (#4899) 2013-09-03 06:27:11 +02:00
Robert Reif 0dddd424a4 CheckIO: Improved handling of function return type 2013-09-03 05:50:19 +02:00
Daniel Marjamäki 6819f5ed18 Fixed #4860 (Segfault with another Clucene file) 2013-09-02 05:58:55 +02:00
Daniel Marjamäki a781a83822 Preprocessor: Quicker response for --check-config. No 'normal' code is needed so skip it. 2013-09-01 07:13:48 +02:00
Robert Reif 8790f6d73f Fixed #4999 (Crash with simple code snipped in rev ab30fa3) 2013-08-31 18:58:55 +02:00
Robert Reif 05f2f0e419 CheckIO: improved type info - keep track of original typename. 2013-08-31 06:26:39 +02:00
Lucas Manuel Rodriguez 92b7280d13 Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method) - Better fix 2013-08-30 22:06:20 -03:00
Lucas Manuel Rodriguez c26674dc97 Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method) 2013-08-30 08:46:33 -03:00
Daniel Marjamäki 4a1d1ce1a1 Fixed #3471 (Unused functions: take __attribute__((constructor)) in to consideration) 2013-08-30 06:27:46 +02:00
Robert Reif fc435ae9aa CheckIO: fix false negative for a function in a base class not being found, fix false positives and negatives for std::vector operator [] 2013-08-30 05:41:59 +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
Robert Reif 2950eb08cb CheckIO: fix some %I64 related false positives. Ticket: #4964 2013-08-29 05:49:16 +02:00
Daniel Marjamäki 3bd1d53c75 Fixed #4941 (segmentation fault (invalid code) in Tokenizer::setVarId) 2013-08-28 19:52:41 +02:00
Daniel Marjamäki 2eca0a93a7 Fixed #4733 (defective unusedStructMember warning) 2013-08-28 06:46:32 +02:00
Robert Reif 5c3315db7a CheckIO: improved handling of functions returning pointers. Ticket: #4964 2013-08-28 05:57:40 +02:00
Daniel Marjamäki 5d7ebadf25 Fixed ¤4596 (False positive, Variable 'value' is not assigned a value (x = x >> value)) 2013-08-27 15:57:38 +02:00
Daniel Marjamäki 4189d7db46 test 2013-08-27 06:47:06 +02:00
Robert Reif 228f6b1a87 Fixed #4984 (False positive: (warning) %f in format string (no. 1) requires a floating point number given in the argument list.) 2013-08-27 05:46:09 +02:00
Daniel Marjamäki 80093f0a40 Fixed #4689 (False positive: Unused private function (used in default argument of constructor)) 2013-08-26 16:41:23 +02:00
Robert Reif a1b9bb0688 CheckIO: Fix false positives for functions returning unknown types and false negatives for functions returning record types 2013-08-26 06:03:26 +02:00
Alexander Mai 450442287c Fixed #4974 (CheckBufferOverrun::writeOutsideBufferSize() too strict) 2013-08-25 18:46:07 +02:00
Daniel Marjamäki acdbbeee44 Fixed #4913 (Tokenizer::simplifyKnownVariables: wrong handling of *--p=0;) 2013-08-25 08:54:33 +02:00
Robert Reif 3d9383aabb Fixed #4975 (False positive: (warning) %s in format string (no. 3) requires a char* given in the argument list. (git/column.c)) 2013-08-25 08:32:10 +02:00
Robert Reif 3c6ca35e09 Fixed #4977 (improve platform type tokenize performance) 2013-08-25 08:29:24 +02:00
Daniel Marjamäki b20f44cf6a Merge pull request #167 from simartin/ticket_4450
Fix Ticket #4450
2013-08-24 14:12:44 -07:00
Robert Reif 26de3646e9 CheckIo: Revised patch that fixes bug in class function return type. Ticket: #4964 2013-08-24 22:34:52 +02:00
Simon Martin b713a69b30 Ticket #4450: Handle comma separated static variable declarations with initializers in brackets. 2013-08-24 22:27:54 +02:00
Lucas Manuel Rodriguez a70b0cd0f3 Fixed FP: Null pointer dereference 2013-08-24 16:50:19 -03:00
Daniel Marjamäki 5ce7189bc0 Merge pull request #166 from last5bits/ticket4213
Fixing #4213 arrayIndexThenCheck and adding tests
2013-08-23 22:36:30 -07:00
Robert Reif 01fd156852 CheckIO: Start to add checking of function return types. Ticket: #4964 2013-08-24 07:25:50 +02:00
Alexey Zhikhartsev d24a321ba2 Fixing #4213 arrayIndexThenCheck and adding tests 2013-08-23 19:04:01 +04:00
Daniel Marjamäki 9b4f6a6b3d Fixed #4701 (false positive unusedFunction when using templates) 2013-08-23 06:47:52 +02:00
Robert Reif 5ce1933687 CheckIo: handle more complex variables 2013-08-23 05:35:57 +02:00
Alexander Mai 7fc6b1344b Added testcases for #4801 (Cppcheck fails to parse Posix (crash in CheckOther::checkPipeParameterSize())) 2013-08-22 21:33:02 +02:00
Alexander Mai 986ec42d79 Fixed #4937 (false positive: Assert calls a function which may have desired side effects) 2013-08-22 06:38:54 +02:00
Daniel Marjamäki c96586b2a9 "automatic conversion from iso-8859-1 formatting to utf-8" 2013-08-21 19:31:01 +00:00
Daniel Marjamäki ef086ee4a9 Merge pull request #164 from last5bits/master
Don't include tinyxml from both lib.pri and test.pro
2013-08-21 07:24:56 -07:00
Daniel Marjamäki f257c62858 Fixed #4846 (false positive: (warning) Comparison of a boolean with an integer.) 2013-08-21 16:17:19 +02:00
Lucas Manuel Rodriguez 006b8055e5 Fixed #4676 (Duplicated inherited member check) 2013-08-20 06:29:19 +02:00
Lucas Manuel Rodriguez 14d3886e19 Fixed #4965 (sizeof(void) check - error in message) 2013-08-20 06:20:52 +02:00
Robert Reif 707dfb4eea Fixed #4964 (printf format argument check only supports simple variables) 2013-08-20 06:16:31 +02:00
Alexey Zhikhartsev 298cbd77ff Don't include tinyxml from both lib.pri and test.pro 2013-08-19 19:44:29 +04:00
Daniel Marjamäki 342142b783 Fixed #4256 (Preprocessor: '#pragma once' doesn't work properly when using -D) 2013-08-18 18:04:06 +02:00
Robert Reif 914893013e Symbol Database: improved type handling. Ticket: #4952 2013-08-17 18:43:15 +02:00
Simon Martin 5743416d3e Ticket #4959: Simplify {in,de}crements of known variables. 2013-08-16 23:51:00 +02:00
Daniel Marjamäki 538e4bd798 astyle formatting 2013-08-16 18:27:54 +02:00
Robert Reif b777388fb8 Symbol database: improved type handling (fix problems in previous commit). Ticket: #4952 2013-08-16 05:42:12 +02:00
Daniel Marjamäki 33a948f816 Merge pull request #162 from simartin/ticket_4708
Fixed #4708: prefix {in,de}crement too eagerly computed.
2013-08-15 20:35:38 -07:00
Daniel Marjamäki 5d7f30b88f reassign var: better handling of struct members 2013-08-15 16:13:58 +02:00
Simon Martin bf09191b78 Fixed #4708: prefix {in,de}crement too eagerly computed. 2013-08-15 15:53:08 +02:00
PKEuS dc439f65f8 Added some unit tests to improve test coverage in cmdlineparser 2013-08-15 11:09:40 +02:00
Daniel Marjamäki f95b29db06 Improved handling of the __FILE__ macro 2013-08-14 06:36:03 +02:00
Daniel Marjamäki fd26bad6fa AssignIf: Improved handling of function calls 2013-08-13 14:08:54 +02:00
Daniel Marjamäki c58c9d80e1 astyle formatting 2013-08-13 06:36:03 +02:00
Daniel Marjamäki ff71c94f6e Fixed #4949 (define symbol used in code => 'Analysis failed' message is written.) 2013-08-12 18:12:49 +02:00
Robert Reif d6ce072dc9 Fixed #4950 (Tokenizer: order of int modifiers) 2013-08-12 06:23:01 +02:00
Robert Reif cd3044c808 Fixed #4952 (SymbolDatabase: unknown types in log file) 2013-08-12 06:21:03 +02:00
Simon Martin 40887ca99c Ticket #4703: Trim macro parameters. 2013-08-11 09:41:03 +02:00
Robert Reif 56d8073d0f Fixed #4902 (printf and scanf format checks don't support microsoft %I, %I32 and %I64 extensions) 2013-08-10 12:37:31 +02:00
Robert Reif 5aa79198e6 Fixed #4948 (check printf %l and %ll arguments for long and long long) 2013-08-10 12:33:55 +02:00
Daniel Marjamäki 64733d9e63 astyle formatting 2013-08-10 12:32:59 +02:00
Daniel Marjamäki 3ac21ab1db Merge pull request #158 from simartin/ticket_4764
Ticket #4764: Handle template instantiations with only default parameters
2013-08-10 03:22:41 -07:00
Simon Martin ad33d95ec1 Ticket #4764: properly handle template instantiations with only default parameters. 2013-08-10 12:00:16 +02:00
Robert Reif b940d0adc6 Fixed #4947 (Doesn't allow any ordering of int modifiers) 2013-08-09 23:13:04 +02:00
Daniel Marjamäki 3032dbabce astyle formatting 2013-08-08 15:50:45 +02:00
PKEuS 298a33211f Use static CmdLineParser instance where possible in testcmdlineparser.cpp, fixed wrong unit test. 2013-08-07 18:24:18 +02:00
PKEuS 36dba8373b Reuse constant objects in testpathmatch.cpp, small simplification in testsuppressions.cpp and testthreadexecutor.cpp 2013-08-07 17:55:31 +02:00
PKEuS a65e08b648 Simplified code in testerrorlogger by reusing constant object. 2013-08-07 17:02:35 +02:00
PKEuS 758d68519d Use TinyXML to write XML files 2013-08-07 16:30:55 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
PKEuS dd82817752 Fixed #4943 and simplified CheckOther::checkCommaSeparatedReturn() 2013-08-06 11:27:09 -07:00
PKEuS 5e3ccda408 Added support for noreturn functions from library to CheckOther::checkUnreachableCode() 2013-08-06 02:11:59 -07:00
Simon Martin c9884c30a1 Fix ticket #4922 (segmentation fault upon invalid code). 2013-08-05 20:28:22 +02:00
Daniel Marjamäki 2a78db4c06 Refactoring Token::findClosingBracket. 2013-07-31 10:30:20 +02:00
Daniel Marjamäki 6c05f78a8f Reverted experimental changes for handling of lambda functions (#4919). 2013-07-31 09:58:31 +02:00
Daniel Marjamäki 807204e580 Fixed #4237 (False positive: (error) Memory Leak: data (references and pointer aliases)) 2013-07-30 11:30:14 +02:00
Daniel Marjamäki 1bebf1fd7e AssignIf: added todo test case (pass variable by value to function) 2013-07-29 12:27:57 +02:00
Alexander Mai 39ba0d36c1 TestRunner: added test case for assignment simplification in do-while (#4881). 2013-07-29 12:10:11 +02:00
Daniel Marjamäki f59164302d TestAssignIf: improved code coverage 2013-07-29 11:43:08 +02:00
Alexander Mai 3e9f6daa00 Added test cases for #4801 (Cppcheck fails to parse Posix (crash in CheckOther::checkPipeParameterSize())) 2013-07-29 10:57:41 +02:00
Daniel Marjamäki 9ff204f8bc astyle formatting, use isEnabled("warning") instead of isEnabled("style") 2013-07-28 16:13:16 +02:00
Simon Martin d01e3fa17a Handle parameter positions format strings (POSIX extensions). 2013-07-28 15:00:28 +02:00
Daniel Marjamäki 239a0819e3 astyle formatting 2013-07-28 13:17:46 +02:00
Daniel Marjamäki 7fd12ee2b5 Merge pull request #153 from simartin/ticket_4930
Fixed #4930 ((error) Internal Error: Division by zero)
2013-07-28 04:17:03 -07: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
Simon Martin eb3bf571be Avoid divisions by zero when simplifying numeric calculations. 2013-07-28 12:32:18 +02:00
Lucas Manuel Rodriguez 09f4d3732a Fixed #4911 (segfault, assignment in do ... while, 1.61dev) 2013-07-28 11:58:14 +02:00
Daniel Marjamäki 36ef34a2cf astyle formatting 2013-07-28 11:53:49 +02:00
Daniel Marjamäki 862eb351d5 Merge pull request #152 from simartin/ticket_4914
Fixed #4914 (memory freed twice, when in do {} while being shortcircuited via continue)
2013-07-28 01:43:45 -07:00
Alexander Mai 40fa474a5b Fixed #4927 (Segfault in CheckOther::checkCommaSeparatedReturn() on invalid code) 2013-07-28 10:39:58 +02:00
Simon Martin 470a9a6c71 Take into account break and continue statements in CheckLeakAutoVar. 2013-07-28 10:26:46 +02:00
Daniel Marjamäki 44333f316a Added terminate() handling to get quicker response when the user wants to terminate 2013-07-24 13:06:59 +02:00
Daniel Marjamäki 178467a578 astyle formatting 2013-07-24 11:20:28 +02:00
Carlo Marcelo Arenas Belon aa0560fe3b Fixed #4925 (False positive: checkother style)
When using a variable that is assigned a function pointer checks for
pointers are triggered which would complain if used in arithmetic
comparisions (eventhough it will be valid code if the function returns
an int)
2013-07-24 08:22:24 +02:00
Daniel Marjamäki a1fafa7f06 Library: added <formatstr> and <strz> to argument checks 2013-07-22 20:21:45 +02:00
Robert Reif 20f81f92d9 CheckIO: Improved handling of h, hh, l, and ll. 2013-07-22 08:28:29 +02:00
Lucas Manuel Rodriguez 7e556c215e Fixed #4861 (Improve check: object is destroyed immediately not detected when calling overloaded constructor) 2013-07-22 07:25:53 +02:00
Robert Reif f11e54aa42 Fixed #4902 (printf and scanf format checks don't support microsoft %I, %I32 and %I64 extensions) 2013-07-21 08:35:01 +02:00
Daniel Marjamäki 37716fb8bb Tokenizer: Set variable() pointer for array members 2013-07-20 17:46:39 +02:00
Lucas Manuel Rodriguez 59f448da8a Fixed #4908 (False positive: void * calculation (struct member, cast)) 2013-07-20 17:20:16 +02:00
Daniel Marjamäki 0c5e39a813 Library: Added configuration file std.cfg that clients should load. 2013-07-20 17:12:56 +02:00
Daniel Marjamäki dfed6bbea0 Fixed #4445 (Token::Match called with varid 0) 2013-07-19 21:18:54 +02:00
Daniel Marjamäki 7eb1f36200 astyle formatting 2013-07-19 09:28:45 +02:00
Daniel Marjamäki 794aebe3cf MathLib: Return inf.0 for NAN and INF calculations 2013-07-19 09:27:33 +02:00
Daniel Marjamäki 6fe1b92a47 Improved --check-library messages 2013-07-16 18:50:25 +02:00
Daniel Marjamäki fa7f8ddc78 Library: Renamed Argument to ArgumentChecks to make it a bit more clear 2013-07-16 09:40:31 +02:00
Daniel Marjamäki d25e7d4a21 Library: fixed problems 2013-07-16 08:21:38 +02:00
Daniel Marjamäki 24dfc052e2 astyle formatting 2013-07-15 21:57:58 +02:00
Daniel Marjamäki 7443883b9c Library: Improved handling in CheckNullPointer::parseFunctionCall for Library data 2013-07-15 18:55:40 +02:00
Lucas Manuel Rodriguez cfd697d6d4 Fixed #4042 (False Positive : Same expression on both sides of '&') 2013-07-11 07:13:47 +02:00
Daniel Marjamäki 8f332af849 Uninitialized variables: Avoid FP when using '?:' 2013-07-10 16:44:35 +02:00
Lucas Manuel Rodriguez 040c1e3a13 Fixed #4906 (False positive: void * calculation (cast)) 2013-07-10 06:40:09 +02:00
Daniel Marjamäki 4106972fdc Merge pull request #148 from JustRamires/master
Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892)
2013-07-09 02:55:46 -07:00
Roman Zaytsev Borisovich 295869a866 Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892) 2013-07-09 13:10:03 +04:00
Daniel Marjamäki 7d47fd65a2 Renamed --environment to --library. Added --check-library. Renamed Environment to Library 2013-07-08 18:26:18 +02:00
Lucas Manuel Rodriguez d177c8fd03 Fixed #4824 (False positive: (warning) Member variable 'Foo::m_state' is not initialized in the constructor.) 2013-07-08 06:38:33 +02:00
Daniel Marjamäki 2875ee1ecf astyle formatting 2013-07-07 10:26:20 +02:00
Simon Martin d0d3ce50c9 Added testcase for (now working) ticket #4742. 2013-07-06 18:02:04 +02:00
Daniel Marjamäki 2ef0a40aec Fixed #4893 (FP Uninitialized variable on sizeof of itself) 2013-07-06 08:52:47 +02:00
Lucas Manuel Rodriguez 00886b4d06 Fixed #4876 (Checking for sizeof(void)) 2013-07-05 21:07:07 +02:00
Daniel Marjamäki 61e1dd5096 Environment: Refactoring and cleanup 2013-07-05 20:55:31 +02:00