Merge branch 'master' of http://github.com/danmar/cppcheck
This commit is contained in:
commit
015fa92b4a
|
@ -22,7 +22,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/// @addtogroup Core
|
/// @addtogroup CLI
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "filelister.h"
|
#include "filelister.h"
|
||||||
|
|
||||||
/// @addtogroup Core
|
/// @addtogroup CLI
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "filelister.h"
|
#include "filelister.h"
|
||||||
|
|
||||||
/// @addtogroup Core
|
/// @addtogroup CLI
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "errorlogger.h"
|
#include "errorlogger.h"
|
||||||
|
|
||||||
|
/// @addtogroup CLI
|
||||||
|
/// @{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class will take a list of filenames and settings and check then
|
* This class will take a list of filenames and settings and check then
|
||||||
* all files using threads.
|
* all files using threads.
|
||||||
|
@ -95,4 +98,6 @@ private:
|
||||||
void operator=(const ThreadExecutor &);
|
void operator=(const ThreadExecutor &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
#endif // THREADEXECUTOR_H
|
#endif // THREADEXECUTOR_H
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#Redirect "devinfo.html" to the new place...
|
||||||
|
Redirect permanent /devinfo.html http://cppcheck.sourceforge.net/devinfo/
|
|
@ -0,0 +1,43 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>Cppcheck - A tool for static C/C++ code analysis</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/site/css/all.css" />
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="header">
|
||||||
|
<div class="wrap">
|
||||||
|
<h1>Cppcheck</h1>
|
||||||
|
<p>A tool for static C/C++ code analysis</p>
|
||||||
|
</div> <!-- .wrap -->
|
||||||
|
</div> <!-- #header -->
|
||||||
|
<div id="tabs">
|
||||||
|
<div class="wrap">
|
||||||
|
<ul>
|
||||||
|
<li><a href="/">Home</a></li>
|
||||||
|
<li><a href="http://sourceforge.net/apps/mediawiki/cppcheck/">Wiki</a></li>
|
||||||
|
<li><a href="http://sourceforge.net/apps/phpbb/cppcheck/">Forum</a></li>
|
||||||
|
<li><a href="http://sourceforge.net/apps/trac/cppcheck/">Trac</a></li>
|
||||||
|
<li><strong><a href="/devinfo/" title="Developer Information">Developer Info</a></strong></li>
|
||||||
|
<li><a href="http://sourceforge.net/projects/cppcheck/">Project page</a></li>
|
||||||
|
</ul>
|
||||||
|
</div> <!-- .wrap -->
|
||||||
|
</div> <!-- #tabs -->
|
||||||
|
<div id="content">
|
||||||
|
<div class="wrap">
|
||||||
|
<h2>Doxygen</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/doxyoutput/">Output</a></li>
|
||||||
|
<li><a href="/doxygen-errors.txt">Errors</a></li>
|
||||||
|
</ul>
|
||||||
|
<h2>Other</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/coverage_report/">Coverage report</a></li>
|
||||||
|
<li><a href="/cpd.txt">CPD report (duplicate code)</a></li>
|
||||||
|
</ul>
|
||||||
|
</div> <!-- .wrap -->
|
||||||
|
</div> <!-- #content -->
|
||||||
|
</body>
|
||||||
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
|
@ -0,0 +1,70 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<title>Cppcheck - A tool for static C/C++ code analysis</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/site/css/all.css" />
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="header">
|
||||||
|
<div class="wrap">
|
||||||
|
<h1>Cppcheck</h1>
|
||||||
|
<p>A tool for static C/C++ code analysis</p>
|
||||||
|
</div> <!-- .wrap -->
|
||||||
|
</div> <!-- #header -->
|
||||||
|
<div id="tabs">
|
||||||
|
<div class="wrap">
|
||||||
|
<ul>
|
||||||
|
<li><strong><a href="/">Home</a></strong></li>
|
||||||
|
<li><a href="http://sourceforge.net/apps/mediawiki/cppcheck/">Wiki</a></li>
|
||||||
|
<li><a href="http://sourceforge.net/apps/phpbb/cppcheck/">Forum</a></li>
|
||||||
|
<li><a href="http://sourceforge.net/apps/trac/cppcheck/">Trac</a></li>
|
||||||
|
<li><a href="/devinfo/" title="Developer Information">Developer Info</a></li>
|
||||||
|
<li><a href="http://sourceforge.net/projects/cppcheck/">Project page</a></li>
|
||||||
|
</ul>
|
||||||
|
</div> <!-- .wrap -->
|
||||||
|
</div> <!-- #tabs -->
|
||||||
|
<div id="content">
|
||||||
|
<div class="wrap">
|
||||||
|
<p><strong>Cppcheck</strong> is an analysis tool for C/C++ code. Unlike C/C++
|
||||||
|
compilers and many other analysis tools, it don't detect syntax errors. Cppcheck
|
||||||
|
only detects the types of bugs that the compilers normally fail to detect. The
|
||||||
|
goal is no false positives.</p>
|
||||||
|
|
||||||
|
<h2>Download</h2>
|
||||||
|
<p>You can download the standalone tool from our
|
||||||
|
<a href="http://sourceforge.net/projects/cppcheck/">project page</a> or try it
|
||||||
|
as plugin for your favorite IDE:</p>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Code::Blocks</strong> - <em>integrated</em></li>
|
||||||
|
<li><strong>CodeLite</strong> - <em>integrated</em></li>
|
||||||
|
<li><strong>Eclipse</strong> - <a href="http://cppcheclipse.googlecode.com/">Cppcheclipse</a></li>
|
||||||
|
<li><strong>Hudson</strong> - <a href="http://wiki.hudson-ci.org/display/HUDSON/Cppcheck+Plugin">Cppcheck Plugin</a></li>
|
||||||
|
</ul>
|
||||||
|
<p>No plugin exists for <strong>Visual Studio</strong>, but it's possible to add
|
||||||
|
Cppcheck as an external tool.</p>
|
||||||
|
|
||||||
|
<h2>Features</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Out of bounds checking</li>
|
||||||
|
<li>Check the code for each class</li>
|
||||||
|
<li>Checking exception safety</li>
|
||||||
|
<li>Memory leaks checking</li>
|
||||||
|
<li>Warn if obsolete functions are used</li>
|
||||||
|
<li>Check for invalid usage of <acronym title="Standard Template Library">STL</acronym></li>
|
||||||
|
<li>Check for uninitialized variables and unused functions</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Support</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Use <a href="http://sourceforge.net/apps/trac/cppcheck/">Trac</a> to report
|
||||||
|
bugs and feature requests</li>
|
||||||
|
<li>Ask questions in the <a href="http://sourceforge.net/apps/phpbb/cppcheck/">forum</a>
|
||||||
|
or at the IRC channel <a href="irc://irc.freenode.net/">#cppcheck</a></li>
|
||||||
|
<li>For more details look at the <a href="http://sourceforge.net/apps/mediawiki/cppcheck/">wiki</a></li>
|
||||||
|
</ul>
|
||||||
|
</div> <!-- .wrap -->
|
||||||
|
</div> <!-- #content -->
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,71 @@
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: Calibri,Verdana,sans-serif;
|
||||||
|
background: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Default link style */
|
||||||
|
a:link { color:#036; text-decoration:underline; }
|
||||||
|
a:visited { color:#036; text-decoration:underline; }
|
||||||
|
a:focus { color:#369; text-decoration:none; }
|
||||||
|
a:hover { color:#369; text-decoration:none; }
|
||||||
|
a:active { color:#369; text-decoration:none; }
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
#header {
|
||||||
|
color: #69c;
|
||||||
|
background: #036;
|
||||||
|
}
|
||||||
|
#header h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
#header p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tabs */
|
||||||
|
#tabs {
|
||||||
|
color: #eee;
|
||||||
|
background: #369;
|
||||||
|
border-top: 1px solid black;
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
}
|
||||||
|
#tabs ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
#tabs ul li {
|
||||||
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 .5em;
|
||||||
|
border-right: 1px solid black;
|
||||||
|
}
|
||||||
|
#tabs ul li:first-child {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
#tabs ul li:last-child {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
#tabs a:link { color:#eee; text-decoration:none; }
|
||||||
|
#tabs a:visited { color:#eee; text-decoration:none; }
|
||||||
|
#tabs a:focus { color:#fff; text-decoration:underline; }
|
||||||
|
#tabs a:hover { color:#fff; text-decoration:underline; }
|
||||||
|
#tabs a:active { color:#fff; text-decoration:underline; }
|
||||||
|
|
||||||
|
/* Content */
|
||||||
|
#content h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrap */
|
||||||
|
.wrap {
|
||||||
|
width: 50em;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: .5em;
|
||||||
|
}
|
|
@ -150,14 +150,22 @@ unsigned int CppCheck::check()
|
||||||
// Check only 12 first configurations, after that bail out, unless --force
|
// Check only 12 first configurations, after that bail out, unless --force
|
||||||
// was used.
|
// was used.
|
||||||
if (!_settings._force && checkCount > 11)
|
if (!_settings._force && checkCount > 11)
|
||||||
{
|
|
||||||
if (_settings._errorsOnly == false)
|
|
||||||
{
|
{
|
||||||
const std::string fixedpath = Path::toNativeSeparators(fname);
|
const std::string fixedpath = Path::toNativeSeparators(fname);
|
||||||
_errorLogger.reportOut(std::string("Bailing out from checking ") + fixedpath +
|
ErrorLogger::ErrorMessage::FileLocation location;
|
||||||
": Too many configurations. Recheck this file with --force if you want to check them all.");
|
location.setfile(fixedpath);
|
||||||
}
|
std::list<ErrorLogger::ErrorMessage::FileLocation> loclist;
|
||||||
|
loclist.push_back(location);
|
||||||
|
const std::string msg("Interrupted checking because of too many #ifdef configurations.\n"
|
||||||
|
"The checking of the file was interrupted because there were too many "
|
||||||
|
"#ifdef configurations. Checking of all #ifdef configurations can be forced "
|
||||||
|
"by --force command line option or from GUI preferences. However that may "
|
||||||
|
"increase the checking time.");
|
||||||
|
ErrorLogger::ErrorMessage errmsg(loclist,
|
||||||
|
Severity::information,
|
||||||
|
msg,
|
||||||
|
"toomanyconfigs");
|
||||||
|
_errorLogger.reportErr(errmsg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ private:
|
||||||
TEST_CASE(testMisusedScopeObjectDoesNotPickLocalClassConstructors);
|
TEST_CASE(testMisusedScopeObjectDoesNotPickLocalClassConstructors);
|
||||||
TEST_CASE(testMisusedScopeObjectDoesNotPickUsedObject);
|
TEST_CASE(testMisusedScopeObjectDoesNotPickUsedObject);
|
||||||
TEST_CASE(testMisusedScopeObjectDoesNotPickPureC);
|
TEST_CASE(testMisusedScopeObjectDoesNotPickPureC);
|
||||||
|
TEST_CASE(testMisusedScopeObjectDoesNotPickNestedClass);
|
||||||
TEST_CASE(trac2071);
|
TEST_CASE(trac2071);
|
||||||
TEST_CASE(trac2084);
|
TEST_CASE(trac2084);
|
||||||
|
|
||||||
|
@ -1358,6 +1359,27 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testMisusedScopeObjectDoesNotPickNestedClass()
|
||||||
|
{
|
||||||
|
const char code[] = "class ios_base {\n"
|
||||||
|
"public:\n"
|
||||||
|
" class Init {\n"
|
||||||
|
" public:\n"
|
||||||
|
" };\n"
|
||||||
|
"};\n"
|
||||||
|
"class foo {\n"
|
||||||
|
"public:\n"
|
||||||
|
" foo();\n"
|
||||||
|
" void Init(int);\n"
|
||||||
|
"};\n"
|
||||||
|
"foo::foo() {\n"
|
||||||
|
" Init(0);\n"
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
check(code, "test.cpp");
|
||||||
|
TODO_ASSERT_EQUALS("", "[test.cpp:13]: (error) instance of \"Init\" object destroyed immediately\n", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void trac2084()
|
void trac2084()
|
||||||
{
|
{
|
||||||
check("#include <signal.h>\n"
|
check("#include <signal.h>\n"
|
||||||
|
|
Loading…
Reference in New Issue