Commit Graph

3206 Commits

Author SHA1 Message Date
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
Edoardo Prezioso 882b0c15a0 Improve tokenizing of "do{ ... } while(0)".
The simplification will be the same for every combination, except for the 'continue' and the 'break'. In that case, keep the block braces.
2011-10-19 18:20:29 +02:00
Edoardo Prezioso 73f0e2c5b9 Fixed ticket #3227 (Improve tokenizer: labels are not handled correctly after a case or another label instruction)
Moved the labels simplification after combining the tokens and moved the case/default simplification inside the labels.
2011-10-19 14:20:09 +02:00
Joshua Beck 56561835f8 Add option to set #ifdef configuration check limit 2011-10-18 19:52:55 -05:00
Edoardo Prezioso f4cdf57955 Fixed ticket #3229 (Segfault with goto):
Don't handle labels, gotos, returns and indentations inside the round braces. This is applied not only for simplifyGoto, but also to simplifyFlowControl.
Rewrite enum badly handled by astyle inside mathlib.cpp and move simplifyFlowControl at the end of the simplifyTokenList in order to catch more dead code, not related to the ticket.
2011-10-18 23:56:35 +02:00
PKEuS dc15641954 Fixed #3223 (Improve check: Check more STL algorithms for missmatching containers check) 2011-10-18 21:55:41 +02:00
PKEuS ea02bd905a Fixed #3225 (Boolean comparison with string literals) 2011-10-18 21:37:03 +02:00
Daniel Marjamäki 3d18fdfa3f Fixed #3220 (False positive: possible null pointer dereference: 'SwDoc *pDoc = NULL; pDoc->do_something();') 2011-10-18 19:34:14 +02:00
Daniel Marjamaki bf0386c938 Preprocessor: Started working on new preprocessing that uses -D information better. Ticket: #2131 2011-10-17 20:12:46 +02:00
Edoardo Prezioso c3caade3ca - Fixed mispelled function name;
changed variable name inside simplifyFlowControl for consistency;
improved simplifyFlowControl to handle better this kind of code:
"return; { { } { label : ; ok ( ) ; } }"->"return ; { { label: ok ( ) ; } }".
2011-10-17 02:16:49 +02:00
Edoardo Prezioso 6f80c5ff64 Removed redundant test, which was related to the Tokenizer, not to the memory leak checker. 2011-10-16 21:19:18 +02:00
PKEuS f8074b71d2 Fixed #2470 (False negative: Possible null pointer dereference (C++0x keyword 'nullptr')) 2011-10-16 12:54:58 +02:00
Thomas Jarosch a52b73f9f9 Fix #3208 (Simplify pointer to standard type, C only)
The symbol database is unavailable during token simplification
and &data[0] might return something completely different for C++.

Moved code_is_c() from checkOther to Tokenizer.
2011-10-16 08:09:57 +02:00
PKEuS 71a1d98693 Fixed ##3211 (Crash in gitHEAD when arglist count is smaller than format string) 2011-10-16 07:06:18 +02:00
Edoardo Prezioso 57ead6988e Fixed ticket #3138 (Tokenizer: remove unreachable code below goto inside a namespace|class|struct block) 2011-10-15 11:35:45 +02:00
Edoardo Prezioso f95b692a69 Fixed ticket #3113 (complete simplification of dead code after control flow statements) 2011-10-15 01:34:07 +02:00
Thomas Jarosch 7824e5c0f5 Fixed #3210 (STL check: Add support for reverse iterator) 2011-10-14 19:54:20 +02:00
Thomas Jarosch 7ae39f13cc Fixed #3198 (Add check for readlink()) 2011-10-14 19:45:51 +02:00
Jonathan Neuschäfer 4fb7865f49 fix typos using codespell
Codespell is available at http://git.profusion.mobi/cgit.cgi/lucas/codespell/.
2011-10-13 22:04:41 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Edoardo Prezioso b792efb761 Fix ticket 3140 and 3137 (Improve Tokenizer: Remove dead for loop - simplify while(0) better.
Note: it doesn't remove dead code if there's a label inside. Will be improved in another ticket.
2011-10-13 13:01:24 +02:00
Edoardo Prezioso 16506f0a8c Remove redundant simplifyDeadCode call inside the Tokenizer::tokenize and move the relative tests in the file 'testsimplifytokens.cpp'. 2011-10-13 12:26:27 +02:00
Zachary Blair 82366918ff Fixed #2627 (switch case fall through: redundant strcpy) 2011-10-13 01:27:22 -07:00
PKEuS 91d7621994 Fixed #3180 (New check: Detect nullpointers given to printf via variable argument list) 2011-10-12 22:11:27 +02:00
Daniel Marjamäki b73896bcc5 Fixed #3163 (Out of bounds pointer arithmetic not reset) 2011-10-12 20:54:39 +02:00
Daniel Marjamäki 371871b0b7 Tokenizer::removeMacrosInGlobalScope: Don't remove C/C++ keywords namespace/struct/etc. Ticket: #3193 2011-10-12 19:23:39 +02:00
Daniel Marjamäki cf39ece8da Fixed #3150 (Invalid warning when pointer difference is not adjacent) 2011-10-12 19:01:44 +02:00
Robert Reif ee04c1bfb7 fix #3194 (Parsing glitch causes false 'can be const' error for an 'if' statement) 2011-10-12 09:10:34 -04:00
Marek Zmysłowski 07d8cd0a12 improved realloc checking '*p = realloc(*p,..'. Ticket: #1791 2011-10-11 22:07:14 +02:00
Thomas Jarosch 849bee8437 [PATCH] Detect suspicious use of semicolon after 'if/for/while'
statements if they are followed by a {..} block.

Examples are:

for (int i = 0; i < 10; ++i);
{
   printf("i)";
}

or

if (i == 100);
{
   die("Wrong argument");
}

This new check is active if you enable inconclusive checks.
2011-10-11 08:41:39 +02:00
Zachary Blair fcf360825a Fixed #2955 (New check: Using && instead of &) 2011-10-10 10:11:17 -07:00