Reijo Tomperi
65b58bcb99
Partial fix to #3452 (ErrorLogger: complain/raise assertion when error message has extra newlines etc)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3452
Add assert for newlines.
2011-12-30 01:22:16 +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
90e1a397a2
Refactoring: Remove duplicate function from tokenizer: code_is_c() -> isC()
2011-12-29 00:36:16 +02:00
Edoardo Prezioso
bbac4f1faf
Fix ticket #3451 (A (style) type warning witout message text).
2011-12-28 17:15:04 +01: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
fd0d9c8694
CheckOther: Added line break to make the code more readable
2011-12-20 20:54:14 +01:00
Daniel Marjamäki
f8181df340
Fixed #3410 (Comparing bool against bool produces false positive)
2011-12-20 06:38:05 +01:00
PKEuS
6dc2a6e7ab
Refactorized CheckUnusedVar
2011-12-18 20:15:41 +01:00
PKEuS
0205582161
Fixed #3327 (printf with std::string as parameter)
2011-12-18 19:41:21 +01:00
PKEuS
f306246c7f
Improved support for references and pointers in SymbolDatabase
...
Replaced several isPointer functions by Variable::isPointer function
Refactorizations & Make use of symbolDatabase more often
2011-12-17 19:04:03 +01:00
PKEuS
4abee3a345
Refactorings. Use reportError instead of reportInconclusiveError.
2011-12-17 11:39:20 +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
91a0a071d0
Take symbol database into use or improve its usage in some checks.
2011-12-09 23:28:10 +02: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
501d7ccb2d
Optimize checkother.cpp by taking symbolDatabase into use.
2011-12-04 20:49:01 +02:00
PKEuS
1f438b0505
Fixed #3375 (Improve check: Detect unreachable code)
2011-12-03 11:43:23 +01:00
Daniel Marjamäki
69d3d4a17d
Fixed gcc compiler warnings
2011-12-03 09:57:56 +01:00
Daniel Marjamäki
9a84c5845a
Fixed #3373 (False posititive: incorrect %* handling in sscanf)
2011-12-02 17:09:32 +01:00
Richard Quirk
d2c8b9be56
Fix possible null pointer dereference
2011-12-01 19:57:04 +01:00
Richard Quirk
b2ea78543b
Fix false positive with non-const function calls
2011-12-01 19:57:04 +01:00
Richard Quirk
a880469c5a
Refactor the same expression check
...
Work out if a function is inconclusive when creating the entry in the
Expressions class instead of when checking the counts at the end. Store
the result in a new bool flag in the ExpressionTokens helper struct.
The pointer to symbol database and ref to list of const functions are
temporarily stored in the Expressions helper class to avoid passing
them in too on every endExpr(tok) call.
Use a const reference to ExpressionTokens in the check loop to avoid
repeating the it->second several times, which clarifies what that code
does.
2011-12-01 19:57:04 +01:00
PKEuS
5017646488
Coding fixes and refactorings
2011-12-01 19:43:51 +01:00
Daniel Marjamäki
93b21c6cc5
Fixed Visual Studio compiler warnings
2011-12-01 18:27:25 +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
fddfd16758
checkDuplicateExpressions: validate tokens instead of string. Fix for my previous commit.
2011-12-01 17:43:29 +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
Edoardo Prezioso
767413adad
1)internal check found a 'findmatch' with simple string argument;
...
2)Style: uniform 'while (...)' when inside it there's an assignment;
3)Replace '0' with 'NULL' where there's comparison with a pointer.
2011-12-01 12:04:47 +01:00
PKEuS
ee3e10ea97
Fixed #3364 (Crash in printf parsing)
2011-11-30 20:23:29 +01:00
Daniel Marjamäki
0d48cd390b
astyle formatting
2011-11-29 20:44:23 +01:00
Edoardo Prezioso
5c90c69ccf
Fixed ticket #3366 (Build breakage)
2011-11-29 19:46:36 +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
PKEuS
6b1594244e
code cleanups and refactorings
2011-11-26 21:15:16 +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
2e08c8c5b1
DJGPP: Fixed a few compiler errors by using std::size_t instead of size_t
2011-11-22 21:14:14 +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
Edoardo Prezioso
a32b05197d
Change every 'tokAt(1)' to 'next()' and every 'tokAt(-1)' to 'previous()'.
...
Added a safety check to ensure that a 'previous()' call doesn't crash (not sure if it's needed or not).
2011-11-20 15:59:37 +01:00
Edoardo Prezioso
11dd3c09ce
Change every 'tokAt(1)->' to 'next()->' because 'tokAt(1) == 0' is equivalent to 'next() == 0', hence the equivalent cppcheck crash.
2011-11-20 15:09:57 +01:00
Edoardo Prezioso
42e369a4b4
Change every 'tokAt(..)->link()' to 'linkAt(..)'.
2011-11-20 14:24:27 +01:00
Marek Zmysłowski
994f08fdf0
Fixed #886 (new check: wrong value passed to isgraph function)
2011-11-17 16:31:16 +01:00
Edoardo Prezioso
2c64d299ca
Change every 'tokAt(...)->str()' to 'strAt(...)'.
2011-11-13 13:10:59 +01:00