Commit 569509f4 authored by Daniel Pfeifer's avatar Daniel Pfeifer

Fix newly discovered clang-tidy issues

Clang-tidy reports some issues only from the currently compiled source
file and its associated header file.  Separating the compilation of
commands exposed some clang-tidy issues that were not reported previously.
Fix them.
parent 6c9b3b5c
Pipeline #32257 passed with stage
......@@ -270,8 +270,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
yet its linker language. */
if ((type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) &&
(this->Makefile->GetState()->GetGlobalPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false)) {
!this->Makefile->GetState()->GetGlobalPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS")) {
std::ostringstream w;
w << "ADD_LIBRARY called with "
<< (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
......
......@@ -222,7 +222,7 @@ bool cmConditionEvaluator::GetBooleanValue(
double d = strtod(arg.c_str(), &end);
if (*end == '\0') {
// The whole string is a number. Use C conversion to bool.
return d ? true : false;
return static_cast<bool>(d);
}
}
......@@ -444,7 +444,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
if (this->IsKeyword(keyCOMMAND, *arg) && argP1 != newArgs.end()) {
cmCommand* command =
this->Makefile.GetState()->GetCommand(argP1->c_str());
this->HandlePredicate(command ? true : false, reducible, arg, newArgs,
this->HandlePredicate(command != CM_NULLPTR, reducible, arg, newArgs,
argP1, argP2);
}
// does a policy exist
......@@ -456,7 +456,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
// does a target exist
if (this->IsKeyword(keyTARGET, *arg) && argP1 != newArgs.end()) {
this->HandlePredicate(
this->Makefile.FindTargetToUse(argP1->GetValue()) ? true : false,
this->Makefile.FindTargetToUse(argP1->GetValue()) != CM_NULLPTR,
reducible, arg, newArgs, argP1, argP2);
}
// does a test exist
......@@ -464,7 +464,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
this->Policy64Status != cmPolicies::WARN) {
if (this->IsKeyword(keyTEST, *arg) && argP1 != newArgs.end()) {
const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str());
this->HandlePredicate(haveTest ? true : false, reducible, arg,
this->HandlePredicate(haveTest != CM_NULLPTR, reducible, arg,
newArgs, argP1, argP2);
}
} else if (this->Policy64Status == cmPolicies::WARN &&
......@@ -638,8 +638,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
bool success = cmSystemTools::FileTimeCompare(
arg->GetValue(), (argP2)->GetValue(), &fileIsNewer);
this->HandleBinaryOp(
(success == false || fileIsNewer == 1 || fileIsNewer == 0),
reducible, arg, newArgs, argP1, argP2);
(!success || fileIsNewer == 1 || fileIsNewer == 0), reducible, arg,
newArgs, argP1, argP2);
}
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
......
......@@ -2449,18 +2449,14 @@ public:
{
}
~cURLEasyGuard(void)
~cURLEasyGuard()
{
if (this->Easy) {
::curl_easy_cleanup(this->Easy);
}
}
inline void release(void)
{
this->Easy = CM_NULLPTR;
return;
}
void release() { this->Easy = CM_NULLPTR; }
private:
::CURL* Easy;
......
......@@ -302,7 +302,7 @@ bool cmFindBase::CheckForVariableInCache()
cmState* state = this->Makefile->GetState();
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
bool cached = cacheEntry ? true : false;
bool cached = cacheEntry != CM_NULLPTR;
if (found) {
// If the user specifies the entry on the command line without a
// type we should add the type and docstring but keep the
......
......@@ -673,8 +673,8 @@ bool cmFindPackageCommand::HandlePackageMode()
bool configFileSetFOUNDFalse = false;
if (fileFound) {
if ((this->Makefile->IsDefinitionSet(foundVar)) &&
(this->Makefile->IsOn(foundVar) == false)) {
if (this->Makefile->IsDefinitionSet(foundVar) &&
!this->Makefile->IsOn(foundVar)) {
// by removing Foo_FOUND here if it is FALSE, we don't really change
// the situation for the Config file which is about to be included,
// but we make it possible to detect later on whether the Config file
......@@ -693,8 +693,8 @@ bool cmFindPackageCommand::HandlePackageMode()
found = true;
// Check whether the Config file has set Foo_FOUND to FALSE:
if ((this->Makefile->IsDefinitionSet(foundVar)) &&
(this->Makefile->IsOn(foundVar) == false)) {
if (this->Makefile->IsDefinitionSet(foundVar) &&
!this->Makefile->IsOn(foundVar)) {
// we get here if the Config file has set Foo_FOUND actively to FALSE
found = false;
configFileSetFOUNDFalse = true;
......@@ -1416,8 +1416,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for foo-config-version.cmake
std::string version_file = version_file_base;
version_file += "-version.cmake";
if ((haveResult == false) &&
(cmSystemTools::FileExists(version_file.c_str(), true))) {
if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
result = this->CheckVersionFile(version_file, version);
haveResult = true;
}
......@@ -1425,14 +1424,13 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
// Look for fooConfigVersion.cmake
version_file = version_file_base;
version_file += "Version.cmake";
if ((haveResult == false) &&
(cmSystemTools::FileExists(version_file.c_str(), true))) {
if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
result = this->CheckVersionFile(version_file, version);
haveResult = true;
}
// If no version was requested a versionless package is acceptable.
if ((haveResult == false) && (this->Version.empty())) {
if (!haveResult && this->Version.empty()) {
result = true;
}
......
......@@ -206,7 +206,7 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
} else if (type == IntelHex) {
success = ConvertIntelHexLine(buf, outFile);
}
if (success == false) {
if (!success) {
break;
}
}
......
......@@ -64,7 +64,7 @@ public:
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE
{
return this->info.FinalPass ? true : false;
return this->info.FinalPass != CM_NULLPTR;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment