Daniel Marjamäki
32e20d4e31
made 'variableHidingTypedef' inconclusive. See ticket #3199
2011-10-22 13:26:33 +02:00
Marek Zmysłowski
b332ea8222
Fixed #3204 (Refactor standards support in Settings)
2011-10-22 09:45:48 +02:00
Edoardo Prezioso
9257e82475
Improve tokenizer: don't confuse between a label and the case/default statements.
2011-10-19 18:49:02 +02:00
Edoardo Prezioso
882b0c15a0
Improve tokenizing of "do{ ... } while(0)".
...
The simplification will be the same for every combination, except for the 'continue' and the 'break'. In that case, keep the block braces.
2011-10-19 18:20:29 +02:00
Edoardo Prezioso
4f256ef314
Runastyle + removal of useless conditions after previous commit.
2011-10-19 14:48:08 +02:00
Edoardo Prezioso
73f0e2c5b9
Fixed ticket #3227 (Improve tokenizer: labels are not handled correctly after a case or another label instruction)
...
Moved the labels simplification after combining the tokens and moved the case/default simplification inside the labels.
2011-10-19 14:20:09 +02:00
Edoardo Prezioso
f4cdf57955
Fixed ticket #3229 (Segfault with goto):
...
Don't handle labels, gotos, returns and indentations inside the round braces. This is applied not only for simplifyGoto, but also to simplifyFlowControl.
Rewrite enum badly handled by astyle inside mathlib.cpp and move simplifyFlowControl at the end of the simplifyTokenList in order to catch more dead code, not related to the ticket.
2011-10-18 23:56:35 +02:00
Edoardo Prezioso
de8eb48a5c
Remove redundant function findmatch inside tokenize.cpp.
...
There's Token::findmatch which is already used inside other Tokenizer functions.
2011-10-17 13:46:27 +02:00
Edoardo Prezioso
c3caade3ca
- Fixed mispelled function name;
...
changed variable name inside simplifyFlowControl for consistency;
improved simplifyFlowControl to handle better this kind of code:
"return; { { } { label : ; ok ( ) ; } }"->"return ; { { label: ok ( ) ; } }".
2011-10-17 02:16:49 +02:00
Ettl Martin
1a710e5761
fixed regression on linux due to missing include
2011-10-16 14:16:35 +02:00
PKEuS
f8074b71d2
Fixed #2470 (False negative: Possible null pointer dereference (C++0x keyword 'nullptr'))
2011-10-16 12:54:58 +02:00
Thomas Jarosch
a52b73f9f9
Fix #3208 (Simplify pointer to standard type, C only)
...
The symbol database is unavailable during token simplification
and &data[0] might return something completely different for C++.
Moved code_is_c() from checkOther to Tokenizer.
2011-10-16 08:09:57 +02:00
Edoardo Prezioso
8afc1b6f2d
Changed the name of the removal of dead code after flow control statements for consistency (simplifyDeadCode is too generalized as name)
2011-10-15 12:45:48 +02:00
Edoardo Prezioso
57ead6988e
Fixed ticket #3138 (Tokenizer: remove unreachable code below goto inside a namespace|class|struct block)
2011-10-15 11:35:45 +02:00
Edoardo Prezioso
f95b692a69
Fixed ticket #3113 (complete simplification of dead code after control flow statements)
2011-10-15 01:34:07 +02:00
Jonathan Neuschäfer
4fb7865f49
fix typos using codespell
...
Codespell is available at http://git.profusion.mobi/cgit.cgi/lucas/codespell/ .
2011-10-13 22:04:41 +02:00
Daniel Marjamäki
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +02:00
Edoardo Prezioso
b792efb761
Fix ticket 3140 and 3137 (Improve Tokenizer: Remove dead for loop - simplify while(0) better.
...
Note: it doesn't remove dead code if there's a label inside. Will be improved in another ticket.
2011-10-13 13:01:24 +02:00
Edoardo Prezioso
16506f0a8c
Remove redundant simplifyDeadCode call inside the Tokenizer::tokenize and move the relative tests in the file 'testsimplifytokens.cpp'.
2011-10-13 12:26:27 +02:00
Daniel Marjamäki
371871b0b7
Tokenizer::removeMacrosInGlobalScope: Don't remove C/C++ keywords namespace/struct/etc. Ticket: #3193
2011-10-12 19:23:39 +02:00
Robert Reif
ee04c1bfb7
fix #3194 (Parsing glitch causes false 'can be const' error for an 'if' statement)
2011-10-12 09:10:34 -04:00
Edoardo Prezioso
742858b67c
Fixed some simple errors in some old commits.
2011-10-10 17:18:47 +02:00
Edoardo Prezioso
af23a9dcbb
Fixed ticket #3140 (Improve Tokenizer: Remove dead for loop 'for (int i = 0; i < 0; ++i)')
2011-10-10 15:15:45 +02:00
Daniel Marjamäki
96beb94b21
Fixed #3183 (False positive: (error) syntax error)
2011-10-09 18:42:36 +02:00
Edoardo Prezioso
9270b84d64
More fixes to the label simplifier (related to ticket 3176):
...
1)Simplify the labels if there are combinations of the symbols '*','&','{' and '(' after a '%var% :' and before another '%var%';
2)but do not simplify the label if it's inside an unpreprocessed macro code.
2011-10-08 21:13:53 +02:00
Robert Reif
a1a839fadc
fix tokenizer and symbol database to not mistake goto statement for variable declaration
2011-10-07 08:11:48 -04:00
Edoardo Prezioso
80df7ea839
Fixed ticket #3176 (cppcheck reports wrong unused variable)
...
Label simplification didn't take count of the '(' parenthesis or the '&' and '*' operators inside or outside the parenthesis after the colon.
2011-10-07 00:54:44 +02:00
Edoardo Prezioso
fe4ce594ce
Renamed the function 'removeRedundantCodeAfterReturn' with 'simplifyDeadCode'.
...
This is a preparation in order to add new features to this function (see the @todo in the tokenize header file, ticket #3113 and #3175 for details).
2011-10-06 22:40:39 +02:00
Edoardo Prezioso
8e90ad106c
Fixed ticket #3148 (Analysis failed on "Modules/mathmodule.c")
...
Fix: Do not handle code when 'return' is inside a macro. This is valid also for 'switch' code inside a macro.
2011-10-05 19:33:46 +02:00
Edoardo Prezioso
3c370dcfdf
Fixed #3146 "Analysis failed" error on softmagic.c:
...
-Fixed: the code didn't check the rightness of the switch syntax if it was inside another switch;
-Tweaked: removed the two bool variables, so now the conditions take count of indentation unsigned variables.
2011-10-04 12:16:39 +02:00
Edoardo Prezioso
bc74213036
Fixed #3132 (Analysis failed. If the code is valid then please report this failure.)
2011-10-03 19:38:37 +02:00
Robert Reif
ac942c6684
fix #3151 (missing portability warning for extra qualifier on destructor)
2011-09-29 19:25:14 -04:00
Robert Reif
9994218aa2
refactor last commit to move unknown type output to seperate function
2011-09-28 07:36:48 -04:00
Robert Reif
989235b509
show unknown variable types when debug-messages flag is set
2011-09-27 21:45:06 -04:00
Robert Reif
44a926aa4d
add a few more Microsoft TCHAR function conversions
2011-09-27 07:29:36 -04:00
Robert Reif
ec377d24eb
add support for Microsoft TCHAR character constants
2011-09-26 22:08:24 -04:00
Robert Reif
6e8bf43dc0
add some Windows TCHAR scanf and printf conversions
2011-09-25 10:02:27 -04:00
Robert Reif
545aa9e55b
start adding Windows wide character support
2011-09-24 16:02:56 -04:00
Robert Reif
f97424b242
start adding Windows ASCII TCHAR conversion support
2011-09-24 14:51:03 -04:00
Robert Reif
a685f1f5b7
add operator support to ertra qualification check
2011-09-23 19:45:19 -04:00
Robert Reif
97d4277854
add Microsoft memory function conversions to standard cstring functions
2011-09-22 19:59:56 -04:00
Robert Reif
4d1dda10fa
add some more windows type conversions
2011-09-20 20:17:02 -04:00
Robert Reif
af5272dfb0
only simplify Microsoft MFC code when Windows platform is selected
2011-09-20 07:20:37 -04:00
Robert Reif
e234e8cc5b
add some common windows pointer type conversions to standard types
2011-09-19 23:14:58 -04:00
Robert Reif
be660003ec
start adding conversions from common Windows types to standard types
2011-09-18 13:06:54 -04:00
Robert Reif
66eb37c135
convert size_t to standard type
2011-09-18 10:31:31 -04:00
Robert Reif
b5d22fda0d
fix #2888 (Allow defining sizes of base types)
2011-09-17 19:40:52 -04:00
Robert Reif
cce4303f28
fix a problem with Qt slots immediately followed by signals
2011-09-16 16:59:43 -04:00
Edoardo Prezioso
1ff7410f4f
Fixed #3075 (False positive => Improve tokenizer: remove redundant code after a 'return' state)
2011-09-13 07:55:47 +02:00
Daniel Marjamäki
9a97fbe022
Fixed #3104 (unread despite modified and used in IF statement)
2011-09-11 08:19:35 +02:00
seb777
8ed0e3a239
Revert "The case statement requires constant-expression (C, C++, C# and Java."
...
This reverts commit 5879fe419d
.
2011-09-11 00:44:40 +02:00
seb777
5879fe419d
The case statement requires constant-expression (C, C++, C# and Java.
...
Needless to simplify the calculation of a piece of code that can not compile.
2011-09-10 17:28:32 +02:00
seb777
08efad13b2
fix #3093 (Simplify code (math expression) with keywords 'return' and 'case')
2011-09-10 13:28:54 +02:00
seb777
5c7ed46e0c
Following the discussion XX, replace the keyword C99 '_Bool' with the 'bool' keyword in the process of tokenization\nSee f29b7f9f08
2011-09-03 23:15:33 +02:00
Daniel Marjamäki
46b5d5bd00
Fixed #3069 (False positive: Memory leak: data)
2011-09-03 20:45:48 +02:00
Daniel Marjamäki
d23c58d387
enable: break out 'performance' and 'portability' from the 'style' id. Ticket: #3074
2011-09-03 15:30:30 +02:00
Robert Reif
f4e07c3179
fix #3070 (Other: failed to parse a typedef string. Check continues anyway.)
2011-09-01 19:10:58 -04:00
Daniel Marjamäki
a96028b43b
Fixed #3058 (False positive: Uninitialized variable: data)
2011-08-31 19:45:20 +02:00
Daniel Marjamäki
0529654e37
Fixed #3058 (False positive: Uninitialized variable: data)
2011-08-30 19:13:04 +02:00
Daniel Marjamäki
787bc4c384
Fixed #3016 (Preprocessor has incorrect precedence(?) for &&)
2011-08-28 18:30:58 +02:00
Robert Reif
423a1ff64e
add support for simplifying Qt emit in tokenizer
2011-08-25 20:54:35 -04:00
Daniel Marjamäki
7afec3cf6d
Fixed #3032 (False positive: possible null pointer dereference (assignment in condition))
2011-08-21 17:49:00 +02:00
Robert Reif
a6c5eff1be
fix #3006 (segmentation fault of cppcheck ( x < () < ))
2011-08-15 07:19:49 -04:00
Robert Reif
4168d79b09
fix #3005 (segmentation fault of cppcheck ( enum : x ))
2011-08-15 07:07:12 -04:00
Robert Reif
5364b4f7fb
fix #3007 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-15 06:56:15 -04:00
Robert Reif
ed507b73ee
fix #3004 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-14 21:00:05 -04:00
Robert Reif
08e9d64a86
fix #3003 (segmentation fault of cppcheck (typedef a x[]; y = x ))
2011-08-14 20:38:16 -04:00
Robert Reif
b7f42535ec
fix #3000 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-14 18:50:33 -04:00
Robert Reif
389ab80b63
fix #2999 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-14 18:06:05 -04:00
Robert Reif
136c617a99
fix [tokenize.cpp:6353]: (style) Checking if unsigned variable 'indentlevel' is less than zero.
2011-08-13 12:47:16 -04:00
Robert Reif
b7f963f701
removed redundant set isNumber flag from previous commit
2011-08-12 07:15:10 -04:00
Robert Reif
ce00d0d35e
fix #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded)
2011-08-11 18:18:47 -04:00
Daniel Marjamäki
9a24492a00
Fixed #2975 (False positive: Return of the address of an auto-variable)
2011-08-10 18:16:31 +02:00
Robert Reif
10eb224ac7
fix #2983 (segmentation fault of cppcheck)
2011-08-09 18:31:02 -04:00
Robert Reif
afe95be966
fix #2980 (segmentation fault of cppcheck)
2011-08-08 06:58:55 -04:00
Robert Reif
829611b129
fix #2978 (segmentation fault of cppcheck ( enum E {} e enum ))
2011-08-07 16:48:47 -04:00
Kimmo Varis
cfcfa3f000
Use "enabled" list for the style checking.
...
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.
Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Robert Reif
222ed6d375
fix #2971 (Wrong warning generated)
2011-08-06 19:10:15 -04:00
Robert Reif
d23fb873cc
fix #2970 (Incorrect report: Class does not have a constructor)
2011-08-06 17:54:02 -04:00
Simon Martin
13360c2a66
Fixed #2870 (Tokenizer: simplify '0 |')
2011-08-06 06:50:29 +02:00
Robert Reif
fd01a7555a
fix #2966 (segmentation fault of cppcheck ( enum x : ))
2011-08-05 18:07:18 -04:00
Robert Reif
bc4db75aa9
fix #2146 (uninitialized variable: false negative for 'return x ? 1 : y;')
2011-07-31 21:33:43 -04:00
Robert Reif
addcec704f
fix cppcheck warning in Tokenizer::duplicateTypedef()
2011-07-30 10:12:35 -04:00
Daniel Marjamäki
1ce261e44d
astyle formatting
2011-07-24 14:54:13 +02:00
Daniel Marjamäki
158fa25623
Fixed #2817 (valgrind errors in simplifyTemplate when running tests)
2011-07-24 13:32:54 +02:00
Daniel Marjamäki
0dd5472642
Tokenizer::simplifyFunctionPointer: don't simplify function call. Ticket: #2873
2011-07-22 07:58:53 +02:00
Daniel Marjamäki
fb3870071a
Fixed #2885 (crash of cppcheck while checking gcc-testsuite)
2011-07-21 16:13:35 +02:00
Daniel Marjamäki
9f22d2fc6b
Fixed #2897 (out of bounds false positive, using reinterpret_cast)
2011-07-21 09:32:24 +02:00
Daniel Marjamäki
7e7f6eecf5
Fixed #2794 (Improper hanling of preprocessor directives #if defined)
2011-07-20 23:50:57 +02:00
Daniel Marjamäki
6ce5107e49
Tokenizer: Better handling of constants. Related with #2920
2011-07-20 09:07:47 +02:00
Daniel Marjamäki
35938e74ad
Tokenizer: better handling of 'struct AB ab; sizeof(ab)'
2011-07-16 22:07:30 +02:00
Daniel Marjamäki
cf3ab649fb
Fixed #2873 (segmentation fault of cppcheck while scanning rose-compiler suite)
2011-07-16 19:26:11 +02:00
Daniel Marjamäki
597733bec4
Tokenizer: minor update to handle C# code better
2011-07-16 18:12:55 +02:00
Daniel Marjamäki
274fd2b985
Tokenizer: Fix minor problem with 'X&&Y'
2011-07-15 19:37:39 +02:00
Daniel Marjamäki
66d145ba1c
Fixed #2892 (false positive: (portability) Assigning an address value to the integer (int/long/etc) type is not portable)
2011-07-07 15:14:33 +02:00
Robert Reif
b143b283e9
fix #2886 (crash of cppcheck ( typedef struct x { } ))
2011-07-03 10:50:15 -04:00
Robert Reif
8ec1dfacbf
fix missing pop in Tokenizer::simplifyStructDecl() when anonymous struct/union removed
2011-07-03 08:14:51 -04:00
Robert Reif
3f4cc5fa3a
add class A {} a; -> class A {}; A a; conversion capability to Tokenizer::simplifyStructDecl()
2011-07-02 09:21:30 -04:00
Daniel Marjamäki
db4a28d60b
Tokenizer::simplifyGoto: Only simplify the last label in the function. If there are many labels in the same function and all labels are simplified, this function becomes very slow.
2011-07-01 18:07:41 +02:00
Reijo Tomperi
89fd5bacf9
Fix #2849 , False positive: memory leak (using question mark operator)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2849
Simplify: *d = b ? b : a; into if-else
Simplify { ; { ; } } into { ; }
Removed one memleak test which should be redundant now as question marks
should not get into memleak check.
2011-06-30 22:04:26 +03:00
Robert Reif
77859b9a0f
fix #2878 (derived global class not tokenized properly (class A : ::B { };))
2011-06-30 07:25:36 -04:00
Robert Reif
586fdd24f2
fix #2825 (missing varid on class variables when multiple inheritance is used)
2011-06-29 20:04:04 -04:00
Robert Reif
443dd4c392
partial fix for #2867 handle derived class
2011-06-29 19:39:19 -04:00
Robert Reif
1286898fa0
fix #2864 (--errorlist missing errors: variableHidingTypedef and Extra qualification)
2011-06-28 21:46:54 -04:00
Robert Reif
f403de7bad
partial fix for #2867 Tokenizer::removeRedundantAssignment didn't understand function local class and removed class variable
2011-06-28 19:48:28 -04:00
Robert Reif
70a32fc245
fix #2875 (segmentation fault of cppcheck ( 0; (a) < (a) ))
2011-06-28 18:47:18 -04:00
Robert Reif
1713eeb532
fix #2859 (Extra qualification not detected)
2011-06-26 21:13:29 -04:00
Reijo Tomperi
918b4d859f
Fixed #2860 , False positive: Returning value of strncat() reported as memory leak
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2860
2011-06-26 23:53:16 +03:00
Daniel Marjamäki
40a14736b7
Added TODO test case for the simplifyKnownVariables to better simplify local variables
2011-06-23 17:03:14 +02:00
Daniel Marjamäki
2d1b7285d2
Fixed #2815 (FP: Null pointer dereference error about a member)
2011-06-23 16:58:01 +02:00
Robert Reif
db39f4364e
fix #2845 (segmentation fault of cppcheck)
2011-06-21 07:31:55 -04:00
Robert Reif
d80a55267c
fix #2844 fix to generate correct output
2011-06-19 20:19:16 -04:00
Robert Reif
0bd26a73c4
fix #2844 (typedef causes 'syntax error')
2011-06-19 17:57:01 -04:00
Robert Reif
eaf836b323
fix extra qualification check for same class name in different namespaces
2011-06-14 15:31:52 -04:00
Robert Reif
e584b08066
fix #2835 (crash of cppcheck ( ><,f<i, ))
2011-06-12 12:09:52 -04:00
Robert Reif
729ee72a5a
fix #2831 (crash of cppcheck ( z<y<x> ))
2011-06-12 08:38:15 -04:00
Robert Reif
d1b260699a
fix #2834 (crash of cppcheck (std::vector<int>::iterator))
2011-06-12 08:24:49 -04:00
Robert Reif
5e3263235b
fix #2739 (segmentation fault of cppcheck ( if()x ))
2011-06-11 15:51:12 -04:00
Robert Reif
3d4eb0d77e
fix #2682 (segmentation fault of cppcheck ( x a[0] = ))
2011-06-10 15:11:45 -04:00
Robert Reif
a9e2e15e40
improve #2828 fix by adding switch
2011-06-09 07:32:43 -04:00
Robert Reif
6635ed4630
fix #2828 (false positive: Function parameter 'STYLE' hides enumerator with same name)
2011-06-08 20:14:52 -04:00
Robert Reif
a7fe9a3b50
fix 2 use after frees in simplifyEnum found by visual studio and verified by valgrind
2011-06-03 21:50:08 -04:00
Robert Reif
311651cc66
fix #2804 (Underlying type of enumerator produces a syntax error)
2011-05-27 11:17:39 -04:00
Daniel Marjamäki
ab1b293f23
Fixed #2737 ((error) Analysis failed. If the code is valid then please report this failure.)
2011-05-19 17:04:36 +02:00
WenChung Chiu
1ea52cfa02
Fixed #2784 (Pointer issue: *&f=open())
2011-05-18 07:25:30 +02:00
Daniel Marjamäki
03cd57260a
added comment about how bad typedef behaviour can be reproduced
2011-05-07 14:40:47 +02:00
Daniel Marjamäki
8e5c63104c
Fixed #2743 (segmentation fault of cppcheck 'std::vector<void(*)()> v1 = a, v2 = b;')
2011-05-07 14:23:14 +02:00
Robert Reif
51baca0359
fix #1982 (simplifyTypedef: scope info is lost)
2011-05-02 22:42:52 -04:00
Daniel Marjamaki
297ca63868
Fixed #2721 (Tokenizer::simplifyTemplates: fail when using template argument 'char[2]')
2011-05-01 19:05:18 +02:00
Daniel Marjamäki
bb3c135d81
Tokenizer: Moved a few basic simplifications from simplifyTokenList to tokenize
2011-05-01 08:36:27 +02:00
Daniel Marjamäki
168bd2ebfc
Fixed #2760 (false positive: uninitialized variable ', (a) =')
2011-05-01 08:27:59 +02:00
Daniel Marjamäki
fb32d5111e
Fixed #2755 (cppcheck goes into infinite loop while scanning OpenSSL sources)
2011-04-29 19:47:39 +02:00
Robert Reif
e30852200e
fix tokenizer bug where 'class B : private ::A { };' was tokenized to 'class B : private: : A { } ;'
2011-04-29 09:19:22 -04:00
Robert Reif
3c415e7833
fix #2745 (Enum vs local variable - conflict)
2011-04-23 22:08:03 -04:00
Robert Reif
670741271e
fix #2746 (false positive: syntax error (typedef in __attribute__ )))
2011-04-23 21:04:02 -04:00
Robert Reif
cd64d8476c
fixed #2614 (missing varid on function parameter)
2011-04-23 09:37:50 -04:00
Robert Reif
04309f74f5
fix #2738 (syntax error on valid code)
2011-04-20 19:09:28 -04:00
Robert Reif
b1d3d291e6
fix #2736 (segmentation fault of cppcheck)
2011-04-20 07:49:04 -04:00
Martin Exner
2b08744b97
Fixed #2676 (setVarId: variables with global scope qualification :: don't get varids)
2011-04-18 06:56:39 +02:00
Daniel Marjamäki
05f59a1567
Tokenizer: Fixed bug. When varid is 0 then %varid% doesn't work. Ticket: #2723
2011-04-16 17:45:14 +02:00
Robert Reif
877a233145
fix #2716 (Easy to reproduce crash)
2011-04-16 10:35:23 -04:00
Daniel Marjamäki
739b6a93e2
Fixed #2713 (False positive (Redundant assignment))
2011-04-16 12:07:56 +02:00
Robert Reif
3159df958d
fix #2720 (false positive: syntax error with c++0x code)
2011-04-14 19:50:17 -04:00
Daniel Marjamäki
58dbbb0cab
Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError.
2011-04-14 18:02:01 +02:00
Daniel Marjamäki
7021e3224b
Fixed #2714 (False positive: ternary operator and += style warning.)
2011-04-14 17:30:50 +02:00
Robert Reif
75e5353b6d
fix #2718 (Analysis failed. If the code is valid then please report this failure.)
2011-04-13 23:58:58 -04:00
Robert Reif
257197bdd1
fix #2717 (false positive: syntax error (typedef void f(int) const;))
2011-04-13 23:24:41 -04:00
Daniel Marjamäki
11bd6bcd30
Fixed #2712 (false positive: Division by zero)
2011-04-10 21:27:09 +02:00
Daniel Marjamäki
1d86fb1738
Tokenizer: Code cleanup. Use %oror% to simplify code.
2011-04-10 11:55:15 +02:00
Daniel Marjamäki
0a1d6efe8c
Tokenizer: Use %op% in simplifyOperatorName
2011-04-10 11:24:57 +02:00
Daniel Marjamäki
f179df1f10
Tokenizer: Use %op% in simplifyCalculations
2011-04-10 11:22:00 +02:00
Daniel Marjamäki
57869e96e3
Tokenizer: Use %op% to clean up pattern
2011-04-10 11:09:49 +02:00
Daniel Marjamäki
970c989023
Tokenizer: Code cleanup. Removed redundant variable
2011-04-10 09:20:37 +02:00
Daniel Marjamäki
f4f8aeca03
Tokenizer: Fixed bug in last commit
2011-04-10 09:18:37 +02:00
Daniel Marjamäki
4c753ca5ac
Tokenizer: Use the %oror% in multiCompare patterns
2011-04-10 09:16:29 +02:00
Daniel Marjamäki
a4471bc150
Refactoring: Use %op%
2011-04-09 18:33:37 +02:00
Daniel Marjamäki
447f61e9c7
Refactoring: Use %op%
2011-04-09 18:30:47 +02:00
Daniel Marjamäki
0730fad778
Refactoring: Use %op%
2011-04-09 18:24:41 +02:00
Daniel Marjamäki
6c4f5fc496
Token::multiCompare : allow that %op% is used in multiCompare pattern
2011-04-09 18:09:13 +02:00
Daniel Marjamäki
575cb242c2
Refactoring: Use Token::isOp
2011-04-09 16:22:47 +02:00
Daniel Marjamäki
f6d910ab3d
Refactoring: Use Token::isOp
2011-04-09 15:54:36 +02:00
Daniel Marjamäki
8e711b7925
Refactoring: there was almost duplicate functions 'isOp'. Created a new Token::isOp function instead.
2011-04-08 19:40:22 +02:00
Robert Reif
23e4f020e9
fix #2706 (Analysis failed. If the code is valid then please report this failure.)
2011-04-04 22:18:12 -04:00
Daniel Marjamäki
ed8cdddcf5
Tokenizer: execute the simplifyIfNot and simplifyIfNotNull in the normal token list. ticket #2642
2011-04-02 21:21:05 +02:00
Daniel Marjamäki
ea57e10c7f
Tokenizer::simplifyCalculations: simplify division result if it's a whole number, even though it doesn't have precedence
2011-04-02 12:52:11 +02:00
Daniel Marjamäki
f34e9e6623
Tokenizer: better simplification of calculations in conditions
2011-04-02 11:08:58 +02:00
Daniel Marjamäki
ae2a8d839b
Fixed #2693 (__declspec attribute not removed properly)
2011-03-30 19:49:55 +02:00
Stefan Weil
675e63b6a7
Spell checks
2011-03-30 16:45:31 +02:00
Robert Reif
e9a23d9cb5
fix #2692 (False positive: if parsed as function in operator >>)
2011-03-28 20:02:06 -04:00
Daniel Marjamäki
e89f6d6ec0
Fixed #2660 (False positive: Variable 'v' is assigned a value that is never used)
2011-03-27 08:19:09 +02:00
Daniel Marjamäki
3c2d3ca3a4
Fixed #2653 (segmentation fault of cppcheck 'x=b=0;')
2011-03-26 12:20:23 +01:00
Daniel Marjamäki
7d9872a134
Tokenizer::setVarId: Prevent that wrong varid is given when uncertain. Ticket: #2680
2011-03-26 10:05:07 +01:00
Daniel Marjamäki
2b1277aa64
Fixed #2680 (setVarId: variables with class qualification don't get varid)
2011-03-26 08:56:41 +01:00
Robert Reif
710eb8ffd9
add support for global namespace to Tokenizer::simplifyVarDecl()
2011-03-24 23:06:20 -04:00
Robert Reif
fc258164cd
fix #2675 (false positive: syntax error)
2011-03-24 22:26:42 -04:00
Robert Reif
cbc81e20f5
fix Tokenizer::simplifyVarDecl() template assignment
2011-03-23 21:15:49 -04:00
Robert Reif
7e3e5d628d
better fix for #2672 (False positive: function can be const, nested classes declared in one line)
2011-03-23 20:19:32 -04:00
Robert Reif
3259239dfe
fix #2672 (False positive: function can be const, nested classes declared in one line)
2011-03-23 07:48:18 -04:00
Robert Reif
c043e6e1a2
fix
2011-03-21 20:57:17 -04:00
Robert Reif
dc0dfea079
fix invalid bitfield match and simplification that created invalid code
2011-03-21 20:17:14 -04:00
Robert Reif
fc13854095
fix #1280 (Pointer to function support)
2011-03-19 16:21:26 -04:00
Robert Reif
92316e5745
fix #1987 (Internal error:: CheckClass::SpaceInfo::getVarList found variable 'element_size' with varid 0.)
2011-03-19 16:00:43 -04:00
Daniel Marjamäki
31af3a64bc
Tokenizer::setVarId: Fixed problem with same variable name in multiple classes
2011-03-19 11:09:51 +01:00
Daniel Marjamäki
45a3828da7
Tokenizer::setVarId: Better handling of class declarations when variable usage comes before variable declaration
2011-03-19 09:04:03 +01:00
Robert Reif
afc7fd82ed
#2630 (segmentation fault of cppcheck (template <typedef A>)
2011-03-18 20:44:58 -04:00
Robert Reif
7b63da4964
fix #2651 (Segmentation fault (typedef))
2011-03-17 20:00:49 -04:00
Daniel Marjamäki
dab09aedee
Fixed #2648 (Tokenizer::simplifyTemplates: Segmentation fault (gcc-testsuite))
2011-03-17 21:45:03 +01:00
Robert Reif
7e04ea0859
fix removal of throw() from const functions
2011-03-16 19:54:52 -04:00
Daniel Marjamäki
fec9edf628
Tokenizer::simplifyTemplates: First simple fix for problems when using sizeof in template parameter
2011-03-16 22:16:30 +01:00
Robert Reif
f7cbc90c84
fix #2581 (### Internal error in Cppcheck. Please report it.)
2011-03-15 23:28:45 -04:00
Robert Reif
ba0b3e6451
fix #2651 function typedef with extra ()s
2011-03-15 19:24:30 -04:00
Daniel Marjamäki
07fe361964
Fixed #2638 (Tokenizer::setVarId : varid is wrongly given when unknown macro is used)
2011-03-13 17:52:45 +01:00
Robert Reif
79f0fe7d1c
refactor symbol database and checks to use list of Scope rather than list of Scope pointers
2011-03-10 19:43:29 -05:00
Daniel Marjamäki
5a0ec56fc2
Fixed #2632 (segmentation fault of cppcheck ( void>(); void>() ))
2011-03-09 21:25:44 +01:00
Robert Reif
7a7257f200
fix #2630 (segmentation fault of cppcheck ( typedef ... )
2011-03-08 20:24:57 -05:00
Daniel Marjamäki
0b8581e717
Fixed #2620 (Tokenizer::setVarId : wrong handling of member function parameters)
2011-03-08 20:41:41 +01:00
Robert Reif
d74ae3b0f0
copy all flag fields in a Token
2011-03-07 20:04:25 -05:00
Daniel Marjamäki
7496cd412c
Fixed #2631 (Tokenizer::simplifyTemplates: template usage 'std::cout << (foo<double>(r));')
2011-03-07 21:21:06 +01:00
Robert Reif
d678e4424c
fix #2630 (segmentation fault of cppcheck ( typedef y x () x ))
2011-03-06 18:59:56 -05:00
Daniel Marjamäki
f53ff27b71
Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631
2011-03-06 21:15:42 +01:00
Daniel Marjamäki
6648267ab8
Revert "Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631 "
...
This reverts commit de31ec1e44
.
2011-03-06 21:07:06 +01:00
Daniel Marjamäki
de31ec1e44
Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631
2011-03-06 10:28:51 -08:00
Daniel Marjamäki
779dba9160
Fixed #2612 (segmentation fault of cppcheck ( <><< ))
2011-03-06 09:33:46 +01:00
Robert Reif
0debba4409
finish fixing #2624 (better function pointer support needed)
2011-03-05 21:41:58 -05:00
Robert Reif
7d2fb2ecde
partial fix for #2624 (better function pointer support needed)
2011-03-05 20:48:28 -05:00
Robert Reif
f3b2acf585
really fix #2620 reference of typedef of array not simplified properly
2011-03-03 20:32:10 -05:00
Daniel Marjamäki
d7a6e729b8
Tokenizer::simplifyKnownVariables: Don't simplify 'strcpy(a,"ab"); b=a;'. Ticket: #2031
2011-03-03 20:07:56 +01:00
Robert Reif
3f0d0446e0
revert previous commit: simplified code isn't correct
2011-03-03 07:40:43 -05:00
Robert Reif
ee4b4f62d8
fix #2620 reference of typedef of array not simplified properly
2011-03-03 07:27:53 -05:00
Daniel Marjamäki
8e9a1c33ad
Fixed #2618 (Tokenizer::simplifyKnownVariables: Don't use known string value if address is wanted)
2011-03-01 20:20:48 +01:00
Daniel Marjamäki
db04d7b71e
Fixed #2616 (Segmentation fault with unknown macro)
2011-03-01 18:02:50 +01:00
Robert Reif
92efbd748e
fix #2595 bitfield fix for case x: break; and default: break;
2011-02-28 19:35:00 -05:00
Daniel Marjamäki
893b84a87c
Fixed #2615 (Segmentation fault in cppcheck 1.47)
2011-02-28 20:29:34 +01:00
Daniel Marjamäki
c1c9b96bb6
Fixed #2031 (Tokenizer: simplify known value (string has known value after strcpy))
2011-02-26 21:11:56 +01:00
Robert Reif
3529014924
expose number of variables found by Tokenizer
2011-02-26 08:42:19 -05:00
Daniel Marjamäki
9bf6e67898
Fixed #2610 (segmentation fault of cppcheck ( if () < {} ))
2011-02-24 18:49:16 +01:00
Robert Reif
26152a9264
fix #2609 (False positive on template dependent name)
2011-02-24 06:39:46 -05:00
Daniel Marjamäki
daf0e7c37d
Fixed #2604 (Segmentation fault of cppcheck ( sizeof <= A ))
2011-02-23 20:44:14 +01:00
Robert Reif
d1f7a8aca4
fix #2403 (simplifyTypedef: array of function pointers) Internal error message
2011-02-22 22:11:17 -05:00
Robert Reif
dd12fc177f
fix #2603 (segmentation fault of cppcheck ( typedef constexpr))
2011-02-22 07:48:34 -05:00
Robert Reif
703448171a
fix #2601 (segmentation fault of cppcheck)
2011-02-22 07:02:15 -05:00
Robert Reif
4e1ce93104
fix #2600 (segmentation fault of cppcheck ( enum{const} ))
2011-02-21 19:30:40 -05:00
Robert Reif
999646fca6
fix #2599 (segmentation fault of cppcheck ( sizeof ))
2011-02-21 17:49:30 -05:00
Daniel Marjamäki
55711698d0
Fixed #2591 (cppcheck hangs with 100% cpu load ( class A : ))
2011-02-21 19:41:34 +01:00
Robert Reif
763763fa9b
fix bitfields to support non-numeric bitfield width
2011-02-20 18:22:49 -05:00
Daniel Marjamäki
5dea79a07d
cppcheckError: Rephrazed the error message. The 'internal error' sounds like something dangerous happens that needs to be fixed. So I think 'analysis failed' is better. If the code has a syntax error then 'analysis failed' is entirely ok.
2011-02-20 19:56:13 +01:00
Daniel Marjamäki
63c003f92e
Tokenizer: fixed so that 'p=&x; if(p)' is simplified to 'p=&x;if(&x)'. Ticket: #2596
2011-02-20 18:18:27 +01:00
Daniel Marjamäki
1cfb18be08
astyle formatting
2011-02-20 12:22:01 +01:00
Daniel Marjamäki
46f4e46d30
Tokenizer::simplifyTemplates: Better handling for multi-token template arguments such as 'Foo<std::string>'
2011-02-20 12:17:05 +01:00
Robert Reif
77fe9858e2
fix #2587 (Spurious warning about struct hiding typedef)
2011-02-19 14:18:37 -05:00
Greg Hewgill
7e5d8e42d4
remove stray BOM from source file
2011-02-19 16:10:50 +13:00
Daniel Marjamäki
f363bc1560
Borland C++: Fixed compiler error
2011-02-18 20:21:48 +01:00
Daniel Marjamäki
cf2a04377e
Fixed #2586 (segmentation fault of cppcheck (template<>))
2011-02-17 21:15:17 +01:00
Daniel Marjamäki
54e0b60cc5
Fixed #2584 (false positive 'variable n is never used')
2011-02-16 20:33:24 +01:00
Daniel Marjamäki
0ed0d07714
Tokenizer::simplifyCalculations: basic handling of bitwise operators
2011-02-14 20:43:26 +01:00
Robert Reif
cdd8d3f785
Really fix #2348 perl-tk
2011-02-13 19:02:57 -05:00
Daniel Marjamäki
0d2d0c864a
Tokenizer::simplifyKnownVariables: Fixed TODO testcases (better handling of comparisons)
2011-02-13 22:24:45 +01:00
Daniel Marjamäki
2182ede486
Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of ^)
2011-02-13 22:13:19 +01:00
Daniel Marjamäki
472d8154ca
Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of |)
2011-02-13 22:09:04 +01:00
Daniel Marjamäki
467c984cd1
Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of %)
2011-02-13 22:03:46 +01:00
Robert Reif
c03ace7378
Fix #2579 (segmentation fault of cppcheck)
2011-02-13 14:11:22 -05:00
Robert Reif
ad22aebf8c
Really fix : #2376 (simplifyTypedef: upx-ucl)
2011-02-13 13:34:55 -05:00
Daniel Marjamäki
de75bdfed5
Tokenizer: comments/refactorings
2011-02-12 21:11:20 +01:00
Daniel Marjamäki
4d1aae5859
Tokenizer::simplifyTemplates: Broke out the functionality that instantiates a template
2011-02-12 20:58:45 +01:00
Daniel Marjamäki
9021f0f180
Tokenizer::simplifyTemplates: Broke out the functionality that handles default template arguments
2011-02-12 20:27:44 +01:00
Daniel Marjamäki
00bdf618f2
Tokenizer::simplifyTemplates: Broke out the functionality that extract a list of template instantiations
2011-02-12 20:17:58 +01:00
Daniel Marjamäki
25d6bfe3c4
Tokenizer::simplifyTemplates: broke out the functionality that extract a list of template declarations
2011-02-12 20:12:07 +01:00
Daniel Marjamäki
654116af61
Tokenizer::simplifyTemplates: Broke out handling for 'template<>..'
2011-02-12 19:43:33 +01:00
Daniel Marjamäki
07e8325e50
Fixed #2549 (segmentation fault of cppcheck)
2011-02-12 16:51:59 +01:00
Daniel Marjamäki
63ade3e4f6
Tokenizer::simplifyKnownVariables: Split up the function into smaller functions. Broke out ..GetData function that extracts info about assigned variable before the simplification is made.
2011-02-12 09:24:20 +01:00