This commit is contained in:
Sébastien Debrard 2011-02-02 01:18:59 +01:00
commit 2b59b57618
13 changed files with 15238 additions and 15 deletions

1
.gitignore vendored
View File

@ -36,7 +36,6 @@ gui/qrc_gui.cpp
gui/*.qm
# Doxygen output folder
doxyoutput/
htdocs/
# qmake generated
*.sdf

View File

@ -2,9 +2,18 @@
<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>
<title>Developer Information - Cppcheck</title>
<link rel="stylesheet" type="text/css" href="/site/css/all.css" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="alternate" type="application/atom+xml" title="Recent Commits to cppcheck:master"
href="https://github.com/danmar/cppcheck/commits/master.atom" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/site/js/github.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#github-commits").listCommits("danmar", "cppcheck", "master");
});
</script>
</head>
<body>
<div id="header">
@ -27,6 +36,14 @@
</div> <!-- #tabs -->
<div id="content">
<div class="wrap">
<h2>Source Code</h2>
<p>Latest version can be found in the <a href="https://github.com/danmar/cppcheck/">
cppcheck git repository</a>. To download it, run the following command:</p>
<pre>git clone git://github.com/danmar/cppcheck.git</pre>
<p>You can also <a href="https://github.com/danmar/cppcheck/downloads">download
the latest sources in a zip or tgz archive</a> from the github website.</p>
<h3>Recent Commits</h3>
<div id="github-commits"><a href="https://github.com/danmar/cppcheck/commits/master">View recent commits&hellip;</a></div>
<h2>Doxygen</h2>
<ul>
<li><a href="/doxyoutput/">Output</a></li>

View File

@ -2,9 +2,17 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="Cppcheck is an analysis tool for C/C++ code.
It detects the types of bugs that the compilers normally fail to detect. The
goal is no false positives." />
<meta name="keywords" content="Cppcheck, open source, analysis tool, C/C++,
code, errors, bugs, compilers, bounds checking, memory leaks, obsolete functions,
uninitialized variables, unused functions" />
<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" />
<link rel="alternate" type="application/rss+xml" title="Project News"
href="http://sourceforge.net/export/rss2_projnews.php?group_id=195752" />
</head>
<body>
<div id="header">
@ -33,6 +41,7 @@ only detects the types of bugs that the compilers normally fail to detect. The
goal is no false positives.</p>
<h2>Download</h2>
<p><a class="downloadnow" href="http://downloads.sourceforge.net/cppcheck/cppcheck-1.46.1-x86-Setup.msi"><strong>Download Now!</strong> <em>Version 1.46.1 for Windows</em></a></p>
<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>
@ -56,6 +65,22 @@ Cppcheck as an external tool.</p>
<li>Check for uninitialized variables and unused functions</li>
</ul>
<h2>News</h2>
<?php
require './site/simplepie/simplepie.inc';
$feed = new SimplePie();
$feed->set_feed_url('http://sourceforge.net/export/rss2_projnews.php?group_id=195752');
$feed->set_cache_location('./site/simplepie/cache');
$feed->init();
print("<ul class=\"rssfeeditems\">\n");
foreach ($feed->get_items(0, 3) as $item) { //for the last 3 news items...
print(" <li><a href=\"".$item->get_link()."\">".$item->get_title()."</a> <em>".$item->get_date('Y-m-d')."</em></li>\n");
}
print("</ul>\n");
?>
<p><a href="http://sourceforge.net/news/?group_id=195752">View all news&hellip;</a></p>
<h2>Support</h2>
<ul>
<li>Use <a href="http://sourceforge.net/apps/trac/cppcheck/">Trac</a> to report

View File

@ -2,6 +2,7 @@ body {
margin: 0;
padding: 0;
font-family: Calibri,Verdana,sans-serif;
color: #000;
background: #eee;
}
@ -31,8 +32,8 @@ a:active { color:#369; text-decoration:none; }
#tabs {
color: #eee;
background: #369;
border-top: 1px solid black;
border-bottom: 1px solid black;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
#tabs ul {
margin: 0;
@ -44,7 +45,7 @@ a:active { color:#369; text-decoration:none; }
display: inline;
margin: 0;
padding: 0 .5em;
border-right: 1px solid black;
border-right: 1px solid #000;
}
#tabs ul li:first-child {
padding-left: 0;
@ -58,14 +59,65 @@ a:active { color:#369; text-decoration:none; }
#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;
}
/* RSS feed items */
.rssfeeditems em {
margin-left: .5em;
color: #888;
font-size: smaller;
}
/* "Download Now!" link */
a.downloadnow {
display: block;
width: 12em;
margin: 0;
padding: 5px;
text-align: center;
text-decoration: none;
color: white;
background: #060;
border: 1px solid #060;
/* border-radius */
border-radius: .5em;
-moz-border-radius: .5em;
-khtml-border-radius: .5em;
-webkit-border-radius: .5em;
}
a.downloadnow:link,
a.downloadnow:visited {
text-decoration: none;
color: white;
}
a.downloadnow:focus,
a.downloadnow:hover {
text-decoration: none;
color: white;
background: #090;
}
a.downloadnow strong {
display: block;
font-size: larger;
font-weight: bold;
}
a.downloadnow em {
display: block;
font-size: smaller;
font-style: normal;
}
/* Printing */
@media print {
#header { color: black; border-bottom: 1px solid black; }
#tabs { display: none; }
}

33
htdocs/site/js/github.js Normal file
View File

@ -0,0 +1,33 @@
// Inspired by:
// http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html
jQuery.fn.listCommits = function(username, repository, branch) {
this.html('<span>Querying GitHub for recent commits&hellip;</span>');
var target = this;
$.getJSON('http://github.com/api/v2/json/commits/list/' + username + '/' + repository + '/' + branch + '?callback=?', function(data) {
var repos = data.commits;
var list = $('<ul/>');
target.empty().append(list);
$(repos).each(function(i) {
var githubUrl = 'https://github.com' + this.url;
var shortMessage = cutLines(this.message);
var author = this.author.login;
if (author == '') {
author = this.author.name;
}
list.append('<li><a href="' + githubUrl + '">' + shortMessage + '</a> by <strong>' + author + '</strong></li>');
if (i == 9) return false;
});
});
function cutLines(message) {
var lineFeed = message.indexOf("\n");
if (lineFeed > -1) {
return message.slice(0, lineFeed);
}
return message;
}
};

View File

@ -0,0 +1,26 @@
Copyright (c) 2004-2007, Ryan Parman and Geoffrey Sneddon.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the SimplePie Team nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,30 @@
SIMPLEPIE
http://simplepie.org
By Ryan Parman and Geoffrey Sneddon
BSD-LICENSED
http://www.opensource.org/licenses/bsd-license.php
WHAT COMES IN THE PACKAGE?
1) simplepie.inc - The SimplePie library. This is all that's required for your pages.
2) README.txt - This document.
3) LICENSE.txt - A copy of the BSD license.
4) compatibility_test - The SimplePie compatibility test that checks your server for required settings.
5) demo - A basic feed reader demo that shows off some of SimplePie's more noticable features.
6) idn - A third-party library that SimplePie can optionally use to understand Internationalized Domain Names (IDNs).
7) test - SimplePie's unit test suite. This is only available in SVN builds.
TO START THE DEMO:
1) Upload this package to your webserver.
2) Make sure that the cache folder inside of the demo folder is server-writable.
3) Navigate your browser to the demo folder.
SUPPORT:
For further setup and install documentation, function references, etc., visit:
http://simplepie.org/wiki/
For bug reports, feature requests and other support, visit:
http://simplepie.org/support/
For more insight on SimplePie development, visit:
http://simplepie.org/development/

0
htdocs/site/simplepie/cache/dummy.txt vendored Normal file
View File

File diff suppressed because one or more lines are too long

View File

@ -1911,6 +1911,8 @@ void CheckOther::functionVariableUsage()
variables.use(tok->next()->varId()); // use = read + write
else if (Token::Match(tok, "[;{}] %var% >>"))
variables.use(tok->next()->varId()); // use = read + write
else if (Token::Match(tok, "[{,] %var% [,}]"))
variables.read(tok->next()->varId());
// function parameter
else if (Token::Match(tok, "[(,] %var% ["))

View File

@ -2555,11 +2555,13 @@ void Tokenizer::arraySize()
const Token *tok2 = tok->tokAt(5);
while (Token::Match(tok2, "%any% ,"))
{
if (tok2->isName())
break;
sz++;
tok2 = tok2->tokAt(2);
}
if (Token::Match(tok2, "%any% } ;"))
if (!tok2->isName() && Token::Match(tok2, "%any% } ;"))
tok->next()->insertToken(MathLib::toString<unsigned int>(sz));
}
@ -4431,7 +4433,8 @@ void Tokenizer::removeRedundantAssignment()
}
else if (tok2->varId() &&
!Token::Match(tok2->previous(), "[;{}] %var% = %var% ;") &&
!Token::Match(tok2->previous(), "[;{}] %var% = %num% ;"))
!Token::Match(tok2->previous(), "[;{}] %var% = %num% ;") &&
!(Token::Match(tok2->previous(), "[;{}] %var% = %any% ;") && tok2->strAt(2)[0] == '\''))
{
localvars.erase(tok2->varId());
}
@ -6318,6 +6321,7 @@ bool Tokenizer::simplifyKnownVariables()
else if (tok2->previous()->str() != "*" &&
(Token::Match(tok2, "%var% = %num% ;") ||
Token::Match(tok2, "%var% = %str% ;") ||
(Token::Match(tok2, "%var% = %any% ;") && tok2->strAt(2)[0] == '\'') ||
Token::Match(tok2, "%var% [ ] = %str% ;") ||
Token::Match(tok2, "%var% [ %num% ] = %str% ;") ||
Token::Match(tok2, "%var% = %bool% ;") ||
@ -6706,6 +6710,28 @@ bool Tokenizer::simplifyKnownVariables()
ret = true;
}
if (Token::simpleMatch(tok3, "= {"))
{
unsigned int indentlevel4 = 0;
for (const Token *tok4 = tok3; tok4; tok4 = tok4->next())
{
if (tok4->str() == "{")
++indentlevel4;
else if (tok4->str() == "}")
{
if (indentlevel4 <= 1)
break;
--indentlevel4;
}
if (Token::Match(tok4, "{|, %varid% ,|}", varid))
{
tok4->next()->str(value);
tok4->next()->varId(valueVarId);
ret = true;
}
}
}
// Using the variable in for-condition..
if (Token::simpleMatch(tok3, "for ("))
{

View File

@ -56,5 +56,5 @@ Cross compiling Win32 (CLI) version of Cppcheck in Linux
Webpage
http://www.sf.net/projects/cppcheck
http://cppcheck.sourceforge.net/

View File

@ -126,6 +126,7 @@ private:
TEST_CASE(simplifyKnownVariables37); // ticket #2398 - false positive caused by no simplification in for loop
TEST_CASE(simplifyKnownVariables38); // ticket #2399 - simplify conditions
TEST_CASE(simplifyKnownVariables39);
TEST_CASE(simplifyKnownVariables40);
TEST_CASE(simplifyKnownVariablesBailOutAssign);
TEST_CASE(simplifyKnownVariablesBailOutFor1);
TEST_CASE(simplifyKnownVariablesBailOutFor2);
@ -2046,6 +2047,16 @@ private:
}
}
void simplifyKnownVariables40()
{
const char code[] = "void f() {\n"
" char c1 = 'a';\n"
" char c2 = { c1 };\n"
"}";
ASSERT_EQUALS("void f ( ) {\n;\nchar c2 ; c2 = { 'a' } ;\n}", tokenizeAndStringify(code, true));
}
void simplifyKnownVariablesBailOutAssign()
{
const char code[] = "int foo() {\n"
@ -4669,6 +4680,7 @@ private:
void arraySize()
{
ASSERT_EQUALS("; int a[3]={1,2,3};", arraySize_(";int a[]={1,2,3};"));
ASSERT_EQUALS("; int a[]={ ABC,2,3};", arraySize_(";int a[]={ABC,2,3};"));
}
std::string labels_(const std::string &code)