Merge branch 'master' of github.com:danmar/cppcheck

This commit is contained in:
Robert Reif 2011-04-10 09:57:34 -04:00
commit 434783530a
11 changed files with 21 additions and 20 deletions

View File

@ -1122,8 +1122,8 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
{
if (!Token::Match(tok2, "%varid% [ %any% ] = 0 ;", tok->tokAt(2)->varId()))
{
// this is currently 'stupid'. See TestBufferOverrun::terminateStrncpy3
if (_settings->stupid)
// this is currently 'experimental'. See TestBufferOverrun::terminateStrncpy3
if (_settings->experimental)
terminateStrncpyError(tok);
}

View File

@ -1118,7 +1118,7 @@ void CheckClass::virtualDestructor()
// * base class doesn't have virtual destructor
// * derived class has non-empty destructor
// * base class is deleted
if (!_settings->stupid)
if (!_settings->experimental)
return;
createSymbolDatabase();

View File

@ -774,7 +774,7 @@ const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list<co
--parlevel;
if (parlevel < 1)
{
return (eq || _settings->stupid) ? 0 : "callfunc";
return (eq || _settings->experimental) ? 0 : "callfunc";
}
}
@ -2024,7 +2024,7 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
}
// Remove the "if break|continue ;" that follows "dealloc ; alloc ;"
if (! _settings->stupid && Token::Match(tok2, "dealloc ; alloc ; if break|continue ;"))
if (! _settings->experimental && Token::Match(tok2, "dealloc ; alloc ; if break|continue ;"))
{
tok2 = tok2->tokAt(3);
Token::eraseTokens(tok2, tok2->tokAt(3));
@ -2290,7 +2290,7 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok)
}
// If "--all" is given, remove all "callfunc"..
if (done && _settings->stupid)
if (done && _settings->experimental)
{
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
{

View File

@ -354,7 +354,7 @@ void CheckOther::checkRedundantAssignmentInSwitch()
void CheckOther::checkSwitchCaseFallThrough()
{
if (!(_settings->_checkCodingStyle && _settings->stupid))
if (!(_settings->_checkCodingStyle && _settings->experimental))
return;
const char switchPattern[] = "switch (";

View File

@ -477,7 +477,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
// First check for a "fall through" comment match, but only
// add a suppression if the next token is 'case' or 'default'
if (_settings->_checkCodingStyle && _settings->stupid && fallThroughComment)
if (_settings->_checkCodingStyle && _settings->experimental && fallThroughComment)
{
std::string::size_type j = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz", i);
std::string tok = str.substr(i, j - i);

View File

@ -43,7 +43,7 @@ Settings::Settings()
_append = "";
_terminate = false;
inconclusive = false;
stupid = false;
experimental = false;
test_2_pass = false;
reportProgress = false;
ifcfg = false;

View File

@ -59,11 +59,12 @@ public:
bool inconclusive;
/**
* @brief enables stupid checks that generates false positives because they are not clever enough.
* This flag should only be used temporarily by the check until it is fixed.
* There is no way to enable this flag from the command line.
* When this flag is false (default) then experimental
* heuristics and checks are disabled.
*
* It should not be possible to enable this from any client.
*/
bool stupid;
bool experimental;
/** @brief Is --style given? */
bool _checkCodingStyle;

View File

@ -36,13 +36,13 @@ private:
void check(const char code[], bool stupid = true)
void check(const char code[], bool experimental = true)
{
// Clear the error buffer..
errout.str("");
Settings settings;
settings.stupid = stupid;
settings.experimental = experimental;
settings._checkCodingStyle = true;
// Tokenize..

View File

@ -1382,7 +1382,7 @@ private:
errout.str("");
Settings settings;
settings.stupid = true;
settings.experimental = true;
// Tokenize..
Tokenizer tokenizer(&settings, this);

View File

@ -127,13 +127,13 @@ public:
{ }
private:
void check(const char code[], bool stupid = false)
void check(const char code[], bool experimental = false)
{
// Clear the error buffer..
errout.str("");
Settings settings;
settings.stupid = stupid;
settings.experimental = experimental;
// Tokenize..
Tokenizer tokenizer(&settings, this);
@ -2994,7 +2994,7 @@ private:
errout.str("");
Settings settings;
settings.stupid = true;
settings.experimental = true;
// Tokenize..
Tokenizer tokenizer(&settings, this);

View File

@ -193,7 +193,7 @@ private:
Settings settings;
settings._checkCodingStyle = true;
settings.stupid = true;
settings.experimental = true;
// Preprocess file..
Preprocessor preprocessor(&settings, this);