Don't cast bool to bool

This commit is contained in:
Ayaz Salikhov 2017-06-01 01:49:40 +03:00
parent cb58cf8163
commit 3cd2f2d092
7 changed files with 11 additions and 11 deletions

View File

@ -396,7 +396,7 @@ bool CheckAutoVariables::returnTemporary(const Token *tok)
if (!func && tok->type())
return true;
return bool(!retref && retvalue);
return (!retref && retvalue);
}
//---------------------------------------------------------------------------

View File

@ -651,7 +651,7 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const Variable& var
tok = tok->next();
}
return bool(noreturn==nullptr);
return (noreturn == nullptr);
}
// variable is seen..

View File

@ -146,13 +146,13 @@ std::string Path::getPathFromFilename(const std::string &filename)
bool Path::sameFileName(const std::string &fname1, const std::string &fname2)
{
#if defined(__linux__) || defined(__sun) || defined(__hpux)
return bool(fname1 == fname2);
return (fname1 == fname2);
#elif defined(_MSC_VER) || (defined(__GNUC__) && defined(_WIN32))
return bool(_stricmp(fname1.c_str(), fname2.c_str()) == 0);
return (_stricmp(fname1.c_str(), fname2.c_str()) == 0);
#elif defined(__GNUC__)
return bool(strcasecmp(fname1.c_str(), fname2.c_str()) == 0);
return (strcasecmp(fname1.c_str(), fname2.c_str()) == 0);
#elif defined(__BORLANDC__)
return bool(stricmp(fname1.c_str(), fname2.c_str()) == 0);
return (stricmp(fname1.c_str(), fname2.c_str()) == 0);
#else
#error Platform filename compare function needed
#endif

View File

@ -185,7 +185,7 @@ class CPPCHECKLIB Variable {
* @return true if flag set or false in flag not set
*/
bool getFlag(unsigned int flag_) const {
return bool((_flags & flag_) != 0);
return ((_flags & flag_) != 0);
}
/**
@ -656,7 +656,7 @@ class CPPCHECKLIB Function {
* @return true if flag set or false in flag not set
*/
bool getFlag(unsigned int flag) const {
return bool((flags & flag) != 0);
return ((flags & flag) != 0);
}
/**

View File

@ -893,7 +893,7 @@ private:
* @return true if flag set or false in flag not set
*/
bool getFlag(unsigned int flag_) const {
return bool((_flags & flag_) != 0);
return ((_flags & flag_) != 0);
}
/**

View File

@ -2369,7 +2369,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
return false;
}
return bool(typeCount >= 2 && tok2 && Token::Match(tok2->tokAt(-2), "!!:: %type%"));
return (typeCount >= 2 && tok2 && Token::Match(tok2->tokAt(-2), "!!:: %type%"));
}

View File

@ -4436,7 +4436,7 @@ private:
" x = 0;\n"
" }\n"
" bool isValid() {\n"
" return bool(x == 0x11224488);\n"
" return (x == 0x11224488);\n"
" }\n"
"};");
ASSERT_EQUALS("[test.cpp:9]: (style, inconclusive) Technically the member function 'Fred::isValid' can be const.\n", errout.str());