Commit Graph

737 Commits

Author SHA1 Message Date
Nicolas Le Cam b7e4f1319c Fix Preprocessor::read to handle char constant of more than one char, fixing issue #45; Fix the test that handle the case. 2009-01-21 21:45:17 +00:00
Nicolas Le Cam 42c608b6f0 Remove checks that are already covered well by most compilers (Unreachable Code; Assignment in Condition; Unused Variable). 2009-01-21 21:31:47 +00:00
Reijo Tomperi 53d02c0804 Fix Ticket #43, preprocessor: include file doesn't work so good in subfolders (note, because of other issues, checking will be very slow now
that this is fixed)
2009-01-21 21:03:46 +00:00
Reijo Tomperi 176dd41306 Fixed Ticket #40, Check copyright texts in files, now that we have new developers. 2009-01-21 20:04:20 +00:00
Daniel Marjamäki 5fa9fce8d4 uninitialized variables: run always 2009-01-21 19:11:27 +00:00
Nicolas Le Cam afb3bf1011 Fix CheckOther::functionVariableUsage, passing a variable to a function also means reading it. 2009-01-21 19:05:57 +00:00
Daniel Marjamäki 76cb2310af preprocessor: handled problem with parsing strings when expanding macros 2009-01-21 17:11:24 +00:00
Daniel Marjamäki 820df7fdbd code style 2009-01-21 07:23:15 +00:00
Nicolas Le Cam 001a4b588e Fix Tokenizer::setVarId for pointers and two types variable declaration 2009-01-20 23:31:54 +00:00
Nicolas Le Cam acdc381ff3 CheckOther::functionVariableUsage: minor optimization. 2009-01-20 22:40:10 +00:00
Nicolas Le Cam 5eb89414c8 Token::Match: Allow pattern like '*|' 2009-01-20 22:39:03 +00:00
Reijo Tomperi 6d8387914b Fixes test case "file2", fixes bug with include file handling 2009-01-20 22:25:49 +00:00
Nicolas Le Cam 5d8f506d6b Tokenizer: Remove 'unlikely' keyword in simplifyTokenList;
Don't check for it in CheckMemoryLeak.
2009-01-20 21:21:12 +00:00
Daniel Marjamäki d82314b365 preprocessor: Handle ## 2009-01-20 18:28:24 +00:00
Daniel Marjamäki fad65663e5 tokenizer: tokenize ## better 2009-01-20 17:26:16 +00:00
Daniel Marjamäki ea3094166c code cleanup 2009-01-20 06:20:55 +00:00
Reijo Tomperi df5adc5f4f Added test case preprocessor_doublesharp, executed ./runastyle for errormessage.h 2009-01-19 21:45:59 +00:00
Nicolas Le Cam 2b2152919f Update errormessage.h and code using it. 2009-01-19 19:50:59 +00:00
Reijo Tomperi 4d0e3dac45 Added a test case and fixed bug. If #include was inside a string, cppcheck hanged in preprocessor. 2009-01-19 19:24:41 +00:00
Reijo Tomperi adc116d0ef Changed output of the program to print out the file name before
preprocessor.
2009-01-19 19:00:36 +00:00
Reijo Tomperi de28502bb1 Fixed bug in line numbers and enabled test case that spots it. 2009-01-19 18:51:27 +00:00
Daniel Marjamäki e90857ce0d tokenizer: activated the handling of #file and #endfile 2009-01-19 17:49:44 +00:00
Daniel Marjamäki af87fececa preprocessor: Activated the include handling 2009-01-19 17:47:43 +00:00
Kimmo Varis 0b2bd09b24 Visual Studio: Fix building resource file with Visual Studio Express. 2009-01-19 06:40:59 +00:00
Nicolas Le Cam 45478a7178 FileLister: Fix bug that prevent a file passed by with paths to be checked; Add the possibility to use \ as a directory separator on Windows closing issue #22 2009-01-18 23:51:31 +00:00
Reijo Tomperi 3cb51d6946 Fixing crash, not sure about side effects. Ticket #37 2009-01-18 23:03:28 +00:00
Reijo Tomperi 50d9a085da Added temporary bailout code, cppcheck crashes when string checking leaks out. This needs a better fix, this is just to
see the problem more easily.
2009-01-18 22:46:48 +00:00
Nicolas Le Cam f6d121443e unreachableCode: Moved warning of a break statement following a return in --style; Added a test case; Minor optimization. 2009-01-18 21:19:02 +00:00
Leandro Penz e930525aa4 functionVariableUsage: no longer SIGSEGVs on unfinished struct. Fixes Ticket #31. 2009-01-18 19:45:43 +00:00
Reijo Tomperi 45c1b3c3ca More work for includes, still commented out. Uncomment from tokenize.cpp and
preprocessor.cpp to take into use.
2009-01-18 18:59:58 +00:00
Reijo Tomperi 3f98024215 More work for includes, still commented out. Tokenizer needs #file handling 2009-01-18 18:01:56 +00:00
Daniel Marjamäki 0177f77505 code style fix 2009-01-18 17:47:40 +00:00
Daniel Marjamäki f409861492 strPlusChar: Fixed false positives 2009-01-18 17:42:41 +00:00
Reijo Tomperi b1250e1750 Some work for the include support (commented out for now) 2009-01-18 17:13:05 +00:00
Daniel Marjamäki 965daabe60 preprocessor: Make sure that "#define ABC (a+b+c)" is expanded correctly 2009-01-18 16:56:12 +00:00
Daniel Marjamäki 8785483878 preprocessor: Reactivated the expandMacros. This time it's done after the #if #else #endif has been
processed
2009-01-18 16:42:15 +00:00
Daniel Marjamäki ea686a1da9 preprocessor: fixed so the TestPreprocessor::preprocessor_undef succeeds 2009-01-18 16:37:40 +00:00
Daniel Marjamäki 73630c4640 style updated 2009-01-18 12:19:48 +00:00
Daniel Marjamäki 6cb6e163cd preprocessor: Refactoring. Broke out some functionality of expandMacros into a class Macro 2009-01-18 12:17:26 +00:00
Daniel Marjamäki 4ee4645858 Preprocessor: Reverted [1008] - The old expandMacros was readded 2009-01-18 10:54:07 +00:00
Kimmo Varis 9bf6383c4e Fix VS build broken due to tripled version resource info. 2009-01-18 09:38:42 +00:00
Daniel Marjamäki a269cfc8d9 tokenizer: The tokenizer shouldn't handle comments nor preprocessor directives. The preprocessor will take care of
that
2009-01-18 08:38:25 +00:00
Daniel Marjamäki 86c95c27d2 Preprocessor: Removed "Preprocessor::expandMacros" and commented all its tests 2009-01-18 07:32:06 +00:00
Daniel Marjamäki 0a027a55ef preprocessor: Don't use the "expandMacros" from cppcheck 2009-01-18 07:22:17 +00:00
Reijo Tomperi 58b398a4a8 Fix Ticket #32 False positive with --style: Uninitialized member variable (when stream is used) 2009-01-17 20:17:57 +00:00
Kimmo Varis bfc82f29eb Does not understand . as current folder (Trac #4) 2009-01-17 19:34:11 +00:00
Daniel Marjamäki b9b250f4cc unused var: fixed false positives when using shift operator 2009-01-17 14:32:02 +00:00
Daniel Marjamäki 8780fbf8bb bounds checking: Added error message "snprintf size is out of bounds" 2009-01-17 13:09:02 +00:00
Reijo Tomperi 9298caa809 Patch [ 2508549 ] Add Windows version resource 2009-01-17 12:08:20 +00:00
Daniel Marjamäki a5e2787f72 errmsg: added varname to the message "deallocating a deallocated pointer" 2009-01-17 11:15:46 +00:00
Daniel Marjamäki 121c0ee58f unused variable: reading the value of variable in a for loop.. "for(;a;)" see ticket #18 2009-01-17 11:12:15 +00:00
Daniel Marjamäki f562f588fb memory leak: detect memory leak (#6) 2009-01-17 07:55:40 +00:00
Reijo Tomperi afe19dd0a2 Added .c++ to help texts also. 2009-01-16 22:42:08 +00:00
Daniel Marjamäki c279f83664 preprocessor: bail out code in expandMacros 2009-01-16 21:30:06 +00:00
Reijo Tomperi 449dcc2a60 Add support for .c++ files ( Debian Bug#512060: cppcheck: refuses to
check .c++ files )
2009-01-16 20:46:41 +00:00
Daniel Marjamäki a39eaec1cc preprocessor: Fixed a null pointer dereference 2009-01-16 19:50:39 +00:00
Daniel Marjamäki 666fc82011 Memory leak: Fixed false positives about deallocating pointer that has already been deallocated 2009-01-16 16:29:41 +00:00
Daniel Marjamäki f663d1da84 function usage: don't report "main" and "if" as unused 2009-01-16 16:20:35 +00:00
Daniel Marjamäki 1db6c010e3 memory leak: don't show debug info 2009-01-16 16:19:50 +00:00
Daniel Marjamäki 4cfb8ad1cb memory leaks: Added checking of deallocate to see that the pointer isn't deallocated already 2009-01-15 20:34:39 +00:00
Daniel Marjamäki 218c107b6f code style 2009-01-15 17:12:55 +00:00
Daniel Marjamäki 66e93b24e2 str plus char: added simple variable handling 2009-01-15 17:12:33 +00:00
Daniel Marjamäki ad9aba6e1b code style fixing 2009-01-15 17:00:15 +00:00
Daniel Marjamäki 8bbd4b9401 str plus char: Added check and error message for str + ch 2009-01-15 16:57:51 +00:00
Daniel Marjamäki a01c5a6099 preprocessor: Bail out the expandMacros if it finds "#undef". The previous handling can cause cppcheck to hang 2009-01-14 19:50:17 +00:00
Daniel Marjamäki 03cfe18c9b errmsg: Added 'condition is always true/false' 2009-01-14 19:43:28 +00:00
Daniel Marjamäki 22583269c1 Uninitialized member variables: Checking enum variables 2009-01-14 19:34:10 +00:00
Daniel Marjamäki b9460ca6f8 preprocessor: a segmentation fault fix. Check if tokens is null. 2009-01-14 17:22:11 +00:00
Daniel Marjamäki a196ea1c2c dos2unix fixing 2009-01-14 17:17:28 +00:00
Daniel Marjamäki 2d58b2b9ee memory leak: fixed false positive about using variable after it is released 2009-01-14 16:21:54 +00:00
Daniel Marjamäki 9e91f75386 cppcheck: added function call to the variable scope check. 2009-01-14 07:43:46 +00:00
Daniel Marjamäki a604f56f19 buffer overruns: added sprintf checking 2009-01-14 06:29:35 +00:00
Daniel Marjamäki 12b248aa66 doxygen: Added comments in checkbufferoverrun.h 2009-01-14 06:13:54 +00:00
Daniel Marjamäki f7e4f13ecd Memory leak: Readded some checking to classes 2009-01-14 05:58:20 +00:00
Leandro Penz f33153e086 unreachableCode: avoid SIGSEGV when there is no "}" after return. 2009-01-14 01:29:33 +00:00
Leandro Penz 1a14cd527c functionVariableUsage: support for nested struct/union declaration. 2009-01-14 00:45:44 +00:00
Daniel Marjamäki e664f255a4 Memory leak: Fixed a false positive 2009-01-13 18:30:39 +00:00
Daniel Marjamäki c8a5bd16a1 errmsg: Added 'assignment in if-condition' 2009-01-13 17:56:45 +00:00
Daniel Marjamäki aa592387e6 errmsg: refactoring 2009-01-13 06:25:36 +00:00
Daniel Marjamäki cc65242626 errmsg: added message about bad usage of char variable 2009-01-12 18:52:43 +00:00
Daniel Marjamäki fdf5b215f9 errmsg: Added message for 'incomplete statement' 2009-01-12 17:46:24 +00:00
Daniel Marjamäki a5eb8894d4 errmsg: Added messages for 'variable is not used / not read / not assigned' 2009-01-12 17:40:20 +00:00
Daniel Marjamäki 13e2396345 errmsg: Added message 'function parameter is passed by value' 2009-01-12 17:32:53 +00:00
Daniel Marjamäki df689b454c errmsg: added message 'unreachable code below return' 2009-01-12 17:28:04 +00:00
Daniel Marjamäki a0ef840138 errmsg: Added 'unused struct member' 2009-01-12 17:21:25 +00:00
Daniel Marjamäki 03888046d8 errmsg: Made the 'unsigned division' a style error 2009-01-12 17:14:03 +00:00
Daniel Marjamäki 980b10bfc9 errmsg: Added 'unsigned division' 2009-01-12 17:12:14 +00:00
Daniel Marjamäki e70f68f266 refactoring: cleanup old code 2009-01-12 16:53:14 +00:00
Daniel Marjamäki 17d4c2b980 errmsg: Added message 'Overlapping data buffer' 2009-01-12 06:52:50 +00:00
Daniel Marjamäki ae861852e2 errmsg: Added "found redundant if - 'if (condition);' 2009-01-12 06:44:47 +00:00
Daniel Marjamäki 153487d504 preprocessor: Style updates 2009-01-12 06:43:56 +00:00
Daniel Marjamäki eb8675ab76 preprocessor: Handle newlines better 2009-01-12 06:33:06 +00:00
Daniel Marjamäki ea6c48b2bd preprocessor: fixed a small bug when expanding macro without parameter 2009-01-11 16:06:37 +00:00
Daniel Marjamäki da881fdd0a preprocessor: Fixed bug when expanding macros without parameters 2009-01-11 15:51:46 +00:00
Daniel Marjamäki ecdfee850d preprocessor: expand macro without parameters 2009-01-11 15:07:13 +00:00
Daniel Marjamäki da46e4bd96 struct member usage: bail out the check if the struct contain any functions 2009-01-11 14:39:52 +00:00
Daniel Marjamäki 2e77f3bf04 setVarId: Fixed bug (variable id for struct member not correctly set) 2009-01-11 10:03:21 +00:00
Daniel Marjamäki 9d8af10583 errmsg: the "unused function" message shall not take any Tokenizer nor Token parameters 2009-01-11 08:10:51 +00:00
Daniel Marjamäki 94667320e8 preprocessor: Handle "<backslash><newline>" better 2009-01-11 07:19:28 +00:00
Daniel Marjamäki 3d8791eebd errmsg: added "unused function" 2009-01-11 06:44:32 +00:00
Leandro Penz 764e44790f match: skip initial !! patterns if on first token. 2009-01-10 21:13:10 +00:00
Leandro Penz 12a7d1df4b match: optimisation 2009-01-10 20:40:05 +00:00
Daniel Marjamäki 1e6b54b2c5 errmsg: added "mismatching allocation and deallocation" 2009-01-10 19:30:41 +00:00
Daniel Marjamäki 327d09502a cppcheck: Minor bug fix 2009-01-10 19:24:23 +00:00
Daniel Marjamäki 47a7c915fa errmsg: Added error messages for "Array index out of bounds" and "Buffer overrun" 2009-01-10 19:23:21 +00:00
Daniel Marjamäki 897c02e3ed errmsg: added error message about virtual destructors 2009-01-10 18:03:56 +00:00
Daniel Marjamäki 6acb123f1d errmsg: Added "operator= should return something 2009-01-10 17:57:31 +00:00
Daniel Marjamäki 1fc5f5485f errmsg: Added "Using 'memset' on class" 2009-01-10 17:51:03 +00:00
Daniel Marjamäki 7b10b0ff4d errmsg: Added "Unused private function ..." 2009-01-10 17:35:41 +00:00
Daniel Marjamäki dc6317878e errmsg: Added "uninitialized member variable" 2009-01-10 17:11:47 +00:00
Leandro Penz 5570f06075 checkmemoryleak: no longer flag "dealloc ; alloc ; if continue ;" as a leak, even with --all 2009-01-10 16:28:04 +00:00
Daniel Marjamäki 1a4cfc6c4f unused struct member: fixed false positive for member "const int a;" 2009-01-10 14:39:20 +00:00
Daniel Marjamäki a2a8378749 astyle: updated the code style 2009-01-10 14:29:59 +00:00
Daniel Marjamäki 8c4260519c sprintf: fixed bug "false positive when variable is used again after snprintf" 2009-01-10 14:27:31 +00:00
Daniel Marjamäki 0c3c00daec errmsg: Added errormessage for 'the class 'classname' doesn't have a constructor' 2009-01-10 13:08:44 +00:00
Daniel Marjamäki 41a73e3b1e errmsg: bug fix 2009-01-10 12:03:18 +00:00
Daniel Marjamäki 985b8fa05f sprintf: fixed false positives with "sprintf(buf, "%i", sizeof(buf)); 2009-01-10 11:19:17 +00:00
Daniel Marjamäki d6d26f4705 match: optimisation 2009-01-10 07:10:18 +00:00
Daniel Marjamäki ae4ab2fcb6 preprocessor: code style fixing 2009-01-10 07:09:47 +00:00
Daniel Marjamäki cd9323ca62 preprocessor: handle the \newline in strings 2009-01-10 07:07:51 +00:00
Leandro Penz febdc3fe6e token: when Token::Match reached the end of input, it returned true if the next pattern was !!. It now returns true only if all remaining patterns are !!. 2009-01-10 00:33:48 +00:00
Daniel Marjamäki 7851b1042f errormessage: added error message ErrorMessage::dangerousUsageStrtol 2009-01-09 19:15:54 +00:00
Daniel Marjamäki 3e5398499f errormessage: added header 2009-01-09 19:01:25 +00:00
Daniel Marjamäki 6bdb14edfd tokenize: avoid "terminate called after throwing an instance of 'std::out_of_range'" 2009-01-09 18:00:11 +00:00
Reijo Tomperi 46f4701c26 Main returns now EXIT_SUCCESS or EXIT_FAILURE instead of 0. Feature request fixed: [ 2489787 ] Return value of cppcheck is always 0 2009-01-08 21:30:25 +00:00
Reijo Tomperi 42b661630b astyle changes, missed from previous commits 2009-01-08 21:08:14 +00:00
Daniel Marjamäki 5d0f8f0cfa errormessage: Added a few more messages for checkother.cpp 2009-01-08 20:56:51 +00:00
Reijo Tomperi 4dfc3a9c3d Added license text to errormessage.h (via code tha generates it) and also mention that it is generated by machine 2009-01-08 20:51:07 +00:00
Daniel Marjamäki 2a2adb037a errormessage: Added the new errormessage handling to cppcheck 2009-01-08 17:32:33 +00:00
Daniel Marjamäki 1bc5740742 errormessage: updated the files. the errormessage.h is automaticly
generated by the tools/errmsg program
2009-01-08 17:31:07 +00:00
Daniel Marjamäki 24530ebd60 sprintf: check for dangerous usage with sprintf|snprintf with
overlapping data
2009-01-08 06:24:08 +00:00
Daniel Marjamäki 8f86a941aa Simplify tokens: add a ";" after case and default 2009-01-07 17:49:21 +00:00
Daniel Marjamäki de7de91091 preprocessor: applied patch submitted by kimmov 2009-01-07 17:47:32 +00:00
Daniel Marjamäki 40637e436f Reverted [890] it cause more problems with Visual C++ 2009-01-07 15:43:20 +00:00
Daniel Marjamäki 8c71c4194f Borland C++: Removed unneeded ifdefs 2009-01-07 15:16:15 +00:00
Reijo Tomperi 3a2fd91783 Optimization: 6,2 s -> 5,6 s 2009-01-06 22:58:33 +00:00
Reijo Tomperi e435a1f1d6 Refactoring: Added src/ and test/ folders. Moved source files to those folders, updated makefile and codeblocks project file. 2009-01-06 14:18:36 +00:00