Thomas Jarosch
3d438003ff
Add internal check that searches Token::Match() patterns for missing % end charaters
...
Example: "%type" or "foo %var bar"
2011-10-29 12:22:26 +02:00
Daniel Marjamäki
b67cb077a3
fix unit test failure
2011-10-29 12:21:22 +02:00
Daniel Marjamäki
8416768e03
Merge pull request #50 from richq/strncmp
...
Improved strncmp checks
* strings are always the same
* inconclusive: using sizeof(char *) as size parameter
2011-10-29 03:13:21 -07:00
Reijo Tomperi
5e0e2c4782
Fix #3256 (Null pointer dereference not detected)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3256
It is now detected if --inconclusive command line argument is given (the argument is unofficial currently)
2011-10-29 11:35:31 +03:00
Marek Zmysłowski
950460c0a7
Fixed #3261 (Function 'find' useless call. The variable 'str' is using function 'find' against itself)
2011-10-29 09:24:05 +02:00
Thomas Jarosch
f6e68914ea
Add check for cppcheck's internal API usage ( #3263 )
...
First checks:
- Simple pattern used inside Token::Match()
- Complex pattern used inside Token::simpleMatch()
The checks get enabled by passing "--enable=internal".
It's not included in "--enable=all".
If you see something that needs further tweaking, just go for it!
2011-10-28 22:46:07 +02:00
Thomas Jarosch
e3c67fed12
Run astyle
2011-10-28 22:43:02 +02:00
Thomas Jarosch
91a5d95bc9
Use Token::simpleMatch() / Token::findsimplematch() where possible
2011-10-28 22:31:05 +02:00
Richard Quirk
665cdfabdc
Warn when sizeof is used in strncmp ticket #2095
...
This checks for the case where the user thought sizeof(buf) gave the
size in bytes of 'buf' in code like the following:
const char *buf = "Hello World";
strncmp(buf, other, sizeof(buf));
2011-10-28 22:14:55 +02:00
Richard Quirk
90c7db15a0
Add check for comparison of identical string variables
2011-10-28 22:12:51 +02:00
Richard Quirk
4ba6ac7332
Add strncmp to the list of static string comparison functions
2011-10-28 22:12:51 +02:00
Ettl Martin
4a14672d0b
added unittest for ticket #1780
2011-10-27 23:54:03 +02:00
PKEuS
d6261debdf
Fixes false positives in test suite, adds unit test for void-simplification
2011-10-27 21:54:42 +03:00
Thomas Jarosch
43e9c1f0bd
STL check: Detect return of implict string conversion + .c_str()
...
Examples are:
std::string msg;
return ("ERROR: " + msg).c_str();
or
return ("ERROR: " + std::string("crash me")).c_str();
2011-10-26 22:14:47 +02:00
Thomas Jarosch
c4dabd61e9
STL check: Check if someone tries to return std::string(crash_me).c_str()
2011-10-26 21:45:27 +02:00
Thomas Jarosch
03fd308dbf
STL check: Look for string.c_str() / stringstream.str().c_str() "return" usage (object is destroyed on return)
2011-10-26 21:12:06 +02:00
seb777
1a6706005f
Test to close Ticket #1879
2011-10-25 22:38:23 +02:00
Daniel Marjamaki
4b57a146fb
Preprocessor: Unit test #error and missing includes. Ticket: #2131
2011-10-25 19:55:47 +02:00
Marek Zmysłowski
190139f441
Fixed #3174 (New check: Useless calls of STL functions)
2011-10-24 23:25:23 +02:00
Daniel Marjamäki
f0d8fd7235
Preprocessor: updated tests
2011-10-24 21:56:43 +02:00
Thomas Jarosch
3413ffef3e
Refactor readlink() buffer check to also handle readlinkat()
2011-10-24 21:23:18 +02:00
Daniel Marjamaki
0eb4e3032a
Preprocessor: handle '#undef' better. Ticket: #2131
2011-10-24 19:51:00 +02:00
Daniel Marjamaki
08ba378730
Preprocessor: Improved 'normal' preprocessing. better handling of multiple #elif and #else blocks
2011-10-24 08:11:44 +02:00
Daniel Marjamaki
3de70a7244
Preprocessor: Better 'normal' preprocessing. Simple handling of '#elif'
2011-10-24 07:37:47 +02:00
Reijo Tomperi
36ef8e771f
Improve null pointer dereference test coverage
2011-10-24 00:36:57 +03:00
Thomas Jarosch
1ccb57e595
Document and test Token::concatStr()
2011-10-23 21:21:42 +02:00
Thomas Jarosch
5b97cc1440
Bugfix: Update token properties on string changes
2011-10-23 21:06:56 +02:00
Daniel Marjamaki
9e50b7cb68
Preprocessor: updates to 'normal' preprocessing
2011-10-23 19:17:29 +02:00
Daniel Marjamäki
1a5aba062c
test/test.pro: indentation update
2011-10-23 15:45:56 +02:00
Daniel Marjamaki
605bd23517
Visual Studio: auto generated new visual studio project files
2011-10-23 15:42:02 +02:00
Thomas Jarosch
db8c7deb30
Fixed #3232 (Check if container is modified inside BOOST_FOREACH)
2011-10-23 13:07:43 +02:00
Thomas Jarosch
9a1b195d79
Fixed #3187 (Remove code duplication in 'other' unit test)
2011-10-23 12:20:43 +02:00
PKEuS
54b3d72ee3
Added Token::nextArgument()
2011-10-23 11:23:48 +02:00
Erik Lax
b7ab1e7d7e
Fixed #3237 (Bug in parser of class operator functions)
2011-10-23 10:25:14 +02:00
Daniel Marjamäki
65380d16d6
Test: Fixed testing
2011-10-23 10:22:10 +02:00
Daniel Marjamäki
8579270582
astyle formatting
2011-10-23 10:11:43 +02:00
Daniel Marjamäki
a381581a8b
Merge pull request #43 from makulik/master
...
#3244 'Get include pathes from file'
2011-10-23 01:04:31 -07:00
Reijo Tomperi
3568b5a841
Improved memset with 0 bytes check. TODO done (unit test).
...
Patch from: PKEuS <philipp.kloke@web.de>
2011-10-22 23:34:10 +03:00
unknown
597a37cc32
#3244 'Get include pathes from file'
...
Signed-off-by: Günther Makulik <g-makulik@t-online.de>
2011-10-22 21:24:23 +02:00
Edoardo Prezioso
91c6608175
Improve fix of #934 (be careful of macros code).
2011-10-22 20:43:42 +02:00
PKEuS
20179673ce
Fixed #934 (new check: missuse of std::cout)
2011-10-22 17:12:52 +02:00
Johan Samuelson
3d8fa2f76e
Fixed #3123 ([False Positive] Shadowed enum)
2011-10-22 13:43:53 +02:00
Erik Lax
2b54f00c87
Fixed #3238 (Crash in obsolete functions check.)
2011-10-22 12:36:45 +02:00
Thomas Jarosch
55d9f0873a
Fix #3243 (Improve non reentrant function check)
...
- Use std::map instead of linear std::list walk
and run fast tests like tok->isName() first.
Global speed up is 4.8% (profiled with google-perftools)
- Catch function invocations in global namespace
and ignore other namespaces except "std".
std::localtime() and others are also non-thread safe on POSIX.
Note: The check matches f.e. also on "std::getrpcbyname()",
but that would result in a compile error anyway.
No need to have an extra "std::xxxxx" whitelist.
- Remove double listed "rand" and "getrpcbyname" function names
2011-10-22 11:54:52 +02:00
Daniel Marjamäki
a9d2d45fbc
astyle formatting
2011-10-22 11:11:54 +02:00
Daniel Marjamäki
ab827e3631
Merge pull request #40 from joshbeck/master
...
Added option to set #ifdef configuration check limit
2011-10-22 00:51:05 -07:00
Marek Zmysłowski
b332ea8222
Fixed #3204 (Refactor standards support in Settings)
2011-10-22 09:45:48 +02:00
Edoardo Prezioso
9e5beab4a8
Nitpicky fix of the missing ';' after the memset command inside the test case.
2011-10-20 21:46:34 +02:00
seb777
41d9daa03d
Fixed ticket #3133 (Improve Check: Found obsolete function)
...
- add check for std::gets
- improve check when multiple obsolete functions are used
- remove false positive (declared functions)
2011-10-19 20:21:50 +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