Reverted [352] it's not a good fix

This commit is contained in:
Daniel Marjamäki 2008-10-25 17:06:27 +00:00
parent de71095e82
commit 2eb775e536
2 changed files with 1 additions and 57 deletions

View File

@ -198,35 +198,6 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
varnames[0] = varname;
varnames[1] = 0;
// If "--all" hasn't been given and there are a preprocessor command, bail out.
// TODO: Evaluate all possible configurations separately instead.
if ( ! ShowAll )
{
int indentlevel = 0;
for ( const TOKEN *_tok = tok; _tok; _tok = _tok->next )
{
if ( _tok->str[0] == '{' )
{
indentlevel++;
}
else if ( _tok->str[0] == '}' )
{
if ( indentlevel <= 0 )
break;
indentlevel--;
}
else if ( _tok->str[0] == '#' )
{
return NULL;
}
}
}
TOKEN *rethead = 0, *rettail = 0;
#define addtoken(_str) \
{ \
@ -383,7 +354,6 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
return rethead;
}
static void erase(TOKEN *begin, const TOKEN *end)
{
if ( ! begin )
@ -399,11 +369,7 @@ static void erase(TOKEN *begin, const TOKEN *end)
}
/**
* Check the allocation and deallocation for a function variable
* \param Tok1 The token where the variable is declared
* \param varname The name of the variable
**/
// Simpler but less powerful than "CheckMemoryLeak_CheckScope_All"
static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[] )
{
TOKEN *tok = getcode( Tok1, varname );

View File

@ -57,7 +57,6 @@ private:
TEST_CASE( switch2 );
TEST_CASE( mismatch1 );
TEST_CASE( mismatch2 );
TEST_CASE( func1 );
TEST_CASE( func2 );
@ -404,27 +403,6 @@ private:
}
void mismatch2()
{
// This code is taken directly from bug 2190219 - False positive, Mismatching allocation and deallocation
check( "void foo()\n"
"{\n"
"#ifdef __cplusplus\n"
" int* flags = new int[10];\n"
"#else\n"
" int* flags = (int*)malloc((10)*sizeof(int));\n"
"#endif\n"
"\n"
"#ifdef __cplusplus\n"
" delete [] flags;\n"
"#else\n"
" free(flags);\n"
"#endif\n"
"}\n");
ASSERT_EQUALS( std::string(""), errout.str() );
}