Daniel Marjamäki
e7483af028
Opposite inner conditions - made check 'experimental' because there are unsolved false positives.
2012-10-21 18:18:29 +02:00
Baris Demiray
d84d360afc
Fixed #4291 (Variable ID is not set when variable is accessed through 'this')
2012-10-19 06:18:13 +02:00
Daniel Marjamäki
61183e7896
astyle formatting
2012-10-08 16:23:05 +02:00
Alexander Mai
3656366c7e
Fixed #4257 (False Positive: String literal compared with variable - for non-pointer variable)
2012-10-07 16:26:03 +02:00
PKEuS
c17853949d
Fixed scope handling problems with CheckOther::checkComparisonOfFuncReturningBool(), removed its experimental status.
2012-09-29 11:23:30 +02:00
Daniel Marjamäki
52be4a5925
Disabled checkComparisonOfBoolWithBool since there are false positives. Ticket #2617
2012-09-28 19:11:36 +02:00
Daniel Marjamäki
ff4f8b58f3
Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617
2012-09-28 18:51:10 +02:00
Mohit Mate
9e297c95f2
Fixed #2617 (improve check: comparing boolean with '<')
2012-09-26 18:18:36 +02:00
XhmikosR
3c14e4b52a
test: tabs to spaces, remove trailing spaces and extra empty lines at the end of files
2012-09-17 13:51:40 +02:00
PKEuS
5237ed2de9
Message refactorization: checkother.cpp
2012-09-16 19:44:02 +02:00
PKEuS
9a624576f4
Revert "CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression."
...
This reverts commit f8591f9004
.
2012-09-15 20:19:02 +02:00
Arpit Chaudhary
67e40a85e5
Improved check for shifting by negative values and removed false positives
2012-09-05 16:09:40 +02:00
Nilesh Kumar
c7633fc73c
Fixed #3645
2012-09-05 13:48:00 +02:00
Zachary Blair
8546bcc94e
Fixed #2029 (new check: free invalid address)
2012-09-04 23:31:23 -07:00
Edoardo Prezioso
f8591f9004
CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression.
2012-09-04 02:07:55 +02:00
anuraggarg011
b156c727b0
Fixed #3939 : Support ****foo++;
2012-09-03 17:10:27 +02:00
Ankita Gupta
c3a65dca40
Fixed #3793 (improve check: calculation in sizeof)
2012-09-03 15:56:10 +02:00
PKEuS
27cafd495a
Don't bailout for noreturn functions in checkRedundantAssignments outside switch.
2012-09-03 12:03:30 +02:00
PKEuS
b6c1528566
Test case for #4135
2012-09-03 11:32:15 +02:00
PKEuS
2d64b69cf4
New check: Detect redundant assignment to a variable and redundant copying to a buffer
...
This check partially replaces the check for redundant assignments in switch
2012-09-02 13:09:32 +02:00
pranav1509
6f6baa67e4
Added more patterns to redundant condition check.
2012-09-01 13:39:32 +02:00
PKEuS
6893948c72
Bugfix: Reset property info when Token::link() is set (< can be a bracket or a comparison operator). Fixes #4075 .
2012-08-26 10:23:16 +02:00
PKEuS
808c3468c9
New check: detect suspicious comparison of string literal with char* variable
...
Bugfix: Update Token type when varId is set
2012-08-24 14:25:17 +02:00
PKEuS
76fbcce13f
Restored (intentional) content of screwed up commits 1bcdf4ce3d
and 674f7980d519712ff16d8f874dfe55a84deb4b5b:
...
- New check (Inconclusive): Array filled incompletely with memset/memcpy/memmove
-- This check only warns if the number of elements is given as size in bytes to memset, memcpy or memmove and if the size of an element is larger than 1 Byte. It does not warn for random numbers
- New check: Detect ineffective statements like '*foo++;' (Should be: '(*foo)++;')
Sorry for the inconveniences.
2012-08-24 11:28:50 +02:00
Edoardo Prezioso
0f1accc2da
Revert latest two commits as they break the compilation and the style. PKEuS???
2012-08-24 00:10:19 +02:00
PKEuS
1bcdf4ce3d
New check: Detect ineffective statements like '*foo++;' (Should be: '(*foo)++;')
2012-08-23 12:28:40 -07:00
PKEuS
674f7980d5
New check (Inconclusive): Array filled incompletely with memset/memcpy/memmove.
...
This check only warns if the number of elements is given as size in bytes to memset, memcpy or memmove and if the size of an element is larger than 1 Byte. It does not warn for random numbers
2012-08-23 11:27:00 -07:00
PKEuS
4d2104ca08
Made a TODO from failing tests - Simplification of known variables is not smart enough to handle operator>> properly-
2012-08-22 16:44:41 +02:00
PKEuS
6364f43b7a
Fixed compiler error introduced recently.
2012-08-22 16:41:11 +02:00
Arpit Chaudhary
7c8da17c44
Added check for detecting if a variable or number is shifted by negative right operand. Statements like:
...
int i = -1;
a << i;
would result in an error message stating undefined behavior.
2012-08-22 15:44:20 +02:00
Kumar Ashwani
afe030ce9b
Fixed #2628 : Detect redudant usage of operator++/-- in switch.
2012-08-22 14:40:57 +02:00
Edoardo Prezioso
2b5cd2effc
Fixed G++ [-Wparentheses] warning. This also fixed #4073 (Crash on self assignment).
2012-08-21 20:15:04 +02:00
PKEuS
b4b5c80db9
Improved check: Added message when checking sign of a pointer.
2012-08-21 03:28:02 -07:00
PKEuS
b641a10e35
Fixed false negative: memset(foo, 0, sizeof(&foo)); is as suspicious as memset(foo, 0, sizeof(foo));
2012-08-20 10:08:18 -07:00
PKEuS
a243983242
Refactorized type handling in CheckIO and CheckOther:
...
- Added several types (std::) to isComplexType
- Types in namespace std:: are considered to have no side-effects (solved one TODO)
- Scope of a pointer can be limited without side effects
2012-08-20 08:57:28 -07:00
PKEuS
452f95cea0
More robust template detection in clarifyCondition check based on Token::link. ( #3818 )
...
Create links between < and > only on non-C code.
AStyle fix
2012-08-02 04:03:01 -07:00
Ettl Martin
98d608231d
spelling fixes
2012-07-31 23:35:56 +02:00
PKEuS
26a2379f9f
Fixed false positive #3941 .
2012-07-29 06:39:43 -07:00
PKEuS
9834888f19
Removed some duplicate tests and a redundant variable
2012-07-25 01:34:54 -07:00
PKEuS
ae6201d289
Fixed false positive "Parameter 'x' is passed as a value" for types like std::vector<T>::size_type ( #3986 )
2012-07-23 01:41:20 -07:00
Zhao Qifa
188d2e143d
add a performance checker for const assignment
2012-07-22 09:17:00 +02:00
PKEuS
41fecb2e6d
Fixed evaluation of redundant conditions ( #3972 )
2012-07-13 06:01:19 -07:00
PKEuS
43c060b630
Removed preprocessor directives from tests that aren't preprocessed before being tokenized.
2012-07-07 11:21:08 -07:00
Robert Morin
25c1cc4c8e
Improve check: warn when comparing boolean value with < <= > >=. Ticket: #2617
2012-07-03 06:39:13 +02:00
Daniel Marjamäki
162a430354
Fixed #3868 (false positive: (style) Same expression on both sides of '|'.)
2012-06-23 19:54:15 +02:00
Daniel Marjamäki
3db58bb57f
Reviewed C handling in CheckOther::clarifyCondition, never treat x<..> as a template in C files.
2012-06-23 07:29:49 +02:00
Daniel Marjamäki
8aba801360
Fixed #3800 (False negative: Self-assignement of variable declared as 'extern')
2012-06-22 11:23:50 +02:00
Zachary Blair
fa2bca1e09
Ticket #3876 : Improved check by only bailing of loops that contain break or continue
2012-06-16 13:11:09 -07:00
Daniel Marjamäki
89b1b4ea6e
Fixed #3892 (False positive: 'if (var >= 0.0) then if (var >= 0.0) always returns true
2012-06-15 16:54:02 +02:00
Zachary Blair
e2348560e4
Fixed Ticket #3876 (Error (double free) detected that can't possibly happen)
2012-06-10 17:50:31 -07:00
Ettl Martin
c9cb492bc7
#3874 added missing testcase to avoid false positives
2012-06-10 18:36:19 +02:00
Ettl Martin
d7c1907601
added tests for duplicated branches. Inspired by http://www.viva64.com/en/b/0149/ ( Comparision between PVS-Studio and cppcheck): Errors detected in Quake 3: Arena by PVS-Studio: Fragement 2
2012-05-30 01:30:37 +02:00
Ettl Martin
474dccf8ad
added a testcase for detecting duplicate if else branches.
2012-05-29 09:22:42 +02:00
Zachary Blair
2bd171dded
Fixed #3794 (New check: Missing break in switch (duplicate bitwise operation))
2012-05-28 21:19:22 -07:00
PKEuS
e2bab4b6a3
Implemented Function::nestedIn to be able to identify the scope the function belongs to, even if Function::functionScope.functionOf is not available.
...
Refactorized usage of SymbolDatabase in checkOther:
- Don't copy Function instances in checkExpressionRange
- Simplifications by more accurate usage of information in database
2012-05-24 08:40:43 -07:00
PKEuS
97c4af44ca
Refactorizations in checkOther:
...
- More accurate usage of symbolDatabase to reduce code and false negatives
- Avoided unnecessary construction of pattern string
- Only search for class/struct definition before usage
2012-05-24 06:34:59 -07:00
Daniel Marjamäki
77e9106ec0
Fixed #3634 (False positive: compareBoolExpressionWithInt when using boost::tuples)
2012-05-22 19:01:21 +02:00
PKEuS
b81eafe0dc
Splitted CheckIO from CheckOther.
2012-05-20 02:57:07 -07:00
Daniel Marjamäki
f803a18d50
Fixed #3749 (false positive: same expression on both sides of operator)
2012-05-17 07:26:57 +02:00
Ettl Martin
8a7b141246
added testcase for ticket 3689
2012-05-14 09:57:30 +02:00
PKEuS
06a77679d4
Refactorizations:
...
- Added support for pointers in self assignement check
- Removed redundant for loop in checknullpointer.cpp
- Fixed warning about signed/unsigned mismatch in cppcheck.cpp by making Settings::_maxConfig unsigned
2012-05-11 10:38:19 -07:00
PKEuS
ec00824fd3
Fixed #3357 :
...
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
Ettl Martin
bb8342fbb4
fixed misspelled word 'Comparision' --> 'Comparison'
2012-04-26 23:04:55 +02:00
PKEuS
5ac7552e4e
New check: Comparision of modulo results that are always true/false.
2012-04-26 15:23:47 +02:00
PKEuS
6a37c36ee8
Fixed #3741
...
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS
8e5949c6ce
Added several C++11 algorithms and containers to CheckStl
...
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320 )
2012-04-17 12:54:01 +02:00
Ettl Martin
7be01da8e9
fixed ticket 3693. Added modulus operator to Mathlib + unittests. Added a test to checkother to ensure the testcase of ticket 3693 does not trigger an error message.
2012-04-12 14:02:09 +02:00
Daniel Marjamäki
66227c4da0
Fixed #3609 (clarifyCondition delivers false positives when using Windows-Traits as a template)
2012-04-08 18:07:11 +02:00
PKEuS
b0f571b25c
Fixed #3383 : If there is an empty line between subsequent break statements, only issue a message for inconclusive checking
2012-04-05 10:38:29 +02:00
PKEuS
c1fc7a2218
Improved CheckOther::checkComparisonOfBoolWithInt and CheckOther::checkComparisonOfBoolExpressionWithInt:
...
- Added support for comparision of bool constant with number constant (-> fixed #1877 ) and integer variable with boolean expression
- Moved a check from checkComparisonOfBoolWithInt to checkComparisonOfBoolExpressionWithInt
- Generalized some patterns
- Made error message more accurate concnerning the "neither 0 nor 1" part.
- Reduced number of Token::Match calls
2012-04-02 15:45:51 +02:00
PKEuS
033e4a2c1f
Fixed #3676 .
2012-04-02 11:21:04 +02:00
PKEuS
4f1f6e1824
Improved simplification of calculations:
...
- Use more generic patterns
- Look on operator precedence more consequently
-> Made a TODO test case from a test case that worked previously, because the calculation is simplified so that the problem isn't detected any more.
Changed comment "Coding style checks" to "Checks", because it didn't fit
2012-03-27 21:29:50 +02:00
PKEuS
989ac449e4
Made invalidPointerCast message inconclusive for casting from floating point type* to char* ( Fixed #3639 )
2012-03-25 12:55:39 +02:00
Daniel Marjamäki
ca6a93816b
Merge pull request #89 from HeisSpiter/master
...
Merged two checks to get a better one regarding sizeof
2012-03-25 02:38:04 -07:00
PKEuS
e4d92055e7
Improved sizeofCalculation check:
...
- Bailout on expanded macros for conclusive checking
- Support for more operators
- Removed indendation counter
Improved checkSignOfUnsignedVariable:
- Made the patterns more generic
- Improved verbose error message (-> Fixed #3080 )
2012-03-25 11:32:00 +02:00
Pierre Schweitzer
2b5ddb7858
Merge the strncmp & malloc sizeof checks into a more generic test that handles several cases where sizeof is misused, or could be misused
2012-03-23 21:47:13 +01:00
Pierre Schweitzer
ec44967e13
Add a new test to check improper sizeof usage. It's for the moment limited to malloc calls.
2012-03-21 21:13:09 +01:00
PKEuS
b6057a1148
Improved CheckOther::checkIncorrectLogicOperator:
...
- Added a lot of additional pattern
- Rewrote error messages to make them more understandable and better fitting to the situation. (Fixed #3664 )
- Cleanup in unit tests
Improved message of static string comparision check
2012-03-15 20:38:28 +01:00
PKEuS
7cfffc9c9d
Improved CheckOther::checkIncorrectLogicOperator:
...
- Implemented automatic swapping of conditions and operands
- Added several patterns
- Added support for conditions outside of if/while
2012-03-12 19:06:30 +01:00
PKEuS
6f164de609
Improved static string comparision check: Implemented #3214
...
Fixed false negative on argument count of fnprintf/snprintf when first variable argument is a string. (#3655 )
Uncommented call of virtualDestructorError in getErrorMessages in checkclass.h
Refactorizations:
- Rearranged code in checkother.h to make ordering more consistent and to increase encapsulation of private data
- Replaced some single-token-patterns
2012-03-11 11:01:39 +01:00
PKEuS
ef6e381d47
Improved bitwise on boolean check to make it working on more code patterns
...
Refactorizations in checkother.cpp:
- Make use of symboldabase instead of: indentation counters, manual detection of variable declarations
- Removed some indexing variables to reduce calls to tokAt and the numbers given to this function
- Use tok->nextArgument() to jump to a specific argument
2012-03-03 21:14:20 +01:00
PKEuS
1747813a8b
Added check for invalid pointer casts ( #1255 )
...
Detect sign extension problems when variable is a reference (#3637 )
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
Zachary Blair
0e791929b5
Ticket #3598 - Added a missing ASSERT_EQUALS() statement to the end of checkDoubleFree()
2012-02-18 12:13:21 -08:00
PKEuS
8ea5df62c4
- Improved support for numbers in code:
...
-- Use MathLib::toLongNumber for conversion in tokenizer (Fix #3610 )
-- Handle octal numbers in tokenizer
- Refactorizations in MathLib::toLongNumber and Settings
2012-02-17 15:47:08 +01:00
Zachary Blair
9d75641ef8
Fixed #3598 (false positive: (error) Memory pointed to by 'a' is freed twice.)
2012-02-16 21:03:38 -08:00
Zachary Blair
69567515ce
Ticket #3581 - added missing newlines to the test code
2012-02-04 11:39:29 -08:00
Zachary Blair
8f827aa65f
FIxed #3581 (double free false positive when exception rethrown)
2012-02-04 11:24:40 -08:00
PKEuS
d5c2c7db88
- Moved checkCatchExceptionByValue from CheckOther to CheckExceptionSafety
...
- Fixed false positive: throw outerCatchVar; in inner catch is now correctly handled
- Added eTry and eCatch to Scope::isLocal -> Scopes inside catch are now detected by symbol database
2012-02-02 16:17:42 +01:00
Zachary Blair
589a2461bd
Fixed ticket #3550 (false positive: (error) Memory pointed to by 'pxpm' is freed twice)
2012-01-24 22:43:44 -08:00
Zachary Blair
0415444e28
Merge branch 'master' of github.com:danmar/cppcheck
2012-01-19 23:02:33 -08:00
Zachary Blair
b89adff9fd
Fixed Ticket #3300 (false negative: doublefree of pointer)
2012-01-19 22:59:54 -08:00
Daniel Marjamäki
525e7fba20
Fixed #3490 (False positive: sscanf with %c)
2012-01-18 23:57:08 +01:00
PKEuS
461565c50a
Fixed #3517 and #3513
2012-01-15 12:32:02 +01:00
Reijo Tomperi
dd18f595b1
Fix #3516 (inaccurate warning: "An unsigned variable will always be positive" (unsigned n; if (n >=0);))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3516
2012-01-14 12:50:09 +02:00
Daniel Marjamäki
65ce55e675
Fixed #3472 (false positive: (error) Passing value 0 to log() leads to undefined result)
2012-01-08 12:07:25 +01:00
Daniel Marjamäki
94d220e370
Refactoring: Made Preprocessor::getcode nonstatic
2012-01-06 08:01:50 +01:00
PKEuS
eabdc9082e
Fixed false positives related to %*[] in scanf format string ( #3468 )
2012-01-04 11:22:42 +01:00
PKEuS
621d43e9e4
Fixed #3461 : Support for %m* on scanf-functions
2012-01-02 14:05:58 +01:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Erik Lax
3d0c1a3301
Fix #3457 (Statement following goto can be executed)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3457
2012-01-01 00:11:03 +02:00
Marek Zmysłowski
dd8316474a
Fixed #3335 (new check: warn about potential missuse of isgraph-like functions)
2011-12-29 08:08:37 +01:00
Reijo Tomperi
0a588496a0
Fix astyle and test failures.
2011-12-28 22:05:10 +02:00
Daniel Marjamäki
8e94e2261b
Comparing bool with int: Fixed false positives
2011-12-23 19:11:51 +01:00
PKEuS
8213a15b2a
improving checkSizeofForStrncmpSize
2011-12-23 18:11:34 +01:00
Daniel Marjamäki
e9d697b636
Fixed #3419 (false positive: (style) Same expression on both sides of '&'.)
2011-12-23 16:08:53 +01:00
PKEuS
409364747c
Fixed #3441 (segmentation fault of cppcheck (%: return ; ()))
2011-12-23 12:46:59 +01:00
Daniel Marjamäki
df8504f0ea
Clarify calculation: Fixed false positives when there are various function calls
2011-12-23 12:13:39 +01:00
Daniel Marjamäki
f8181df340
Fixed #3410 (Comparing bool against bool produces false positive)
2011-12-20 06:38:05 +01:00
PKEuS
0205582161
Fixed #3327 (printf with std::string as parameter)
2011-12-18 19:41:21 +01:00
PKEuS
a311904a0f
Patch that fixes some bailouts for isEnabled('style') in both directions. Improved checkSizeofForNumericParameter's error message, made it 'warning', made it non-experimental.
2011-12-16 19:21:14 +01:00
PKEuS
c9f5117cf5
Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler))
2011-12-13 21:42:38 +01:00
PKEuS
9b685ba3c3
Code cleanup
2011-12-09 21:00:57 +01:00
PKEuS
97eecb78a7
Fixed #3381 (false positive: (style) Statements following return, break, continue, goto or throw will never be executed)
2011-12-07 18:20:52 +01:00
PKEuS
1f438b0505
Fixed #3375 (Improve check: Detect unreachable code)
2011-12-03 11:43:23 +01:00
Daniel Marjamäki
9a84c5845a
Fixed #3373 (False posititive: incorrect %* handling in sscanf)
2011-12-02 17:09:32 +01:00
Richard Quirk
b2ea78543b
Fix false positive with non-const function calls
2011-12-01 19:57:04 +01:00
Daniel Marjamäki
98480bf504
Fixed #3354 (Incorrect both sides of '||' expression match when using increment in expression.)
2011-12-01 17:46:33 +01:00
Daniel Marjamäki
31b576de3b
Fixed #3334 (Test for same expression on both sides of '&' reports false positive)
2011-12-01 17:07:55 +01:00
PKEuS
ee3e10ea97
Fixed #3364 (Crash in printf parsing)
2011-11-30 20:23:29 +01:00
Daniel Marjamäki
b61c01c6a4
Fixed #3356 (false positive: (warning) Comparison of a boolean with integer that is neither 1 nor 0)
2011-11-29 18:14:57 +01:00
Daniel Marjamäki
b538f49a6e
Merge pull request #61 from richq/sameexpr
...
Fix for #3317 - same expression on both side of '&&' false positives
2011-11-29 08:50:02 -08:00
Daniel Marjamäki
522da8d258
sizeof for numeric constant : disabled check. see ticket #3179
2011-11-27 18:50:21 +01:00
PKEuS
71c8669261
Fixed #3311 , #3313 and #3339 (printf format string false positives)
2011-11-27 07:29:09 +01:00
Richard Quirk
d28cf42d4c
Fix ticket #3317 (same expression false positives)
...
Add a check for function calls that have no side effects. That means
known const methods and a list including strcmp, strlen, etc.
If the function is not known to be side effect-free then no style
warning is given.
Add test cases for the duplicate expressions.
2011-11-23 21:39:03 +01:00
Richard Quirk
511ac0ab1f
Remove false positives for nested logic
2011-11-23 21:39:03 +01:00
Daniel Marjamäki
5b5ea29f23
Mismatching format string parameters. Made check experimental. See tickets #3311 , #3313 and #3339
2011-11-21 07:31:06 +01:00
Richard Quirk
91713ffe84
Fix false positives for %[ in scanf
2011-11-20 16:48:54 +01:00
Marek Zmysłowski
994f08fdf0
Fixed #886 (new check: wrong value passed to isgraph function)
2011-11-17 16:31:16 +01:00
Daniel Marjamäki
b7cc9779c4
Merge pull request #59 from richq/sameexpr
...
Improved same expression check for ticket #3274
2011-11-08 23:56:36 -08:00
Reijo Tomperi
7a294c1f79
Fix #3307 (Invalid format string/parameter mismatch warning)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3307
2011-11-09 00:16:37 +02:00
Richard Quirk
d1bc8819f9
Fix for same expression separated by commas
...
The code branch tested by the previous check for && is now different, so
I've changed the test to use == instead. There was also a missing case
when the expression was followed by a comma instead of being preceded by
one.
2011-11-08 21:56:54 +01:00
Richard Quirk
d5664dd6cf
Improved %or% and & checks
2011-11-08 21:56:54 +01:00
Richard Quirk
4cb97edbaf
Improved same expression check for ticket #3274
...
Expand the logic for the check for the same expression on both sides of
the || and && operators. Now expressions can be more complex, with the
"alt" variable helping to fudge operator precedence to avoid false
positives.
2011-11-08 21:54:42 +01:00
Daniel Marjamäki
fa076598ad
Fixed #3233 (false positive: (style) Checking if unsigned variable 'i' is less than zero.)
2011-11-06 18:24:37 +01:00
Edoardo Prezioso
6e2f2816de
Improve same expression check: remove '%op%' pattern and add ',' for the same expressions as an argument inside a function.
...
Improve compound assignment simplification: use already defined 'isAssignmentOp' and extend the adding parenthesis to a generic operator, not only to the arithmetical ones. See: http://en.cppreference.com/w/cpp/language/operator_precedence
2011-11-06 14:35:53 +01:00
Daniel Marjamäki
e11c1f7975
Fixed #3265 (false positive: comparison of bool with nonzero integer)
2011-11-06 08:21:34 +01:00
Edoardo Prezioso
99463d3368
Improve same expression check: take count of operations and assignments before the same expression and add missing 'return' pattern to the struct member variable part of the check.
2011-11-05 22:25:01 +01:00
Richard Quirk
a3f2c1e651
Improve for same expression on both sides of operator
2011-11-05 15:46:11 +01:00
PKEuS
0c469bae41
Fixed #3089 (New Check: Detect wrong usage of printf/scanf)
2011-11-05 07:29:53 +01:00
Edoardo Prezioso
68cb7a2731
Fix all the test failures caused by my previous commit.
2011-10-30 11:27:27 +01:00
Edoardo Prezioso
44a234f9b0
Fixed lots of test failures caused by my previous commit.
...
There are still some which I don't know how to fix.
2011-10-30 11:21:46 +01:00
Daniel Marjamäki
b67cb077a3
fix unit test failure
2011-10-29 12:21:22 +02:00
Richard Quirk
665cdfabdc
Warn when sizeof is used in strncmp ticket #2095
...
This checks for the case where the user thought sizeof(buf) gave the
size in bytes of 'buf' in code like the following:
const char *buf = "Hello World";
strncmp(buf, other, sizeof(buf));
2011-10-28 22:14:55 +02:00
Richard Quirk
90c7db15a0
Add check for comparison of identical string variables
2011-10-28 22:12:51 +02:00
Richard Quirk
4ba6ac7332
Add strncmp to the list of static string comparison functions
2011-10-28 22:12:51 +02:00
Thomas Jarosch
9a1b195d79
Fixed #3187 (Remove code duplication in 'other' unit test)
2011-10-23 12:20:43 +02:00
Reijo Tomperi
3568b5a841
Improved memset with 0 bytes check. TODO done (unit test).
...
Patch from: PKEuS <philipp.kloke@web.de>
2011-10-22 23:34:10 +03:00
Edoardo Prezioso
91c6608175
Improve fix of #934 (be careful of macros code).
2011-10-22 20:43:42 +02:00
PKEuS
20179673ce
Fixed #934 (new check: missuse of std::cout)
2011-10-22 17:12:52 +02:00
Edoardo Prezioso
9e5beab4a8
Nitpicky fix of the missing ';' after the memset command inside the test case.
2011-10-20 21:46:34 +02:00