Commit Graph

209 Commits

Author SHA1 Message Date
Daniel Marjamäki ee1bcb728c use '<' comparisons instead of '>' (#610) 2009-10-04 07:51:12 +02:00
Slava Semushin 9983066f62 Fixed #770 (Tokenizer: Var id not set for static variables in some cases)
http://sourceforge.net/apps/trac/cppcheck/ticket/770
2009-10-03 17:05:07 +07:00
Reijo Tomperi 107895e8cc TODO test cases TestTokenizer::vardec_static added 2009-10-02 17:28:30 +03:00
Daniel Marjamäki e894e37131 Fixed #679 (False positive: Unused private function produced by exception specification) 2009-10-01 19:45:48 +02:00
Reijo Tomperi f9871c2d54 Fix #745 (false positive: possible null pointer dereference , while)
http://sourceforge.net/apps/trac/cppcheck/ticket/745
2009-09-30 21:42:14 +03:00
Reijo Tomperi 6ed727564c Fix #759 (Tokenizer: Incorrect var id when two variables with same name)
http://sourceforge.net/apps/trac/cppcheck/ticket/759
2009-09-30 14:40:10 +03:00
Reijo Tomperi ededbfb10e Fix comment in test case 2009-09-29 17:19:56 +03:00
Reijo Tomperi 2d4404f030 Fix #754 (Tokenizer: transform modifier "signed" to "int")
http://sourceforge.net/apps/trac/cppcheck/ticket/754
Also fix int unsigned -> unsigned int
2009-09-28 21:25:05 +03:00
Slava Semushin b9237db9a3 Fixed #753 (Tokenizer: don't simplify variables inside do {} while loop)
http://sourceforge.net/apps/trac/cppcheck/ticket/753
2009-09-28 22:15:31 +07:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Slava Semushin a919f4541a Fixed #732 (Tokenizer: Incorrect simplification)
Regression since 58a9e05697 commit.

http://sourceforge.net/apps/trac/cppcheck/ticket/732
2009-09-26 17:02:13 +07:00
Reijo Tomperi 62ccda5677 Fix #713 (Tokenizer: Simplify 0L)
http://sourceforge.net/apps/trac/cppcheck/ticket/713
Use MathLib to handle other variations of 0.
2009-09-23 22:44:52 +03:00
Reijo Tomperi ef09f3475c Fix #713 (Tokenizer: Simplify 0L)
http://sourceforge.net/apps/trac/cppcheck/ticket/713
2009-09-23 00:23:11 +03:00
Daniel Marjamäki faac5bccd6 Fixed #702 (If you see this, there is a bug - varid was 0) 2009-09-22 17:49:13 +02:00
Reijo Tomperi 1c01dd64f3 Fix #703 (Tokenizer: Create links for [])
http://sourceforge.net/apps/trac/cppcheck/ticket/703
2009-09-20 23:13:06 +03:00
Slava Semushin 7236230228 Additional fix for better simplifying array declaration.
Pointed out by hyd_danmar@ in IRC.

Addressed to #696
2009-09-20 18:28:56 +07:00
Slava Semushin 58a9e05697 Fixed #696 (Tokenizer: Simplify array declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/696
2009-09-20 17:28:15 +07:00
Reijo Tomperi 661e4504cb astyle fix 2009-09-19 14:21:50 +03:00
Slava Semushin 7a07f9343f test/testtokenize.cpp: refactoring code.
- introduce and use simplifyKnownVariables() function
- don't append leading space to result string with tokens

No functional change.
2009-09-19 13:55:41 +07:00
Reijo Tomperi 2b6955dde5 Fix #670 (Tokenizer: Simplify '\0' into 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/670
2009-09-14 21:42:56 +03:00
Slava Semushin 8cafaf2960 Fixed #603 (Tokenizer: Incorrect simplification of < >)
http://sourceforge.net/apps/trac/cppcheck/ticket/603
2009-08-23 13:26:16 +07:00
Slava Semushin acc38a8bbf Fixed #592 (Tokenizer: improve the tokenization of do .. while)
http://sourceforge.net/apps/trac/cppcheck/ticket/592
2009-08-22 17:49:42 +07:00
Daniel Marjamäki 94c49bc34e Fixed #608 (Tokenizer: simplifyKnownVariables doesn't handle 'while (--i)' correctly) 2009-08-22 10:23:55 +02:00
Slava Semushin cbeb45566b Fixed #609 (Tokenizer: don't add {} after do-while();)
http://sourceforge.net/apps/trac/cppcheck/ticket/609
2009-08-22 14:49:45 +07:00
Reijo Tomperi 4f8a06ed0d Initial work for class and member function/variable list in tokenizer. 2009-08-12 23:50:03 +03:00
Slava Semushin 6a7624054e Fixed ticket #584 (Tokenizer: don't set varId for class declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/584
2009-08-12 01:58:49 +07:00
Slava Semushin c66103f7bc Fixed ticket #574 (Tokenizer: not assign varId when variable first afer keyword and has long type)
http://sourceforge.net/apps/trac/cppcheck/ticket/574
2009-08-09 15:41:31 +07:00
Slava Semushin 50f7fa5828 Fixed ticket #565 (Tokenizer: simplify variable declaraion like 'int z = x >> 16')
http://sourceforge.net/apps/trac/cppcheck/ticket/565
2009-08-08 17:33:07 +07:00
Daniel Marjamäki e1beb70f80 Fixed #558 (Tokenizer: Bad simplification of 'for(unsigned i = 0; i < 100; ++i)') 2009-08-05 20:15:48 +02:00
Daniel Marjamäki 706ba34a6d Refactoring the unit testing 2009-08-04 21:32:14 +02:00
Slava Semushin 0445edf6fe Fixed #542 (Tokenizer: allow numbers in templates parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/542
2009-08-01 23:17:35 +07:00
Slava Semushin 0e2273833e Fixed ticket #539 (Tokenizer: don't replace constants variables with varid 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/539
2009-08-01 20:57:54 +07:00
Slava Semushin 8588012df7 Fixed #521 (Tokenizer: improve static variable detection)
Also change cppcheck default behavior to don't show "If you see this,
there is a bug" message for each variable without varId. This feature
was very helpful for developers but may annoying users.

http://sourceforge.net/apps/trac/cppcheck/ticket/521
2009-08-01 00:40:36 +07:00
Daniel Marjamäki 2b26a320f0 astyle formatting 2009-07-31 14:01:50 +02:00
Slava Semushin 5db677bc30 Fixed ticket #523 (Tokenizer: set varId for types with long namespaces)
FIXME: skip namespaces by the best way.

http://sourceforge.net/apps/trac/cppcheck/ticket/533
2009-07-31 00:40:41 +07:00
Slava Semushin 681b836389 Fixed ticket #532 (Tokenizer: set varId for types which have comma in template parameter)
http://sourceforge.net/apps/trac/cppcheck/ticket/532
2009-07-31 00:25:26 +07:00
Slava Semushin 8b0c1daf98 Fixed ticket #522 (Tokenizer: recognize comma in container with STL type declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/522
2009-07-29 02:46:33 +07:00
Slava Semushin f50aa1e188 Fixed ticket #520 (Tokenizer: properly set varId for containers with STL types)
http://sourceforge.net/apps/trac/cppcheck/ticket/520
2009-07-29 00:54:13 +07:00
Slava Semushin 8643936e0c Fixed ticket #500 (Tokenizer: simplify the "(p != NULL)" conditions)
Also teach simplifyIfNot() to handle variables like Foo::var.

https://sourceforge.net/apps/trac/cppcheck/ticket/500
2009-07-25 18:23:03 +07:00
Slava Semushin 88d7c598e3 test/testtokenize.cpp: use tokenizeAndStringify() function.
Instead of self-written code.

No functional change.
2009-07-25 16:41:16 +07:00
Daniel Marjamäki ffac9281c4 astyle formatting 2009-07-18 20:35:22 +02:00
Slava Semushin 53c120c701 Fixed ticket #479 (varId not assigned to reference to standart container)
http://sourceforge.net/apps/trac/cppcheck/ticket/479
2009-07-18 17:41:46 +07:00
Daniel Marjamäki 17008879ac minor refactoring: header cleanup. use forward declarations instead of includes 2009-07-13 19:11:31 +02:00
Kimmo Varis 6393498966 Astyle fixes. 2009-07-13 16:51:35 +03:00
Daniel Marjamäki a6ac747830 tokenizer: Don't simplify declarations of static variables 2009-07-06 11:45:14 +02:00
Reijo Tomperi 8b0e481d46 Refactoring: Rename member functions to follow naming guidelines. 2009-07-05 23:16:43 +03:00
Reijo Tomperi bdf1987cc4 Fix ticket #435 (False positive: Invalid number of character when ({}) is used in code)
http://sourceforge.net/apps/trac/cppcheck/ticket/435
2009-06-22 23:54:11 +03:00
Daniel Marjamäki 13b8f10906 refactoring testcases for Tokenizer::simplifyAddBraces 2009-06-20 13:20:51 +02:00
Reijo Tomperi 5f7d88b36c Fix ticket #416 (False positive: Redundant code)
http://sourceforge.net/apps/trac/cppcheck/ticket/416
2009-06-19 19:03:09 +03:00
Reijo Tomperi c28cd3f82e astyle fix 2009-06-18 21:05:42 +03:00
Slava Semushin fafc261611 Fixed ticket #278 (variable id: references are not handled correctly)
http://sourceforge.net/apps/trac/cppcheck/ticket/278
2009-06-18 23:30:04 +07:00
Slava Semushin 8c327f82b3 Fixed ticket #346 (adding a "const" token prevents detection of memory leak)
http://sourceforge.net/apps/trac/cppcheck/ticket/346
2009-06-15 00:32:34 +07:00
Daniel Marjamäki af7c63155e Fixed #387 (Templates: template functions that return a pointer are not simplified correctly)
* Fixed so that the tokenizer handle variable declarations better when the variable is assigned the return value of a template function
 * Fixed so that the simplifyTemplates detect that a template function is used when its return value is taken
2009-06-14 14:57:47 +02:00
Slava Semushin cba0d9e130 Fixed ticket #392 (false positive and wrong allocation and deallocation not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/392
2009-06-12 21:14:01 +07:00
Slava Semushin 7bee0cd2df Fixed ticket #390 (wrong allocation and deallocation not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/390
2009-06-12 20:04:58 +07:00
Daniel Marjamäki dd473b074a Fix #153 (Unsigned divide)
The "unsigned i" variable declaration wasn't handled well. So I added an "int" token.
2009-06-06 10:40:48 +02:00
Slava Semushin 52a8368b02 Strip redundant std::string usage from tests.
Second round: handle empty strings.

Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|'

Should be no functional change.
2009-06-05 07:43:55 +07:00
Reijo Tomperi 3428584925 Fix ticket #351 (false positive::resource leak)
http://apps.sourceforge.net/trac/cppcheck/ticket/351
2009-06-03 22:02:16 +03:00
Slava Semushin e5c0383594 Strip redundant std::string usage from tests.
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".\+"\)),|ASSERT_EQUALS(\1,|'

Should be no functional change.
2009-06-01 02:50:25 +07:00
Daniel Marjamäki 2120edb89b Variable Id: structs must not have variable id 2009-05-31 18:46:32 +02:00
Reijo Tomperi 3fe1b50e60 Fix ticket #344 (Tokenizer crash in Windows)
http://apps.sourceforge.net/trac/cppcheck/ticket/344
2009-05-31 15:55:06 +03:00
Reijo Tomperi 58eda6e978 Fix ticket #325 (Replace developer names in source files with AUTHORS file)
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Reijo Tomperi 8876f0ee57 Fix ticket #342 (Simplify "if( (true) == true )")
http://apps.sourceforge.net/trac/cppcheck/ticket/342
2009-05-30 00:04:01 +03:00
Reijo Tomperi a015704591 Changed expected result for test case TestTokenizer::removeParantheses3 to simplify it more 2009-05-28 23:13:15 +03:00
Reijo Tomperi a3be307c03 Fix bug related to ticket #330, cppcheck hanged with some files containing "(("
http://apps.sourceforge.net/trac/cppcheck/ticket/330
2009-05-28 23:03:36 +03:00
Daniel Marjamäki a3990648a9 Tokenizer: Simplifying redundant parantheses
http://apps.sourceforge.net/trac/cppcheck/ticket/330
2009-05-28 19:37:39 +02:00
Reijo Tomperi adb1ed4947 Fix ticket #319 (Function names are tagged as variables)
http://apps.sourceforge.net/trac/cppcheck/ticket/319
2009-05-27 23:34:08 +03:00
Reijo Tomperi d6a34dafb2 Added test case TestMemleak::dealloc_and_alloc_in_func 2009-05-27 22:16:54 +03:00
Daniel Marjamäki ca6d927dfa Fix ticket 330 (found memory leak when __builtin_expect uses) 2009-05-27 20:49:29 +02:00
Daniel Marjamäki e89c03da92 Fix ticket 308 (cppcheck msg:: invalid number of ((). Cant process file) 2009-05-27 20:07:18 +02:00
Reijo Tomperi ea4232fb06 Fix ticket #334 (segmentation fault on boost 1.39.0)
http://apps.sourceforge.net/trac/cppcheck/ticket/334
2009-05-26 23:22:00 +03:00
Daniel Marjamäki b9b542d05b Fixed ticket #333 (tokenizer: incorrect removal of decrement/increment) 2009-05-25 14:21:58 +02:00
Reijo Tomperi 24d96b188e Fix ticket #305 (Negative value passed to ASSERT_EQUALS)
http://apps.sourceforge.net/trac/cppcheck/ticket/305
Moved also test case from testtokenizer to testtoken.
2009-05-12 21:28:02 +03:00
Reijo Tomperi e83db8ac7b Fix ticket #288 (Tokenizer::syntaxError should use error logger instead of std::cout)
http://apps.sourceforge.net/trac/cppcheck/ticket/288
2009-05-11 22:52:04 +03:00
Reijo Tomperi f2a5527e60 Fix #289 (if() is not properly tokenized)
http://apps.sourceforge.net/trac/cppcheck/ticket/289
2009-05-09 23:12:14 +03:00
Reijo Tomperi dd8b738f7f Initial fix for ticket #283 (segmentation fault when checking xterm sources)
http://apps.sourceforge.net/trac/cppcheck/ticket/283
It should print out error message now instead of crashing. Cleanup is needed.
2009-05-07 23:17:29 +03:00
Reijo Tomperi 0f59ef9064 Fix #276 (simplification: Variable value)
http://apps.sourceforge.net/trac/cppcheck/ticket/276
2009-05-03 21:57:27 +03:00
Reijo Tomperi cb209bbd41 Fix #279 (Refactoring: replace and remove Token::aaaa , Token::aaaa0 and Token::aaaa1)
http://apps.sourceforge.net/trac/cppcheck/ticket/279
2009-05-03 21:10:59 +03:00
Daniel Marjamäki f6d6a3855e varid: updated handling of variable id for class variables (#26) 2009-05-03 13:50:26 +02:00
Daniel Marjamäki 6a009f7084 tokenizer: give class member variables varId (#26) 2009-05-02 22:57:18 +02:00
Daniel Marjamäki 6f4c5ab71c refactoring: Replaced 'aaaa' 2009-05-01 22:41:55 +02:00
Reijo Tomperi 26c193f9bc Fix ticket #204 (false positive::memory leak with --all when free is guarded by simple if)
http://apps.sourceforge.net/trac/cppcheck/ticket/204
2009-05-01 21:31:07 +03:00
Reijo Tomperi bc4fb21325 tokenizer: simplify assembler (#270), fix _asm also.
http://apps.sourceforge.net/trac/cppcheck/ticket/270
2009-05-01 20:53:08 +03:00
Daniel Marjamäki e37da13c26 tokenizer: simplify assembler (#270) 2009-05-01 12:39:14 +02:00
Reijo Tomperi 7e5c32b7f4 Fix ticket #269 (Incorrect variable id, when delete is used.)
http://apps.sourceforge.net/trac/cppcheck/ticket/269
2009-04-29 22:45:57 +03:00
Reijo Tomperi d4a7256686 Added test case TestTokenizer::varid_delete for ticket #269
http://apps.sourceforge.net/trac/cppcheck/ticket/269
2009-04-29 22:22:56 +03:00
Daniel Marjamäki 49430afabe varid: Set variable id for stl containers and iterators 2009-04-25 16:55:00 +02:00
Reijo Tomperi 14eff64194 Fix ticket #258 (segmentation fault)
http://apps.sourceforge.net/trac/cppcheck/ticket/258
2009-04-20 21:38:05 +03:00
Daniel Marjamäki 6f7f8c4b4f Tokenizer: Don't treat typedefs as variable declarations (#234) 2009-03-28 21:07:33 +01:00
Daniel Marjamäki 0cfa241abb variable id: enabled test case for function parameters 2009-03-25 18:15:49 +01:00
Daniel Marjamäki c74da7bab9 variable id: give std::string variables an id 2009-03-25 18:10:03 +01:00
Daniel Marjamäki 9f3634412e simplify tokens (known variable values in conditions) 2009-03-25 07:10:17 +01:00
Nicolas Le Cam 2b199ffb9b Fix compilation on 64bit systems 2009-03-18 22:13:27 +01:00
Daniel Marjamäki f37dd4f143 Fixed ticket 184 (Tokenizer - Simplification: Split up variable declarations) 2009-03-18 20:32:05 +01:00
Reijo Tomperi 2fb4c52728 Fixed tokenizer: "return - 2 ;" --> "return -2 ;" 2009-03-18 20:48:06 +02:00
Daniel Marjamäki 9c057c707b tokenize negative numbers into a single token 2009-03-17 20:50:06 +01:00
Daniel Marjamäki f9b481ae3a Ticket #184 (Tokenizer - Simplification: Split up variable declarations), added testcases 2009-03-16 19:03:23 +01:00
Reijo Tomperi 21b687b301 Improved tokenizer to handle '#' better. Previously everything after # was combined into a single token,
now # is considered more like an alphabet, with few exceptions, e.g. "##" tokens.
2009-03-15 23:09:27 +02:00
Reijo Tomperi ca7870af33 Fix ticket #177 (Tokenizer doesn't add braces around if-scope)
http://apps.sourceforge.net/trac/cppcheck/ticket/177
2009-03-15 14:44:57 +02:00
Daniel Marjamäki 3b29125d65 added testcase for 'Tokenizer::FindClassFunction' 2009-03-13 22:38:42 +01:00