mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 20:00:51 -05:00
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.
This commit is contained in:
@@ -270,8 +270,8 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
|
|||||||
yet its linker language. */
|
yet its linker language. */
|
||||||
if ((type == cmStateEnums::SHARED_LIBRARY ||
|
if ((type == cmStateEnums::SHARED_LIBRARY ||
|
||||||
type == cmStateEnums::MODULE_LIBRARY) &&
|
type == cmStateEnums::MODULE_LIBRARY) &&
|
||||||
(this->Makefile->GetState()->GetGlobalPropertyAsBool(
|
!this->Makefile->GetState()->GetGlobalPropertyAsBool(
|
||||||
"TARGET_SUPPORTS_SHARED_LIBS") == false)) {
|
"TARGET_SUPPORTS_SHARED_LIBS")) {
|
||||||
std::ostringstream w;
|
std::ostringstream w;
|
||||||
w << "ADD_LIBRARY called with "
|
w << "ADD_LIBRARY called with "
|
||||||
<< (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
|
<< (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE")
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ bool cmConditionEvaluator::GetBooleanValue(
|
|||||||
double d = strtod(arg.c_str(), &end);
|
double d = strtod(arg.c_str(), &end);
|
||||||
if (*end == '\0') {
|
if (*end == '\0') {
|
||||||
// The whole string is a number. Use C conversion to bool.
|
// 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()) {
|
if (this->IsKeyword(keyCOMMAND, *arg) && argP1 != newArgs.end()) {
|
||||||
cmCommand* command =
|
cmCommand* command =
|
||||||
this->Makefile.GetState()->GetCommand(argP1->c_str());
|
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);
|
argP1, argP2);
|
||||||
}
|
}
|
||||||
// does a policy exist
|
// does a policy exist
|
||||||
@@ -456,7 +456,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
|
|||||||
// does a target exist
|
// does a target exist
|
||||||
if (this->IsKeyword(keyTARGET, *arg) && argP1 != newArgs.end()) {
|
if (this->IsKeyword(keyTARGET, *arg) && argP1 != newArgs.end()) {
|
||||||
this->HandlePredicate(
|
this->HandlePredicate(
|
||||||
this->Makefile.FindTargetToUse(argP1->GetValue()) ? true : false,
|
this->Makefile.FindTargetToUse(argP1->GetValue()) != CM_NULLPTR,
|
||||||
reducible, arg, newArgs, argP1, argP2);
|
reducible, arg, newArgs, argP1, argP2);
|
||||||
}
|
}
|
||||||
// does a test exist
|
// does a test exist
|
||||||
@@ -464,7 +464,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
|
|||||||
this->Policy64Status != cmPolicies::WARN) {
|
this->Policy64Status != cmPolicies::WARN) {
|
||||||
if (this->IsKeyword(keyTEST, *arg) && argP1 != newArgs.end()) {
|
if (this->IsKeyword(keyTEST, *arg) && argP1 != newArgs.end()) {
|
||||||
const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str());
|
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);
|
newArgs, argP1, argP2);
|
||||||
}
|
}
|
||||||
} else if (this->Policy64Status == cmPolicies::WARN &&
|
} else if (this->Policy64Status == cmPolicies::WARN &&
|
||||||
@@ -638,8 +638,8 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
|
|||||||
bool success = cmSystemTools::FileTimeCompare(
|
bool success = cmSystemTools::FileTimeCompare(
|
||||||
arg->GetValue(), (argP2)->GetValue(), &fileIsNewer);
|
arg->GetValue(), (argP2)->GetValue(), &fileIsNewer);
|
||||||
this->HandleBinaryOp(
|
this->HandleBinaryOp(
|
||||||
(success == false || fileIsNewer == 1 || fileIsNewer == 0),
|
(!success || fileIsNewer == 1 || fileIsNewer == 0), reducible, arg,
|
||||||
reducible, arg, newArgs, argP1, argP2);
|
newArgs, argP1, argP2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
|
if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
|
||||||
|
|||||||
@@ -2449,18 +2449,14 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~cURLEasyGuard(void)
|
~cURLEasyGuard()
|
||||||
{
|
{
|
||||||
if (this->Easy) {
|
if (this->Easy) {
|
||||||
::curl_easy_cleanup(this->Easy);
|
::curl_easy_cleanup(this->Easy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void release(void)
|
void release() { this->Easy = CM_NULLPTR; }
|
||||||
{
|
|
||||||
this->Easy = CM_NULLPTR;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
::CURL* Easy;
|
::CURL* Easy;
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ bool cmFindBase::CheckForVariableInCache()
|
|||||||
cmState* state = this->Makefile->GetState();
|
cmState* state = this->Makefile->GetState();
|
||||||
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
|
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
|
||||||
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
|
||||||
bool cached = cacheEntry ? true : false;
|
bool cached = cacheEntry != CM_NULLPTR;
|
||||||
if (found) {
|
if (found) {
|
||||||
// If the user specifies the entry on the command line without a
|
// If the user specifies the entry on the command line without a
|
||||||
// type we should add the type and docstring but keep the
|
// type we should add the type and docstring but keep the
|
||||||
|
|||||||
@@ -673,8 +673,8 @@ bool cmFindPackageCommand::HandlePackageMode()
|
|||||||
bool configFileSetFOUNDFalse = false;
|
bool configFileSetFOUNDFalse = false;
|
||||||
|
|
||||||
if (fileFound) {
|
if (fileFound) {
|
||||||
if ((this->Makefile->IsDefinitionSet(foundVar)) &&
|
if (this->Makefile->IsDefinitionSet(foundVar) &&
|
||||||
(this->Makefile->IsOn(foundVar) == false)) {
|
!this->Makefile->IsOn(foundVar)) {
|
||||||
// by removing Foo_FOUND here if it is FALSE, we don't really change
|
// 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,
|
// 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
|
// but we make it possible to detect later on whether the Config file
|
||||||
@@ -693,8 +693,8 @@ bool cmFindPackageCommand::HandlePackageMode()
|
|||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
// Check whether the Config file has set Foo_FOUND to FALSE:
|
// Check whether the Config file has set Foo_FOUND to FALSE:
|
||||||
if ((this->Makefile->IsDefinitionSet(foundVar)) &&
|
if (this->Makefile->IsDefinitionSet(foundVar) &&
|
||||||
(this->Makefile->IsOn(foundVar) == false)) {
|
!this->Makefile->IsOn(foundVar)) {
|
||||||
// we get here if the Config file has set Foo_FOUND actively to FALSE
|
// we get here if the Config file has set Foo_FOUND actively to FALSE
|
||||||
found = false;
|
found = false;
|
||||||
configFileSetFOUNDFalse = true;
|
configFileSetFOUNDFalse = true;
|
||||||
@@ -1416,8 +1416,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
|
|||||||
// Look for foo-config-version.cmake
|
// Look for foo-config-version.cmake
|
||||||
std::string version_file = version_file_base;
|
std::string version_file = version_file_base;
|
||||||
version_file += "-version.cmake";
|
version_file += "-version.cmake";
|
||||||
if ((haveResult == false) &&
|
if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
|
||||||
(cmSystemTools::FileExists(version_file.c_str(), true))) {
|
|
||||||
result = this->CheckVersionFile(version_file, version);
|
result = this->CheckVersionFile(version_file, version);
|
||||||
haveResult = true;
|
haveResult = true;
|
||||||
}
|
}
|
||||||
@@ -1425,14 +1424,13 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file)
|
|||||||
// Look for fooConfigVersion.cmake
|
// Look for fooConfigVersion.cmake
|
||||||
version_file = version_file_base;
|
version_file = version_file_base;
|
||||||
version_file += "Version.cmake";
|
version_file += "Version.cmake";
|
||||||
if ((haveResult == false) &&
|
if (!haveResult && cmSystemTools::FileExists(version_file.c_str(), true)) {
|
||||||
(cmSystemTools::FileExists(version_file.c_str(), true))) {
|
|
||||||
result = this->CheckVersionFile(version_file, version);
|
result = this->CheckVersionFile(version_file, version);
|
||||||
haveResult = true;
|
haveResult = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no version was requested a versionless package is acceptable.
|
// If no version was requested a versionless package is acceptable.
|
||||||
if ((haveResult == false) && (this->Version.empty())) {
|
if (!haveResult && this->Version.empty()) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ bool cmHexFileConverter::TryConvert(const char* inFileName,
|
|||||||
} else if (type == IntelHex) {
|
} else if (type == IntelHex) {
|
||||||
success = ConvertIntelHexLine(buf, outFile);
|
success = ConvertIntelHexLine(buf, outFile);
|
||||||
}
|
}
|
||||||
if (success == false) {
|
if (!success) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
void FinalPass() CM_OVERRIDE;
|
void FinalPass() CM_OVERRIDE;
|
||||||
bool HasFinalPass() const CM_OVERRIDE
|
bool HasFinalPass() const CM_OVERRIDE
|
||||||
{
|
{
|
||||||
return this->info.FinalPass ? true : false;
|
return this->info.FinalPass != CM_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user