Commit Graph

7090 Commits

Author SHA1 Message Date
Daniel Marjamäki 097637a66c Fixed #3316 (Cppcheck reporting internal errors - code compiles cleanly) 2011-11-20 16:22:21 +01:00
Edoardo Prezioso a32b05197d Change every 'tokAt(1)' to 'next()' and every 'tokAt(-1)' to 'previous()'.
Added a safety check to ensure that a 'previous()' call doesn't crash (not sure if it's needed or not).
2011-11-20 15:59:37 +01:00
Daniel Marjamäki b92959809c Uninitvar: Made checking experimental 2011-11-20 15:19:56 +01:00
Edoardo Prezioso 11dd3c09ce Change every 'tokAt(1)->' to 'next()->' because 'tokAt(1) == 0' is equivalent to 'next() == 0', hence the equivalent cppcheck crash. 2011-11-20 15:09:57 +01:00
Edoardo Prezioso 42e369a4b4 Change every 'tokAt(..)->link()' to 'linkAt(..)'. 2011-11-20 14:24:27 +01:00
Daniel Marjamäki 690702a742 Memory leaks: Made CheckMemoryLeakInFunction experimental 2011-11-20 14:11:22 +01:00
Daniel Marjamäki 1cf45a5cde Fixed #3280 (False positive: assigned value that is never used) 2011-11-20 12:09:07 +01:00
Daniel Marjamäki 8c091ff968 Fixed #3340 (Internal error. Token::Match called with varid 0... union is causing problems) 2011-11-20 08:13:28 +01:00
Daniel Marjamäki 2a5b4b1842 Fixed #3328 (False negative: out of bounds) 2011-11-19 15:28:06 +01:00
Daniel Marjamäki fc42fc956c Reverted previous commit. There are testrunner problems when the code is removed. 2011-11-19 15:14:45 +01:00
Daniel Marjamäki 5511f3fbfd removed cleanup code that will crash in some environments. it's somewhat redundant. 2011-11-19 14:50:04 +01:00
Daniel Marjamäki 13eecb9109 Fixed #3329 (cppcheck core dump on Sun machine) 2011-11-19 14:44:55 +01:00
Edoardo Prezioso c3b54066bd Merge branch 'master' of github.com:danmar/cppcheck 2011-11-19 13:36:05 +01:00
Edoardo Prezioso ccdb18f213 Add a sanity check and an error message to linkAt when the index is outside the tokens range. 2011-11-19 13:34:36 +01:00
Daniel Marjamäki c025bf9d57 Fixed #3332 (mismatching comparison: Hard to understand) 2011-11-19 08:38:54 +01:00
Edoardo Prezioso fa34a14d57 Add more tests for flow control simplification. 2011-11-18 21:10:56 +01:00
Edoardo Prezioso 44e348d018 Add test for the consecutive braces simplification, thanks to thomasjfox's example. 2011-11-18 21:04:24 +01:00
Daniel Marjamäki 033fef36da improved error message 'mismatching comparison' 2011-11-18 20:07:42 +01:00
Daniel Marjamäki e78131f9e6 Preprocessor: better handling of #define A 0 => #if A==0. ticket #3331 2011-11-17 19:19:43 +01:00
Marek Zmysłowski 994f08fdf0 Fixed #886 (new check: wrong value passed to isgraph function) 2011-11-17 16:31:16 +01:00
Stefan Weil 68a1b69d32 Preprocessor: Fix comments (backspace -> backslash)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2011-11-15 19:30:43 +01:00
Stefan Weil 00ead7fb2e support any number of --append=<file> options
If one or more append files are given on the command line,
they are simply concatenated.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2011-11-15 19:27:36 +01:00
Stefan Weil 785bc3d04b Optimize handling of --append=<file> option (execution time, memory)
Whitespace was removed from the append data for every configuration
and every file: n(configuration) * n(files).

Removing whitespace immediately after the append data was read can
significantly reduce the execution time and memory usage.
It also allows further improvement because copies to the temporary
object appendCode are no longer needed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2011-11-15 19:27:36 +01:00
Stefan Weil d11f18b5df cmdlineparser: terminate with error message if --append=<filename> fails
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2011-11-15 19:27:36 +01:00
Thomas Jarosch c317c8979c Run astyle 2011-11-14 09:21:42 +01:00
Thomas Jarosch a645235d5a Adapt Token::strAt() to return a const reference like Token::str() does
Saves us a complete conversion from string.c_str() back to std::string.
2011-11-14 09:19:46 +01:00
Richard Quirk 527236b321 Fix false positives for delete of known nulls 2011-11-13 22:38:34 +01:00
Edoardo Prezioso 2c64d299ca Change every 'tokAt(...)->str()' to 'strAt(...)'. 2011-11-13 13:10:59 +01:00
Edoardo Prezioso b28a44dc3b Change: 'next()->next()'->'tokAt(2)', 'previous()->previous()'->'tokAt(-2)'. 2011-11-12 22:33:03 +01:00
Edoardo Prezioso ed6a0e14c4 Add simplification of the consecutive braces before the end of 'tokenize()' function. 2011-11-12 16:59:20 +01:00
Edoardo Prezioso 5cbfbe31c1 Add removal of consecutive braces, i.e.: '{ { ... } }'->'{ ... }'.
Changed a little bit the dead code tests.
2011-11-12 12:07:10 +01:00
Edoardo Prezioso 2aceb623ae 1)Add 'Token' function 'linkAt', which simplifies the writing 'tokAt(i)->link()' to 'linkAt(i)'.
It's still unused, though.
2)Fix one grammatical mistake inside token.h
3)Style change to token.cpp: remove the whitespace between '!' and 'begin'.
2011-11-11 21:55:37 +01:00
Thomas Jarosch 283c2e508e Remove check for "this" inside Token class
The check hides real memory problems and is
also useless in most cases.
2011-11-11 17:19:08 +01:00
Daniel Marjamäki 5a35beebf7 added todo comment 2011-11-11 11:07:03 +01:00
Daniel Marjamäki 34e40502c6 Fixed #3314 (cppcheck incorrectly reporting Syntax error.) 2011-11-11 10:53:49 +01:00
Daniel Marjamäki 8bbd535267 Fixed #3290 (False positive: Null pointer dereference (typeid)) 2011-11-11 09:58:17 +01:00
Daniel Marjamäki 9996d38715 Fix #3277 (Other: attempt to copy-construct an iterator from a singular iterator) 2011-11-11 09:19:59 +01:00
Daniel Marjamäki 688e290332 Memory leaks: Fixed false positive for 'char *p = strcpy(malloc(10),str);' 2011-11-11 09:07:02 +01:00
Reijo Tomperi 17842394c0 Fix #3324 (Change "--template '<text>'" into "--template='<text>'")
http://sourceforge.net/apps/trac/cppcheck/ticket/3324
https://sourceforge.net/apps/trac/cppcheck/wiki/DesignDecisions
2011-11-11 00:00:15 +02:00
Reijo Tomperi ca70693055 Astyle fix 2011-11-10 22:32:37 +02:00
Stefan Weil 76dda36b64 cmdlineparser: add support for --template=
The GNU standard for long command line options is --option=value.
All other long options of cppcheck support this, so add it for
the template option, too.

--template xxx can be made obsolete later.

Should the documentation and tests also be changed now?

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2011-11-10 22:25:49 +02:00
Reijo Tomperi 93b1bba8cb Fix readme.txt to match current HAVE_RULES behaviour. 2011-11-10 21:49:55 +02:00
Daniel Marjamäki 410b11c00f Merge pull request #60 from richq/varid0
Fix varid 0 with function pointer and virtual methods
2011-11-09 14:28:54 -08:00
Thomas Jarosch 1a454256dc Cache result of tok->isStandardType()
Also contains test order improvements from Johan Samuelson (#3116).

Run time went down from 15.15s to 14.95s for the case below.

Benchmarked using these settings:
- CXXFLAGS="-O2 -g -NDEBUG"
- time -p cppcheck.git -q --std=posix --enable=all --inconclusive -Dfoo .

on the "rpm" codebase.
2011-11-09 21:56:30 +01:00
Reijo Tomperi 5fefaf4166 Improve error logging in ThreadExecutor 2011-11-09 22:15:53 +02:00
Thomas Jarosch 7202a51065 Add negative test for .c_str() unit test and TODO_ASSERT_EQUALS (#3266) 2011-11-09 21:08:53 +01:00
Richard Quirk f56aa19fac Fix varid 0 with function pointer and virtual methods 2011-11-09 21:07:55 +01:00
Thomas Jarosch c010ca33a5 Run astyle 2011-11-09 20:34:58 +01:00
Daniel Marjamäki 2d00cabee1 Fixed #3279 (Token::Match called with varid 0) 2011-11-09 18:49:17 +01:00
Daniel Marjamäki b7cc9779c4 Merge pull request #59 from richq/sameexpr
Improved same expression check for ticket #3274
2011-11-08 23:56:36 -08:00