Commit Graph

738 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 650d58e3de Fix for ticket 337 ('scope can be limited' false positive with variables referenced by pointers) 2009-05-27 19:38:26 +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
Daniel Marjamäki 2d2c0e42cc Fix ticket #317 (pre-increment causes style false positive) 2009-05-25 08:31:20 +02:00
Daniel Marjamäki 7fdd497c44 Fix ticket #317 (pre-increment causes style false positive) 2009-05-25 08:26:11 +02:00
Reijo Tomperi 977e31786d Fix ticket #332 (White space between macro name and '(' causes macro simplification to fail)
http://apps.sourceforge.net/trac/cppcheck/ticket/332
2009-05-24 23:57:12 +03:00
Slava Semushin 9ae9ffa9be src/checkmemoryleak.cpp(GetAllocationType): simplify condition a bit.
Replace two Token::simpleMatch() calls to one Token::Match().

Correction for my previous (2654a4aa54)
commit.

No functional change.
2009-05-24 03:46:50 +07:00
Slava Semushin 2654a4aa54 Added support to search resource leaks after opendir()/fdopendir() usage. 2009-05-24 02:53:02 +07:00
Slava Semushin f5300ae56c Part of fix for ticket #284 (style check: redundant condition improvement)
Fixed case "if (p) delete [] p;" and also added test case for it.

http://apps.sourceforge.net/trac/cppcheck/ticket/284
2009-05-24 00:32:53 +07:00
Slava Semushin bc62472a18 Part of fix for ticket #284 (style check: redundant condition improvement)
Fixed case "if (p != NULL) delete p;" and also added test case for it.

http://apps.sourceforge.net/trac/cppcheck/ticket/284
2009-05-24 00:30:27 +07:00
Slava Semushin 1e2545439e src/checkmemoryleak.cpp(GetDeallocationType): removed brackets.
No functional change.
2009-05-24 00:26:34 +07:00
Slava Semushin bfd49e21e7 Added 17 functions which work with FILE structure to white list.
Inspired by previous commit.
2009-05-23 18:01:18 +07:00
Slava Semushin b5c7316666 Fixed ticket #327 (File descriptor leak not detected when feof() used)
Thanks to aggro80@ for help.

http://apps.sourceforge.net/trac/cppcheck/ticket/327
2009-05-23 17:20:26 +07:00
Reijo Tomperi bbf63b7970 Fix ticket #304 (#include <file.h> should be searched from paths given with -I parameter.)
http://apps.sourceforge.net/trac/cppcheck/ticket/304
Note that the ticket is same as with previous commit, but task description was changed a little.
2009-05-23 00:18:48 +03:00
Reijo Tomperi 93d9400f63 Fix ticket #304 (#include <file.h> should be parsed like #include "file.h" is being parsed)
http://apps.sourceforge.net/trac/cppcheck/ticket/304
2009-05-22 23:59:07 +03:00
Reijo Tomperi 0f9b2efa43 Fix ticket #326 (Reported memory leak when pointer returned by assign to function's parameter)
http://apps.sourceforge.net/trac/cppcheck/ticket/326
2009-05-22 23:36:03 +03:00
Slava Semushin 0f20ce738d Replaced two Token::simpleMatch() calls to one Token::Match().
Suggested by hyd_danmar in ticket
http://apps.sourceforge.net/trac/cppcheck/ticket/323

No functional change.
2009-05-22 22:03:42 +07:00
Slava Semushin a2a6eebb01 Fixed ticket #324 (Teach about fcloseall() function)
http://apps.sourceforge.net/trac/cppcheck/ticket/324
2009-05-22 21:47:40 +07:00
Slava Semushin b2aaf5d4c7 Fixed ticket #300 (wrong level given)
Enable checks of dangerous functions only when --style option used.

http://apps.sourceforge.net/trac/cppcheck/ticket/300
2009-05-22 21:35:00 +07:00
Slava Semushin 4bd1c3fb00 Propagate static and const modifiers.
No functional change.
2009-05-22 21:20:32 +07:00
Slava Semushin e72583b663 Removed unused or superfluous headers.
No functional change.
2009-05-22 21:17:59 +07:00
Slava Semushin 3a40c33d7b Updated wrong comments (looks like after copy&paste).
No code change.
2009-05-22 21:13:01 +07:00
Reijo Tomperi e6017ad54b Fix #299 (Memory leak not detected when parameters contain ::)
http://apps.sourceforge.net/trac/cppcheck/ticket/299
2009-05-21 22:51:19 +03:00
Daniel Marjamäki f182365bd2 Applied patch 0001-Use-Token-simpleMatch-instead-of-Token-Match-w
Author: php-coder

Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/323
2009-05-21 17:55:52 +02:00
Daniel Marjamäki 47e10b75e3 Applied patch 0003-GetAllocationType-mark-some-members-as-static-and-a.patch
Author: php-coder

Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/321
2009-05-21 12:26:44 +02:00
Daniel Marjamäki eafb1f823c Applied patch 0002-CheckMemoryLeak-renamed-enum-members.patch
Author: php-coder
2009-05-21 12:16:42 +02:00
Daniel Marjamäki 167ab7ee15 Applied patch 0001-src-checkmemoryleak.h-replaced-assignment-in-contru.patch
Author: php-coder
2009-05-21 12:11:35 +02:00
Reijo Tomperi bb2b2e000b Fix ticket #316 (\n is tokenized into \\ in a string when macro is used)
http://apps.sourceforge.net/trac/cppcheck/ticket/316
2009-05-20 21:36:59 +03:00
Reijo Tomperi 9c60391375 Apply patch #320 from php-coderrr ([PATCH] Determine memory leaks after strndup() usage)
http://apps.sourceforge.net/trac/cppcheck/ticket/320
2009-05-19 23:29:10 +03:00
Reijo Tomperi a3f469d339 Fix ticket #315 (Segmentation fault when checking Linux kernel) (previous fix was only partial fix)
http://apps.sourceforge.net/trac/cppcheck/ticket/315
2009-05-19 22:19:15 +03:00
Reijo Tomperi d6d55c2db4 Fix ticket #315 (Segmentation fault when checking Linux kernel)
http://apps.sourceforge.net/trac/cppcheck/ticket/315
2009-05-18 23:32:04 +03:00
Reijo Tomperi 927918f9b0 astyle fix 2009-05-18 23:30:43 +03:00
Daniel Marjamäki bad464ae9b Classes: Static variables don't need to be initialized or assigned in constructors etc
http://apps.sourceforge.net/trac/cppcheck/ticket/307
2009-05-17 19:27:16 +02:00
Daniel Marjamäki 2e61201c18 STL: It is ok to compare vector iterators with <
https://apps.sourceforge.net/trac/cppcheck/ticket/313
2009-05-17 18:58:32 +02:00
Daniel Marjamäki 2bd80a7335 Fix for ticket 291 - preprocessor: better handling of defines
http://apps.sourceforge.net/trac/cppcheck/ticket/291
2009-05-17 18:51:29 +02:00
Reijo Tomperi 36cdac1b96 Fix ticket #312 (division by pointer value causes wrong tokenizing)
http://apps.sourceforge.net/trac/cppcheck/ticket/312
2009-05-14 22:53:49 +03:00
Reijo Tomperi e5e82274dc Fix ticket #306 (Invalid multi-line comment produces cryptic internal error)
http://apps.sourceforge.net/trac/cppcheck/ticket/306
2009-05-13 22:18:02 +03:00
Reijo Tomperi 997a784bb6 Added TODO test case TestPreprocessor::multiline_comment
Made tokenizer to printout token list in case of syntax error, if debug is used
2009-05-13 00:01:53 +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 fede702bf5 Fix ticket #302 (White space between "\" and newline not handled correctly)
http://apps.sourceforge.net/trac/cppcheck/ticket/302
2009-05-11 21:12:29 +03:00
Daniel Marjamäki 15bbd4613e Updated version to 1.32 2009-05-10 12:31:47 +02:00
Daniel Marjamäki 1ae24066fe null pointer dereferencing: check that its a pointer that is dereferenced to avoid false positives when using classes that behave almost like pointers (#295) 2009-05-10 08:43:16 +02:00
Daniel Marjamäki daea0547fa memory leaks: Handling exit (#297) 2009-05-10 08:01:38 +02: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 e7cff4bc43 Apply #296 ([PATCH] cppcheck leak memory when -j option uses)
http://apps.sourceforge.net/trac/cppcheck/ticket/296
2009-05-09 22:40:22 +03:00
Reijo Tomperi 63da926ed2 Fix ticket #294 (### Error: Invalid number of character ()
http://apps.sourceforge.net/trac/cppcheck/ticket/294
2009-05-09 22:32:29 +03:00
Daniel Marjamäki e9eba16053 templates: fixed problem when for example calling static member function in a template class (#293) 2009-05-09 08:02:59 +02:00
Daniel Marjamäki dae530d8de template: no usage -> no expansion (#292) 2009-05-08 16:19:22 +02: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
Daniel Marjamäki 917a48cd65 templates: don't expand forward declarations for templates 2009-05-07 16:05:07 +02:00
Reijo Tomperi a12fd4ff5e Fix ticket #282 (protected destructor - false positive)
http://apps.sourceforge.net/trac/cppcheck/ticket/282
2009-05-06 23:22:26 +03:00
Daniel Marjamäki 80fe293c19 stl: removed false positives for STL buffer overruns. Bailing out when it can't be checked if the index is ok or not. (#285) 2009-05-06 21:55:04 +02:00
Daniel Marjamäki a32114b15c memleak: removed false positives for pclose (#286) 2009-05-06 21:31:31 +02:00
Daniel Marjamäki 51beadd81c templates: instantiations in a template class (#280) 2009-05-06 21:03:11 +02:00
Daniel Marjamäki feba87187a templates: speedup by breaking out inner loops (#257) 2009-05-05 20:16:57 +02:00
Daniel Marjamäki fd0e592767 Preprocessor: Handling newlines when using # to stringify parameters (#281) 2009-05-05 17:19:06 +02:00
Daniel Marjamäki 96ebf343f1 speedup: made the token simplifications a little faster 2009-05-03 21:32:22 +02:00
Daniel Marjamäki 7a8b980627 templates: extracted the template simplification into a separate function 2009-05-03 21:23:47 +02: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 c9eab77683 varid: speedup of the algorithm for setting variable ids 2009-05-03 14:31:54 +02:00
Daniel Marjamäki f6d6a3855e varid: updated handling of variable id for class variables (#26) 2009-05-03 13:50:26 +02:00
Reijo Tomperi e825de1450 Fix possible bug caused by previous commit. 2009-05-03 14:17:31 +03:00
Reijo Tomperi b29673f4a2 Fix slowlyness, caused by one of the previous commits. 2009-05-03 14:07:32 +03:00
Daniel Marjamäki 3819c66f36 stl: Fixed ticket #277 - dereferencing an iterator that has been erased 2009-05-03 07:37:39 +02:00
Daniel Marjamäki 6a009f7084 tokenizer: give class member variables varId (#26) 2009-05-02 22:57:18 +02:00
Daniel Marjamäki e26c999020 Refactoring: Using MathLib for converting string to number
commit beacd5793f9e9987432a20ac39a76ae6c2c8babd
Author: Daniel Marjamäki <hyd_danmar@users.sourceforge.net>
Date:   Sat May 2 10:44:18 2009 +0200

    memleak: using mathlib

commit 4d28172a5d88cc2cbe5ed94a4e4fdbd0dd4bb5e1
Author: Daniel Marjamäki <hyd_danmar@users.sourceforge.net>
Date:   Sat May 2 10:35:06 2009 +0200

    tokenizer: using the MathLib for converting string to number

commit 4e4b95b3554c9c6d121efeb39741204b1621b1a3
Author: Daniel Marjamäki <hyd_danmar@users.sourceforge.net>
Date:   Sat May 2 10:28:39 2009 +0200

    CheckOther: Using mathlib
2009-05-02 10:45:15 +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
Reijo Tomperi a46de47158 Fix ticket #196 (False positive: Resource leak)
http://apps.sourceforge.net/trac/cppcheck/ticket/196
2009-05-01 14:39:57 +03:00
Daniel Marjamäki e37da13c26 tokenizer: simplify assembler (#270) 2009-05-01 12:39:14 +02:00
Reijo Tomperi 67832d89f7 Astyle fix 2009-05-01 13:08:19 +03:00
Reijo Tomperi 241ad528a9 Fix ticket #275 Simplify if( a == 0 ), if( 0 == a ) into if( !a )
http://apps.sourceforge.net/trac/cppcheck/ticket/275
2009-05-01 13:07:10 +03:00
Reijo Tomperi 34540fee04 Fix partially ticket #196 False positive: Resource leak
And add few test cases related to it. Move one failing test behind TODO
http://apps.sourceforge.net/trac/cppcheck/ticket/196
2009-05-01 12:28:33 +03:00
Daniel Marjamäki 6d53343d32 class checking: only check class assignments if the --all has been given 2009-05-01 07:36:35 +02:00
Daniel Marjamäki 534d0e9939 class checking: Checking that vectors/lists/strings etc are modified in the assignment function 2009-05-01 07:28:58 +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
Daniel Marjamäki ad4c7993d1 stl: checking that iterator is used against a single container 2009-04-29 20:16:04 +02:00
Daniel Marjamäki f9795988eb checkstl: Check for invalid pointer to vector element 2009-04-28 21:18:02 +02:00
Daniel Marjamäki bb154da394 memory leaks: handling std::auto_ptr (#266) 2009-04-28 20:01:35 +02:00
Daniel Marjamäki 67eb54c4c0 Merge branch 'abc' 2009-04-27 21:29:29 +02:00
Daniel Marjamäki b49997e69d bail out instead of crash when parsing unicode code (#207) 2009-04-27 21:29:03 +02:00
Reijo Tomperi d8f6636673 Improve fix to ticket #261: Allow macro definition to have uncoupled double quote.
http://apps.sourceforge.net/trac/cppcheck/ticket/261
2009-04-26 22:19:08 +03:00
Daniel Marjamäki 7b58e09a07 Preprocessor: Report correct file and line in message 'No pair for character..' (#261) 2009-04-26 11:05:32 +02:00
Daniel Marjamäki ebd15cec0f push_back: updated the checking of push_back (#263) 2009-04-25 17:14:02 +02:00
Daniel Marjamäki 49430afabe varid: Set variable id for stl containers and iterators 2009-04-25 16:55:00 +02:00
Reijo Tomperi 347b8a2de8 astyle fix 2009-04-23 23:53:01 +03:00
Daniel Marjamäki 8e15a9e79d xml generator: handle '<' and '>' (#263) 2009-04-23 21:59:26 +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 ca8f25fced return pointer to local array: fixed false positive when return value is converted to for instance a std::string (#255) 2009-04-19 16:47:54 +02:00
Daniel Marjamäki 7cddc52d8f mathlib: Fixed todo 3/2=1 2009-04-16 22:06:17 +02:00
Reijo Tomperi 23f00e64cb Fix ticket #257 (Improve speed of template tokenizing)
http://apps.sourceforge.net/trac/cppcheck/ticket/257
2009-04-14 23:21:52 +03:00
Daniel Marjamäki 3c3a56bfca private functions: don't report false positives when using initialization lists (#254) 2009-04-14 21:46:13 +02:00
Daniel Marjamäki 7750f327ff STL boundries: added new check written by Bill Eggert (#247) 2009-04-13 17:48:13 +02:00
Reijo Tomperi 9c9e920829 Fix ticket #252 (Fix --style warnings in cppcheck)
http://apps.sourceforge.net/trac/cppcheck/ticket/252
2009-04-13 12:02:21 +03:00
Daniel Marjamäki 8533e112fe updated version to 1.31 2009-04-12 19:54:15 +02:00
Reijo Tomperi 1f53fb7149 Fix ticket #248 (STL erase check broken?)
http://apps.sourceforge.net/trac/cppcheck/ticket/248
2009-04-10 14:27:36 +03:00
Daniel Marjamäki e72a38aaa8 mathlib: Added licence text 2009-04-09 16:17:59 +02:00
Daniel Marjamäki 6fb18b3ddc simplify calculations: Don't simplify division with 0 2009-04-06 19:43:54 +02:00
Daniel Marjamäki 638d18cfc8 tokenize: use mathlib when simplifying calculations (ticket: 236) 2009-04-06 19:23:30 +02:00
Daniel Marjamäki 97f5380a2c added testing for mathlib 2009-04-06 19:08:13 +02:00
Daniel Marjamäki f0d870c52d Added math library that was created by hoangtuansu 2009-04-06 18:27:14 +02:00
Reijo Tomperi 51d97fa831 Fix ticket #212 (Tokenizer: Handle L "text")
http://apps.sourceforge.net/trac/cppcheck/ticket/212
2009-04-05 22:21:38 +03:00
Reijo Tomperi 051f2929b5 Fix ticket #244 (Headers from included file are searched from wrong path)
http://apps.sourceforge.net/trac/cppcheck/ticket/244
2009-04-05 21:14:02 +03:00
Reijo Tomperi 11858129d0 Fix ticket #243 (boundary checking)
http://apps.sourceforge.net/trac/cppcheck/ticket/243
2009-04-04 21:05:48 +03:00
Reijo Tomperi 7a11f0e61f Fix ticket #242 (Preprocessor: Bail out on failure instead of terminating the program)
http://apps.sourceforge.net/trac/cppcheck/ticket/242
2009-04-03 22:09:12 +03:00
Reijo Tomperi 3b0643a000 Fix some potential null pointer crashes 2009-04-03 14:55:36 +03:00
Daniel Marjamäki ebee7928e2 operator=: changed error message when variable is not assigned 2009-03-31 19:00:56 +02:00
Reijo Tomperi 14bdf1ee62 Fix ticket #239 (missing function implementation in namespace causes crash)
http://apps.sourceforge.net/trac/cppcheck/ticket/239
2009-03-31 00:59:33 +03:00
Daniel Marjamäki 263c5b9e5a division with zero => division by zero 2009-03-29 20:27:10 +02:00
Daniel Marjamäki d7aee72fcd zero division: it's an error 2009-03-29 18:47:05 +02:00
Daniel Marjamäki e45bb20f92 tokenizer: don't replace sizeof when size can't be determined (#233) 2009-03-29 16:36:34 +02:00
Reijo Tomperi bd66f12e60 astyle fix 2009-03-28 23:11:03 +02:00
Gianluca Scacco c88a362893 Fixed ticket #228: false positive with usage of an auto-variable 2009-03-28 21:47:38 +01: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 447c830e8f performance enhancement (patch submitted by davidmiller in ticket 231) 2009-03-28 20:33:55 +01:00
Daniel Marjamäki 4059a2ad05 added check for zero division. The code was written by Nguyen Duong Tuan 2009-03-28 07:49:47 +01:00
Daniel Marjamäki c0b608059a possible null pointer dereference after a while-loop 2009-03-27 17:19:34 +01:00
Daniel Marjamäki 063f59c86c moved checks back to style (where they used to be) 2009-03-27 15:55:14 +01:00
Daniel Marjamäki 4eeac1f364 tokenizer: fix segmentation fault if end of token list is reached 2009-03-27 15:12: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 8db1ac8c5d astyle formatting 2009-03-25 07:25:33 +01:00
Daniel Marjamäki b9f4a773b8 Buffer overrun: Added check to detect when size argument to memset is a char constant (#213) 2009-03-25 07:25:10 +01:00
Daniel Marjamäki 9f3634412e simplify tokens (known variable values in conditions) 2009-03-25 07:10:17 +01:00
Gianluca Scacco a66cf8b20f Fixed Ticket #202: Return of the address of an auto-variable 2009-03-24 21:53:46 +01:00
Daniel Marjamäki afcaa30b51 Fixed ticket 216 (False positive: variable scope) 2009-03-24 20:59:56 +01:00
Daniel Marjamäki 6c1af7e5e6 register CheckClass 2009-03-24 20:47:43 +01:00
Daniel Marjamäki 586037ed11 fixed testcase 2009-03-24 20:28:44 +01:00
Daniel Marjamäki da0b571aee Fixed ticket 197 (false positive: condition is always true/false) 2009-03-24 19:49:01 +01:00
Daniel Marjamäki 6580e0eb21 fixed snprintf false positive (#210) 2009-03-24 18:43:39 +01:00
Daniel Marjamäki 65070cc067 Simplify if conditions more.. simplifyIfAssign + simplifyIfNot 2009-03-24 18:23:21 +01:00
Daniel Marjamäki 44c952873e Fixed ticket 205 (False positive: char variable used in bit operation) 2009-03-23 19:04:51 +01:00
Daniel Marjamäki 06776c6ac7 Fixed the testcase TestMemleak::realloc3 2009-03-23 18:34:59 +01:00
Daniel Marjamäki 7905cbc5e7 simplify tokens: move assignment out from condition (Ticket #201) 2009-03-23 18:20:56 +01:00
Daniel Marjamäki a87419f59b Fixed Ticket 199 (The error messages generated by 'unused functions' are wrong) 2009-03-22 18:57:53 +01:00
Daniel Marjamäki 09457194d9 astyle code formatting 2009-03-22 08:23:20 +01:00
Daniel Marjamäki 276c0a7b2f Merge branch 'master' of git@github.com:danmar/cppcheck 2009-03-22 08:20:41 +01:00
Daniel Marjamäki e017d5a079 refactoring - added 'getErrorMessages' to all check classes 2009-03-22 08:20:15 +01:00
Gianluca Scacco abda874944 Refactoring of CheckAutoVariables 2009-03-22 08:01:48 +01:00
Daniel Marjamäki 0a71771c6a improved the Tokenizer::setVarId to handle function parameters better 2009-03-21 21:58:39 +01:00
Daniel Marjamäki 6fc66d3e2c refactoring error messages 2009-03-21 21:33:27 +01:00
Daniel Marjamäki 729b2c1706 Fixed 188 (Return of auto variable address), applied patched submitted by gscacco 2009-03-21 18:36:41 +01:00
Daniel Marjamäki da06c12925 refactoring error messages 2009-03-21 18:31:28 +01:00
Daniel Marjamäki 468ed653e2 refactoring error messages 2009-03-21 17:58:13 +01:00
Daniel Marjamäki aee39ae929 refactoring - handling the stlOutOfBounds error message the new way 2009-03-21 14:20:10 +01:00
Daniel Marjamäki 001cb0a7ec refactoring - added a function getErrorMessages that will be used to get a list of error messages 2009-03-21 14:07:51 +01:00
Daniel Marjamäki bcad5afb26 refactoring - fixed the unit tests 2009-03-21 14:02:58 +01:00
Daniel Marjamäki 170f817a19 refactoring: there are now 2 functions for running checks. 'runChecks' and 'runSimplifiedChecks' 2009-03-21 07:53:23 +01:00
Daniel Marjamäki 0ed425d105 refactoring 2009-03-20 20:21:54 +01:00
Daniel Marjamäki 272d455e2d refactoring: generate error message in the class 2009-03-20 20:09:44 +01:00
Daniel Marjamäki 8e4af409e7 refactoring: Added a function to the Check base class that allows easier error reporting 2009-03-20 19:52:18 +01:00
Daniel Marjamäki ccfdbfca58 improved Token::tokAt to handle negative argument too 2009-03-20 18:50:11 +01:00
Daniel Marjamäki 9f1c3cc535 refactoring the rest of the classes 2009-03-20 18:16:21 +01:00
Daniel Marjamäki 21dff96e7b refactoring checkbufferoverrun 2009-03-20 17:35:53 +01:00
Daniel Marjamäki 5914af4481 refactoring CheckClass 2009-03-20 17:30:24 +01:00
Daniel Marjamäki e6e778e45f refactoring 2009-03-20 17:15:51 +01:00
Daniel Marjamäki 5565be0c74 refactoring: minor cleanup 2009-03-19 21:20:08 +01:00
Daniel Marjamäki d4fdfc0f5a astyle formatting 2009-03-19 20:53:23 +01:00
Daniel Marjamäki dfe867fded added checkautovariables and integrated it into cppcheck 2009-03-19 20:52:18 +01:00
Daniel Marjamäki 16b6a7a605 refactoring: loop through all Check instances and execute the runChecks function 2009-03-19 19:24:13 +01:00
Daniel Marjamäki 47d7ff983f refactoring: removed the changes to the error handling 2009-03-19 18:39:20 +01:00
Daniel Marjamäki a573c62cd5 refactoring: first step - started with checkstl 2009-03-18 22:40:38 +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
Reijo Tomperi ca055dc830 Fix ticket #191 (semicolon after #endif stop tokenizing of function)
http://apps.sourceforge.net/trac/cppcheck/ticket/191
2009-03-18 01:10:26 +02:00
Reijo Tomperi 819953006c Astyle fix 2009-03-17 22:00:27 +02:00
Daniel Marjamäki 9c057c707b tokenize negative numbers into a single token 2009-03-17 20:50:06 +01:00
Reijo Tomperi 2a3535c04f Fix ticket #186 (runtime error when checking code that has a namespace)
http://apps.sourceforge.net/trac/cppcheck/ticket/186
2009-03-17 20:16:15 +02:00
Daniel Marjamäki 9fe8ae452a Refactoring the code for the templates handling 2009-03-17 18:55:28 +01:00
Reijo Tomperi b3dd9e699b --debug flag can be used to printout token list (for development purposes) 2009-03-16 23:31:52 +02:00
Reijo Tomperi c413c8d4b3 Fix ticket #179 (preprocessor issues)
http://apps.sourceforge.net/trac/cppcheck/ticket/179
2009-03-16 23:20:55 +02:00
Daniel Marjamäki 0cc7672673 Fixed Ticket #82 (detect buffer overrun; dynamic memory) 2009-03-16 18:11:09 +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
Daniel Marjamäki a6ad972aad Fix Ticket 180 (Templates: Expanding member functions that are not implemented inline) 2009-03-15 20:03:29 +01:00
Daniel Marjamäki 9b06b22053 templates: replace constructor/destructor names when expanding template classes 2009-03-15 17:07:05 +01: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
Reijo Tomperi bb3316a45b Fix ticket #181 (#pragma causes wrong line numbers)
http://apps.sourceforge.net/trac/cppcheck/ticket/181
2009-03-15 14:23:12 +02:00
Reijo Tomperi c385b3e045 Improve creation of link() for Token class. Tokenizer::simplifyTokenList() should now return
code where Token::link() actually works.
2009-03-15 01:39:45 +02:00
Daniel Marjamäki 6eadbaae04 templates: better handling of templates with multiple type arguments 2009-03-14 21:26:32 +01:00
Daniel Marjamäki 75d0e8687b Memory leak: handle allocation in deallocation list 2009-03-14 20:19:36 +01:00
Daniel Marjamäki 02df14ec37 Memory leaks: Refactoring to use Tokenizer::FindClassFunction. Enabled test case, the memory leak is now detected 2009-03-14 18:21:37 +01:00
Daniel Marjamäki 01c39daa13 Merge branch 'ref' 2009-03-13 22:39:47 +01:00
Daniel Marjamäki daa911daeb refactoring: moved 'FindClassFunction' from CheckClass to Tokenizer 2009-03-13 22:28:44 +01:00
Reijo Tomperi 116e940214 Fixed ticket #169 (Add Token::link())
http://apps.sourceforge.net/trac/cppcheck/ticket/169
2009-03-13 23:25:56 +02:00
Reijo Tomperi 3c4704a00c Fix ticket #151 (Handling of namespaces)
http://apps.sourceforge.net/trac/cppcheck/ticket/151
2009-03-13 01:07:05 +02:00
Daniel Marjamäki 4c28882a12 expanding template classes 2009-03-12 22:17:42 +01:00
Daniel Marjamäki f96e2deb1a uninitialized const pointer member variables 2009-03-12 21:33:10 +01:00
Daniel Marjamäki 1514e65464 astyle style fixes 2009-03-11 19:14:45 +01:00
Daniel Marjamäki 77cf2213fe templates: simplify template functions with 1 type argument 2009-03-11 18:50:24 +01:00
Daniel Marjamäki eac29d151c made the Tokenizer::simplifyCasts more generic 2009-03-10 21:26:08 +01:00
Daniel Marjamäki c7c13ce3c1 Fixed ticket 134 (memory leak not detected) caused by wrong checking if code is inside class function or not 2009-03-10 20:44:24 +01:00
Daniel Marjamäki cd54a0ed3b Fixed ticket 147 (Invalid line number for error message) 2009-03-09 20:29:25 +01:00
Daniel Marjamäki f39e117921 removed unused private function CheckSecurity::eraseCheckLoop 2009-03-09 20:09:06 +01:00
Daniel Marjamäki f8cd34198b simplify casts 2009-03-09 19:47:21 +01:00
Vesa Pikki ccfa7ce6ee Merge branch 'WinQt' of git@github.com:danmar/cppcheck into WinQt 2009-03-09 20:00:06 +02:00
Reijo Tomperi de1a786a07 Fix ticket #148 (unable to compile with g++-3.3)
http://apps.sourceforge.net/trac/cppcheck/ticket/148
2009-03-08 20:50:19 +02:00
Daniel Marjamäki ed0c971b1f updated version to 1.30 2009-03-08 16:15:25 +01:00
Reijo Tomperi 765da17132 Astyle fix 2009-03-08 09:49:04 +02:00
Reijo Tomperi 5be85d71a0 Fix ticket #145 (Line numbers are invalid if file is included inside #ifdef)
http://apps.sourceforge.net/trac/cppcheck/ticket/145
2009-03-08 09:45:53 +02:00
unknown bc6e1a74d0 Windows Qt compilation fixes.
FileLister::RecursiveAddFiles failed to compile in Windows when GUI was compiled. Since that method wasn't used in Qt build I ifdeffed it out.

Also removed vcl related code from checkdialog since that was removed from release.
2009-03-07 18:53:50 +02:00
Daniel Marjamäki fe2aee131d Fix ticket #140 (New command line option --auto-dealloc), added documentation 2009-03-07 08:56:12 +01:00
Reijo Tomperi 1ab57390cf Fix ticket #137 (--version would be nice) and also do some cleanup for help texts
http://apps.sourceforge.net/trac/cppcheck/ticket/137
2009-03-06 23:17:42 +02:00
Reijo Tomperi d725f0df58 Fix ticket #139 (Compilation error on building cppcheck version 1.29 with gcc-4.3.2 on Ubuntu 8.10)
http://apps.sourceforge.net/trac/cppcheck/ticket/139
2009-03-06 22:46:32 +02:00
Daniel Marjamäki cc8a6168e7 astyle formatting 2009-03-06 18:13:41 +01:00
Daniel Marjamäki 113b3c1d21 auto-deallocated classes: added command line option for specifying .lst file (http://apps.sourceforge.net/trac/cppcheck/ticket/120) 2009-03-06 17:43:33 +01:00
Daniel Marjamäki d7cd09cb6e added internal support for handling list of classes that are automaticly deallocated 2009-03-06 07:22:07 +01:00
Reijo Tomperi 28475b2986 Fix ticket #135 (Add option to control main() exit value) 2009-03-06 02:03:31 +02:00
Reijo Tomperi 6fcb89f136 Fix segmentation fault that happens with invalid code. 2009-03-05 23:22:00 +02:00
Reijo Tomperi 42a9eb9e53 Fix ticket #133 (Segmentation fault when static_cast is in for loop) 2009-03-05 21:32:02 +02:00
Daniel Marjamäki 0011d059e6 checkbufferoverrun: fixed bug - skip some checks when variable id is unknown (Ticket: 138) 2009-03-05 18:28:59 +01:00
Daniel Marjamäki 4522bcd680 reverted accidental changes committed in [1330] 2009-03-04 17:10:28 +00:00
Daniel Marjamäki 8b7a5dd494 fixed tokenizer problem when reading char constants 2009-03-04 17:02:45 +00:00
Daniel Marjamäki 5c1d4f2703 simplify calculations better 2009-03-04 06:24:03 +00:00
Daniel Marjamäki 547f120ee9 known variables: better handling of ++ and -- 2009-03-04 06:03:51 +00:00
Reijo Tomperi 832275bc37 Fix #132 (False positive returning memcpy()) 2009-03-03 20:39:17 +00:00
Reijo Tomperi 69c23301db Fix ticket Add/Change #125 (the printout of the token list is wrong) 2009-03-03 20:17:23 +00:00
Reijo Tomperi 054518f002 Refactoring: Combined printOut() and stringifyList() in Token class 2009-03-03 19:45:58 +00:00
Daniel Marjamäki 37c889ab30 unused private function: better handling of initialization lists in constructors 2009-03-02 20:40:24 +00:00
Vesa Pikki e629db6818 Now adds directory contents to list of files to check.
Only adds proper (.cpp,.c,.cpp,...) files to the list of files to check.
Modified checkthread to clear results after each file.
2009-03-02 19:56:51 +00:00
Daniel Marjamäki 86050cccdb unused private function: fixed false positive (ticket: 129) 2009-03-02 17:16:02 +00:00
Daniel Marjamäki 87b0314e72 memory leak: fixed issue with reporting wrong location 2009-03-01 20:34:04 +00:00
Reijo Tomperi d4ecddd53c Fixed some compiling warnings by adding more error checking. 2009-03-01 20:08:47 +00:00
Daniel Marjamäki fdaa1af694 removed deprecated flag 'firstMatch' 2009-03-01 20:02:24 +00:00
Reijo Tomperi 015143b56c Copyright fixes 2009-03-01 19:59:13 +00:00
Reijo Tomperi ea30d78405 Fixing compile problem with new gcc 2009-03-01 19:56:27 +00:00
Reijo Tomperi fc8f47145a Copyrights updated 2009-03-01 19:52:33 +00:00
Reijo Tomperi f6848f14ad Fixed another --style problem with our code 2009-03-01 19:38:17 +00:00
Reijo Tomperi 6495912d9a Fixed bug, -j option produced duplicate error messages. 2009-03-01 19:34:32 +00:00
Reijo Tomperi d098b62975 Use reference instead of string copy (fixes some --style warnings from our code) 2009-03-01 19:30:51 +00:00
Daniel Marjamäki 60b3bbdea4 removed the '--vcl' flag from the console app 2009-03-01 19:10:48 +00:00
Daniel Marjamäki c7b068c174 variable id: fixed so that the variable ids are assigned correctly (ticket:126) 2009-03-01 16:37:02 +00:00
Daniel Marjamäki 4e465f7073 variable declarations: don't simplify when declaring and assigning array in the same statement 2009-02-28 20:40:37 +00:00
Daniel Marjamäki c3bbd603c0 variable id: handling 'return' and 'else' better 2009-02-28 20:21:48 +00:00
Daniel Marjamäki 7d9bf491ec sizeof: fixed a problem with 'sizeof(varname)' but there are more to fix with it 2009-02-28 08:34:02 +00:00
Reijo Tomperi 42176f52ca Added Cppcheck::clearFiles() function. 2009-02-27 19:39:50 +00:00
Daniel Marjamäki 6b7b27a2e8 simplify known variable: don't simplify this ';i++;' 2009-02-27 18:25:47 +00:00
Daniel Marjamäki c991aded12 unused functions: fixed false positives 2009-02-27 16:36:37 +00:00
Daniel Marjamäki f4a8bc85f2 simplify tokens: fixed bug when removing redundant parantheses around variable 2009-02-27 06:07:38 +00:00
Daniel Marjamäki c1da4ae57d simplify tokens: remove redundant parantheses around variable.. 'p = (q);' 2009-02-25 19:55:24 +00:00
Daniel Marjamäki 35583293ec memory leak: Fixed a false positive when all is given 2009-02-25 19:20:23 +00:00
Daniel Marjamäki dac1e91013 unused private function: Handle 'embedded' function implementations better 2009-02-25 18:03:17 +00:00
Daniel Marjamäki 4849aaa7ee checkclass: refactoring 2009-02-24 17:50:51 +00:00
Daniel Marjamäki 66c13c7173 reverted [1282] because some changes were committed by mistake 2009-02-24 17:49:43 +00:00
Daniel Marjamäki 8c3e3faa07 checkclass: refactoring 2009-02-24 17:48:11 +00:00
Daniel Marjamäki 159332fde4 sizeof fix. classes and structs are always given the size 100. This removes false positives about mismatching size 2009-02-24 16:30:57 +00:00
Daniel Marjamäki 1e3047b9c2 simplify tokens: simplify known variable value handles ++ and -- better 2009-02-24 16:11:37 +00:00
Daniel Marjamäki d15aea1b0c memory leak: fixed false positive when using 'return strcpy' 2009-02-24 06:23:21 +00:00