From 58da4aa47df7d12c54c2d3f26722eca5dd8ee10f Mon Sep 17 00:00:00 2001 From: Vitaly Stakhovsky <vvs31415@users.noreply.gitlab.com> Date: Tue, 27 Aug 2024 09:30:00 -0400 Subject: Source: Avoid comparing pointers to nullptr --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/cmCPackArchiveGenerator.cxx | 6 ++-- Source/CPack/cmCPackDebGenerator.cxx | 4 +-- Source/CPack/cmCPackGenerator.cxx | 8 +++--- Source/CPack/cmCPackInnoSetupGenerator.cxx | 8 +++--- Source/CPack/cmCPackNSISGenerator.cxx | 2 +- Source/CPack/cmCPackNuGetGenerator.cxx | 2 +- Source/CPack/cmCPackPKGGenerator.cxx | 24 ++++++++-------- Source/CPack/cmCPackRPMGenerator.cxx | 8 +++--- Source/CTest/cmCTestCoverageHandler.cxx | 2 +- Source/CTest/cmCTestMemCheckHandler.cxx | 6 ++-- Source/CursesDialog/ccmake.cxx | 2 +- Source/CursesDialog/cmCursesForm.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 4 +-- Source/cmArgumentParser.cxx | 4 +-- Source/cmBinUtilsMacOSMachOLinker.cxx | 4 +-- Source/cmCMakePath.h | 3 +- Source/cmCMakePresetsErrors.cxx | 2 +- Source/cmCMakePresetsGraph.cxx | 6 ++-- Source/cmCTest.cxx | 5 ++-- Source/cmComputeLinkDepends.cxx | 14 +++++----- Source/cmComputeLinkInformation.cxx | 17 +++++------- Source/cmComputeLinkInformation.h | 2 +- Source/cmCryptoHash.cxx | 2 +- Source/cmDebuggerVariables.cxx | 4 +-- Source/cmDebuggerVariables.h | 2 +- Source/cmDebuggerVariablesHelper.cxx | 15 +++++----- Source/cmDepends.cxx | 4 +-- Source/cmDependsC.cxx | 4 +-- Source/cmDependsCompiler.cxx | 2 +- Source/cmDependsJavaParserHelper.cxx | 2 +- Source/cmExportCommand.cxx | 6 ++-- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmFindBase.cxx | 3 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmFindProgramCommand.cxx | 2 +- Source/cmGeneratorExpression.h | 2 +- Source/cmGeneratorTarget.cxx | 7 ++--- Source/cmGeneratorTarget_CompatibleInterface.cxx | 6 ++-- Source/cmGeneratorTarget_IncludeDirectories.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 2 +- Source/cmGraphVizWriter.cxx | 4 +-- Source/cmHexFileConverter.cxx | 12 ++++---- Source/cmInstallCommandArguments.cxx | 20 ++++++------- Source/cmLinkItemGraphVisitor.cxx | 6 ++-- Source/cmLinkLineDeviceComputer.cxx | 2 +- Source/cmList.cxx | 2 +- Source/cmLoadCommandCommand.cxx | 4 +-- Source/cmLocalGenerator.cxx | 6 ++-- Source/cmLocalVisualStudio7Generator.cxx | 6 ++-- Source/cmMakefile.cxx | 34 +++++++++++------------ Source/cmMessageCommand.cxx | 2 +- Source/cmMessenger.cxx | 2 +- Source/cmOutputRequiredFilesCommand.cxx | 2 +- Source/cmQtAutoGenGlobalInitializer.cxx | 6 ++-- Source/cmQtAutoGenInitializer.cxx | 2 +- Source/cmQtAutoGenerator.cxx | 12 ++++---- Source/cmQtAutoMocUic.cxx | 30 ++++++++++---------- Source/cmSearchPath.cxx | 10 +++---- Source/cmSourceFile.cxx | 2 +- Source/cmString.cxx | 2 +- Source/cmStringReplaceHelper.cxx | 2 +- Source/cmSystemTools.cxx | 8 +++--- Source/cmTimestamp.cxx | 2 +- Source/cmVSSetupHelper.cxx | 16 +++++------ Source/cmVSSetupHelper.h | 10 +++---- Source/cmValue.cxx | 10 +++---- Source/cmValue.h | 29 +++++++++---------- Source/cmVisualStudio10TargetGenerator.cxx | 8 +++--- Source/cmWorkerPool.cxx | 15 +++++----- Source/cmake.cxx | 4 +-- 75 files changed, 235 insertions(+), 249 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 8532b3e..1e2d202 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -754,7 +754,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( { for (auto const& i : ComponentGroups) { cmCPackComponentGroup const& group = i.second; - if (group.ParentGroup == nullptr) { + if (!group.ParentGroup) { featureDefinitions.EmitFeatureForComponentGroup(group, *this->Patch); } } diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 8bd3aa0..c70a2f1 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -259,11 +259,11 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( std::string rp = filePrefix + file; DeduplicateStatus status = DeduplicateStatus::Add; - if (deduplicator != nullptr) { + if (deduplicator) { status = deduplicator->IsDeduplicate(rp, localToplevel); } - if (deduplicator == nullptr || status == DeduplicateStatus::Add) { + if (!deduplicator || status == DeduplicateStatus::Add) { cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl); archive.Add(rp, 0, nullptr, false); } else if (status == DeduplicateStatus::Error) { @@ -350,7 +350,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) // Handle Orphan components (components not belonging to any groups) for (auto& comp : this->Components) { // Does the component belong to a group? - if (comp.second.Group == nullptr) { + if (!comp.second.Group) { cmCPackLogger( cmCPackLog::LOG_VERBOSE, "Component <" diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index d721cf1..14346b4 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -598,7 +598,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) // Handle Orphan components (components not belonging to any groups) for (auto const& comp : this->Components) { // Does the component belong to a group? - if (comp.second.Group == nullptr) { + if (!comp.second.Group) { cmCPackLogger( cmCPackLog::LOG_VERBOSE, "Component <" @@ -928,7 +928,7 @@ std::string cmCPackDebGenerator::GetComponentInstallSuffix( // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (nullptr != this->GetOption(groupVar)) { + if (this->GetOption(groupVar)) { return *this->GetOption(groupVar); } return componentName; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b025570..44d0ece 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -967,7 +967,7 @@ int cmCPackGenerator::InstallCMakeProject( std::string absoluteDestFileComponent = std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + this->GetComponentInstallSuffix(component); - if (nullptr != this->GetOption(absoluteDestFileComponent)) { + if (this->GetOption(absoluteDestFileComponent)) { std::string absoluteDestFilesListComponent = cmStrCat(this->GetOption(absoluteDestFileComponent), ';', *d); this->SetOption(absoluteDestFileComponent, @@ -1266,7 +1266,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) if (val1 != val2) { // One variable is set but not the other? // Then set the other variable to the same value (even if it is invalid). - if (val1.Get() != nullptr && val2.Get() == nullptr) { + if (val1.Get() && !val2.Get()) { cmCPackLogger(cmCPackLog::LOG_WARNING, "Variable CPACK_TEMPORARY_INSTALL_DIRECTORY is set, which " "is not recommended. For backwards-compatibility we will " @@ -1274,7 +1274,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) "proceed. However, better set neither of them!" << std::endl); this->MakefileMap->AddDefinition("CPACK_TEMPORARY_DIRECTORY", val1); - } else if (val1.Get() == nullptr && val2.Get() != nullptr) { + } else if (!val1.Get() && val2.Get()) { cmCPackLogger( cmCPackLog::LOG_WARNING, "Variable CPACK_TEMPORARY_DIRECTORY is set, which is not recommended." @@ -1301,7 +1301,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) << std::endl); return 0; } - } else if (val1.Get() != nullptr && val2.Get() != nullptr) { + } else if (val1.Get() && val2.Get()) { cmCPackLogger(cmCPackLog::LOG_WARNING, "Variables CPACK_TEMPORARY_DIRECTORY and " "CPACK_TEMPORARY_INSTALL_DIRECTORY are both set. Because " diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx index 17ea89f..35d126f 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.cxx +++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx @@ -423,7 +423,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() params["DestDir"] = QuotePath(destDir); - if (component != nullptr && component->IsDownloaded) { + if (component && component->IsDownloaded) { const std::string& archiveName = cmSystemTools::GetFilenameWithoutLastExtension( component->ArchiveFile); @@ -968,7 +968,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive( } // Try to get the SHA256 hash of the archive file - if (hash == nullptr) { + if (!hash) { return true; } @@ -1088,7 +1088,7 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine( std::string cmCPackInnoSetupGenerator::CreateRecursiveComponentPath( cmCPackComponentGroup* group, const std::string& path) { - if (group == nullptr) { + if (!group) { return path; } @@ -1100,7 +1100,7 @@ std::string cmCPackInnoSetupGenerator::CreateRecursiveComponentPath( void cmCPackInnoSetupGenerator::CreateRecursiveComponentGroups( cmCPackComponentGroup* group) { - if (group == nullptr) { + if (!group) { return; } diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 155bc9e..53871ee 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -304,7 +304,7 @@ int cmCPackNSISGenerator::PackageFiles() // Create installation groups first for (auto& group : this->ComponentGroups) { - if (group.second.ParentGroup == nullptr) { + if (!group.second.ParentGroup) { componentCode += this->CreateComponentGroupDescription(&group.second, macrosOut); } diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx index aa99fb6..196aaf1 100644 --- a/Source/CPack/cmCPackNuGetGenerator.cxx +++ b/Source/CPack/cmCPackNuGetGenerator.cxx @@ -92,7 +92,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup) std::vector<std::string> components; for (auto const& comp : this->Components) { // Does the component belong to a group? - if (comp.second.Group == nullptr) { + if (!comp.second.Group) { cmCPackLogger( cmCPackLog::LOG_VERBOSE, "Component <" diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index a64093e..6208195 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -54,10 +54,10 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, cmXMLWriter& xout) { std::string paramSuffix = - (themeName == nullptr) ? "" : cmSystemTools::UpperCase(themeName); - std::string opt = (themeName == nullptr) - ? cmStrCat("CPACK_", genName, "_BACKGROUND") - : cmStrCat("CPACK_", genName, "_BACKGROUND_", paramSuffix); + themeName ? cmSystemTools::UpperCase(themeName) : ""; + std::string opt = themeName + ? cmStrCat("CPACK_", genName, "_BACKGROUND_", paramSuffix) + : cmStrCat("CPACK_", genName, "_BACKGROUND"); cmValue bgFileName = this->GetOption(opt); if (!bgFileName) { return; @@ -73,21 +73,21 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, return; } - if (themeName == nullptr) { - xout.StartElement("background"); - } else { + if (themeName) { xout.StartElement(cmStrCat("background-", themeName)); + } else { + xout.StartElement("background"); } xout.Attribute("file", *bgFileName); cmValue param = this->GetOption(cmStrCat(opt, "_ALIGNMENT")); - if (param != nullptr) { + if (param) { xout.Attribute("alignment", *param); } param = this->GetOption(cmStrCat(opt, "_SCALING")); - if (param != nullptr) { + if (param) { xout.Attribute("scaling", *param); } @@ -95,12 +95,12 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, // attribute for the background, but I've seen examples that // doesn't have them, so don't make them mandatory. param = this->GetOption(cmStrCat(opt, "_MIME_TYPE")); - if (param != nullptr) { + if (param) { xout.Attribute("mime-type", *param); } param = this->GetOption(cmStrCat(opt, "_UTI")); - if (param != nullptr) { + if (param) { xout.Attribute("uti", *param); } @@ -152,7 +152,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile, // Emit the outline for the groups for (auto const& group : this->ComponentGroups) { - if (group.second.ParentGroup == nullptr) { + if (!group.second.ParentGroup) { CreateChoiceOutline(group.second, xChoiceOut); } } diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 8dfb159..a4f4dac 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -171,7 +171,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) for (compIt = this->Components.begin(); compIt != this->Components.end(); ++compIt) { // Does the component belong to a group? - if (compIt->second.Group == nullptr) { + if (!compIt->second.Group) { std::string component(compIt->first); std::transform(component.begin(), component.end(), component.begin(), ::toupper); @@ -237,7 +237,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) for (compIt = this->Components.begin(); compIt != this->Components.end(); ++compIt) { // Does the component belong to a group? - if (compIt->second.Group == nullptr) { + if (!compIt->second.Group) { std::string component(compIt->first); std::transform(component.begin(), component.end(), component.begin(), ::toupper); @@ -325,7 +325,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) for (compIt = this->Components.begin(); compIt != this->Components.end(); ++compIt) { // Does the component belong to a group? - if (compIt->second.Group == nullptr) { + if (!compIt->second.Group) { cmCPackLogger( cmCPackLog::LOG_VERBOSE, "Component <" @@ -458,7 +458,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallSuffix( // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (nullptr != this->GetOption(groupVar)) { + if (this->GetOption(groupVar)) { return *this->GetOption(groupVar); } return componentName; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f9f9add..cec4a7e 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1819,7 +1819,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( covLogXML.StartElement("Report"); // write the bullseye header line = 0; - for (int k = 0; bullseyeHelp[k] != nullptr; ++k) { + for (int k = 0; bullseyeHelp[k]; ++k) { covLogXML.StartElement("Line"); covLogXML.Attribute("Number", line); covLogXML.Attribute("Count", -1); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index b1afdc0..8596ffa 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -68,7 +68,7 @@ public: std::ostringstream ostr; ostr << name << ":\n"; int i = 0; - for (; atts[i] != nullptr; i += 2) { + for (; atts[i]; i += 2) { ostr << " " << atts[i] << " - " << atts[i + 1] << "\n"; } ostr << "\n"; @@ -79,7 +79,7 @@ public: const char* GetAttribute(const char* name, const char** atts) { int i = 0; - for (; atts[i] != nullptr; ++i) { + for (; atts[i]; ++i) { if (strcmp(name, atts[i]) == 0) { return atts[i + 1]; } @@ -282,7 +282,7 @@ void cmCTestMemCheckHandler::InitializeResultsVectors() nullptr }; this->GlobalResults.clear(); - for (int i = 0; cmCTestMemCheckResultStrings[i] != nullptr; ++i) { + for (int i = 0; cmCTestMemCheckResultStrings[i]; ++i) { this->ResultStrings.emplace_back(cmCTestMemCheckResultStrings[i]); this->ResultStringsLong.emplace_back(cmCTestMemCheckResultLongStrings[i]); this->GlobalResults.push_back(0); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 18c1a80..bc21cd0 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -115,7 +115,7 @@ int main(int argc, char const* const* argv) cmCursesForm::DebugStart(); } - if (initscr() == nullptr) { + if (!initscr()) { fprintf(stderr, "Error: ncurses initialization failed\n"); exit(1); } diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx index ef36b45..900fbca 100644 --- a/Source/CursesDialog/cmCursesForm.cxx +++ b/Source/CursesDialog/cmCursesForm.cxx @@ -52,7 +52,7 @@ void cmCursesForm::LogMessage(const char* msg) void cmCursesForm::HandleResize() { endwin(); - if (initscr() == nullptr) { + if (!initscr()) { static const char errmsg[] = "Error: ncurses initialization failed\n"; #ifdef _WIN32 fprintf(stderr, "%s", errmsg); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 72460f3..81bf0b3 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -307,7 +307,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) } char fmt_s[] = "%s"; - if (cw == nullptr || !cw->PrintKeys()) { + if (!cw || !cw->PrintKeys()) { char firstLine[512] = ""; char secondLine[512] = ""; char thirdLine[512] = ""; @@ -605,7 +605,7 @@ void cmCursesMainForm::RemoveEntry(const char* value) std::find_if(this->Entries.begin(), this->Entries.end(), [value](cmCursesCacheEntryComposite& entry) -> bool { const char* val = entry.GetValue(); - return val != nullptr && !strcmp(value, val); + return val && !strcmp(value, val); }); if (removeIt != this->Entries.end()) { diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx index ad57a88..22dd308 100644 --- a/Source/cmArgumentParser.cxx +++ b/Source/cmArgumentParser.cxx @@ -167,7 +167,7 @@ void Instance::Consume(std::size_t pos, cm::string_view arg) } } - if (this->UnparsedArguments != nullptr) { + if (this->UnparsedArguments) { this->UnparsedArguments->emplace_back(arg); } } @@ -178,7 +178,7 @@ void Instance::FinishKeyword() return; } if (this->KeywordValuesSeen < this->KeywordValuesExpected) { - if (this->ParseResults != nullptr) { + if (this->ParseResults) { this->ParseResults->AddKeywordError(this->Keyword, " missing required value\n"); } diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index 7db7cb0..082f348 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -87,7 +87,7 @@ bool cmBinUtilsMacOSMachOLinker::ScanDependencies( executablePath = cmSystemTools::GetFilenamePath(executableFile); } const FileInfo* file_info = this->GetFileInfo(file); - if (file_info == nullptr) { + if (!file_info) { return false; } return this->ScanDependencies(file, file_info->libs, file_info->rpaths, @@ -120,7 +120,7 @@ bool cmBinUtilsMacOSMachOLinker::GetFileDependencies( auto filename = cmSystemTools::GetFilenameName(path); bool unique; const FileInfo* dep_file_info = this->GetFileInfo(path); - if (dep_file_info == nullptr) { + if (!dep_file_info) { return false; } diff --git a/Source/cmCMakePath.h b/Source/cmCMakePath.h index a42ac98..fd71c1f 100644 --- a/Source/cmCMakePath.h +++ b/Source/cmCMakePath.h @@ -749,8 +749,7 @@ inline cmCMakePath::iterator cmCMakePath::end() const inline bool operator==(const cmCMakePath::iterator& lhs, const cmCMakePath::iterator& rhs) { - return lhs.Path == rhs.Path && lhs.Path != nullptr && - lhs.Iterator == rhs.Iterator; + return lhs.Path == rhs.Path && lhs.Path && lhs.Iterator == rhs.Iterator; } inline bool operator!=(const cmCMakePath::iterator& lhs, diff --git a/Source/cmCMakePresetsErrors.cxx b/Source/cmCMakePresetsErrors.cxx index ab0afed..668476a 100644 --- a/Source/cmCMakePresetsErrors.cxx +++ b/Source/cmCMakePresetsErrors.cxx @@ -31,7 +31,7 @@ const Json::Value* getPreset(cmJSONState* state) std::string getPresetName(cmJSONState* state) { const Json::Value* preset = getPreset(state); - if (preset != nullptr && preset->isMember("name")) { + if (preset && preset->isMember("name")) { return preset->operator[]("name").asString(); } return ""; diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 189f101..b395276 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -1202,12 +1202,12 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) const ConfigurePreset* configurePreset = nullptr; for (auto const& step : it.second.Unexpanded.Steps) { - if (configurePreset == nullptr && step.PresetType != Type::Configure) { + if (!configurePreset && step.PresetType != Type::Configure) { cmCMakePresetsErrors::FIRST_WORKFLOW_STEP_NOT_CONFIGURE( step.PresetName, &this->parseState); return false; } - if (configurePreset != nullptr && step.PresetType == Type::Configure) { + if (configurePreset && step.PresetType == Type::Configure) { cmCMakePresetsErrors::CONFIGURE_WORKFLOW_STEP_NOT_FIRST( step.PresetName, &this->parseState); return false; @@ -1240,7 +1240,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) } } - if (configurePreset == nullptr) { + if (!configurePreset) { cmCMakePresetsErrors::NO_WORKFLOW_STEPS(it.first, &this->parseState); return false; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7d51dd1..f6f6553 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -538,8 +538,7 @@ int cmCTest::Initialize(const std::string& binary_dir, } tfin.close(); } - if (tag.empty() || (nullptr != command) || - this->Impl->Parts[PartStart]) { + if (tag.empty() || command || this->Impl->Parts[PartStart]) { cmCTestOptionalLog( this, DEBUG, "TestModel: " << this->GetTestModelString() << std::endl, quiet); @@ -573,7 +572,7 @@ int cmCTest::Initialize(const std::string& binary_dir, } } ofs.close(); - if (nullptr == command) { + if (!command) { cmCTestOptionalLog(this, OUTPUT, "Create new tag: " << tag << " - " << this->GetTestModelString() diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 1937674..0583aba 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -475,7 +475,7 @@ public: } // expand groups - if (this->Groups != nullptr) { + if (this->Groups) { for (const auto& group : *this->Groups) { const LinkEntry& groupEntry = this->Entries[group.first]; auto it = this->FinalEntries.begin(); @@ -518,7 +518,7 @@ private: if (entry.Feature != cmComputeLinkDepends::LinkEntry::DEFAULT) { auto const& featureAttributes = GetLinkLibraryFeatureAttributes( this->Target->Makefile, this->LinkLanguage, entry.Feature); - if ((entry.Target == nullptr || + if ((!entry.Target || featureAttributes.LibraryTypes.find(entry.Target->GetType()) != featureAttributes.LibraryTypes.end()) && featureAttributes.Deduplication != @@ -530,7 +530,7 @@ private: return this->Deduplication == None || (this->Deduplication == Shared && - (entry.Target == nullptr || + (!entry.Target || entry.Target->GetType() != cmStateEnums::SHARED_LIBRARY)) || (this->Deduplication == All && entry.Kind != LinkEntry::Library); } @@ -1032,7 +1032,7 @@ void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, if (item.Feature != LinkEntry::DEFAULT && depender_index != cmComputeComponentGraph::INVALID_COMPONENT) { const auto& depender = this->EntryList[depender_index]; - if (depender.Target != nullptr && depender.Target->IsImported() && + if (depender.Target && depender.Target->IsImported() && !IsFeatureSupported(this->Makefile, this->LinkLanguage, item.Feature)) { this->CMakeInstance->IssueMessage( @@ -1085,7 +1085,7 @@ void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, inGroup) { const auto& depender = this->EntryList[depender_index]; const auto& groupFeature = this->EntryList[groupIndex.first].Feature; - if (depender.Target != nullptr && depender.Target->IsImported() && + if (depender.Target && depender.Target->IsImported() && !IsGroupFeatureSupported(this->Makefile, this->LinkLanguage, groupFeature)) { this->CMakeInstance->IssueMessage( @@ -1110,7 +1110,7 @@ void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, bool supportedItem = true; auto const& itemFeature = this->GetCurrentFeature(entry.Item.Value, item.Feature); - if (inGroup && ale.second && entry.Target != nullptr && + if (inGroup && ale.second && entry.Target && (entry.Target->GetType() == cmStateEnums::TargetType::OBJECT_LIBRARY || entry.Target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY)) { @@ -1130,7 +1130,7 @@ void cmComputeLinkDepends::AddLinkEntries(size_t depender_index, this->Target->GetBacktrace()); } // check if feature is applicable to this item - if (itemFeature != LinkEntry::DEFAULT && entry.Target != nullptr) { + if (itemFeature != LinkEntry::DEFAULT && entry.Target) { auto const& featureAttributes = GetLinkLibraryFeatureAttributes( this->Makefile, this->LinkLanguage, itemFeature); if (featureAttributes.LibraryTypes.find(entry.Target->GetType()) == diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b631610..dd194ed 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -578,8 +578,7 @@ bool cmComputeLinkInformation::Compute() if (linkEntry.Kind == cmComputeLinkDepends::LinkEntry::Group) { const auto& groupFeature = this->GetGroupFeature(linkEntry.Feature); if (groupFeature.Supported) { - if (linkEntry.Item.Value == "</LINK_GROUP>" && - currentFeature != nullptr) { + if (linkEntry.Item.Value == "</LINK_GROUP>" && currentFeature) { // emit feature suffix, if any if (!currentFeature->Suffix.empty()) { this->Items.emplace_back( @@ -599,8 +598,7 @@ bool cmComputeLinkInformation::Compute() continue; } - if (currentFeature != nullptr && - linkEntry.Feature != currentFeature->Name) { + if (currentFeature && linkEntry.Feature != currentFeature->Name) { // emit feature suffix, if any if (!currentFeature->Suffix.empty()) { this->Items.emplace_back( @@ -612,8 +610,7 @@ bool cmComputeLinkInformation::Compute() } if (linkEntry.Feature != DEFAULT && - (currentFeature == nullptr || - linkEntry.Feature != currentFeature->Name)) { + (!currentFeature || linkEntry.Feature != currentFeature->Name)) { if (!this->AddLibraryFeature(linkEntry.Feature)) { continue; } @@ -633,7 +630,7 @@ bool cmComputeLinkInformation::Compute() } } - if (currentFeature != nullptr) { + if (currentFeature) { // emit feature suffix, if any if (!currentFeature->Suffix.empty()) { this->Items.emplace_back( @@ -738,13 +735,13 @@ public: private: std::string ExpandVariable(std::string const& variable) override { - if (this->Library != nullptr && variable == "LIBRARY") { + if (this->Library && variable == "LIBRARY") { return *this->Library; } - if (this->LibItem != nullptr && variable == "LIB_ITEM") { + if (this->LibItem && variable == "LIB_ITEM") { return *this->LibItem; } - if (this->LinkItem != nullptr && variable == "LINK_ITEM") { + if (this->LinkItem && variable == "LINK_ITEM") { return *this->LinkItem; } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 2a06530..97db90d 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -77,7 +77,7 @@ public: BT<std::string> GetFormattedItem(std::string const& path) const { - return { (this->Feature != nullptr) + return { this->Feature ? this->Feature->GetDecoratedItem(path, this->IsPath) : path, Value.Backtrace }; diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 55e3a5b..1b5c3a1 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -79,7 +79,7 @@ std::unique_ptr<cmCryptoHash> cmCryptoHash::New(cm::string_view algo) if (algo == "SHA3_512") { return cm::make_unique<cmCryptoHash>(AlgoSHA3_512); } - return std::unique_ptr<cmCryptoHash>(nullptr); + return std::unique_ptr<cmCryptoHash>(); } std::string cmCryptoHash::GetHashAlgoName() const diff --git a/Source/cmDebuggerVariables.cxx b/Source/cmDebuggerVariables.cxx index 8acce34..8e3c2be 100644 --- a/Source/cmDebuggerVariables.cxx +++ b/Source/cmDebuggerVariables.cxx @@ -62,7 +62,7 @@ cmDebuggerVariables::cmDebuggerVariables( void cmDebuggerVariables::AddSubVariables( std::shared_ptr<cmDebuggerVariables> const& variables) { - if (variables != nullptr) { + if (variables) { SubVariables.emplace_back(variables); } } @@ -71,7 +71,7 @@ dap::array<dap::Variable> cmDebuggerVariables::HandleVariablesRequest() { dap::array<dap::Variable> variables; - if (GetKeyValuesFunction != nullptr) { + if (GetKeyValuesFunction) { auto values = GetKeyValuesFunction(); for (auto const& entry : values) { if (IgnoreEmptyStringEntries && entry.Type == "string" && diff --git a/Source/cmDebuggerVariables.h b/Source/cmDebuggerVariables.h index eaaf2a8..753b811 100644 --- a/Source/cmDebuggerVariables.h +++ b/Source/cmDebuggerVariables.h @@ -45,7 +45,7 @@ struct cmDebuggerVariableEntry } cmDebuggerVariableEntry(std::string name, const char* value) : Name(std::move(name)) - , Value(value == nullptr ? "" : value) + , Value(value ? value : "") , Type("string") { } diff --git a/Source/cmDebuggerVariablesHelper.cxx b/Source/cmDebuggerVariablesHelper.cxx index 73f9111..6880eab 100644 --- a/Source/cmDebuggerVariablesHelper.cxx +++ b/Source/cmDebuggerVariablesHelper.cxx @@ -193,7 +193,7 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny( std::shared_ptr<cmDebuggerVariablesManager> const& variablesManager, std::string const& name, bool supportsVariableType, cmFileSet* fileSet) { - if (fileSet == nullptr) { + if (!fileSet) { return {}; } @@ -471,7 +471,7 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny( std::shared_ptr<cmDebuggerVariablesManager> const& variablesManager, std::string const& name, bool supportsVariableType, cmTest* test) { - if (test == nullptr) { + if (!test) { return {}; } @@ -519,7 +519,7 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny( std::shared_ptr<cmDebuggerVariablesManager> const& variablesManager, std::string const& name, bool supportsVariableType, cmMakefile* mf) { - if (mf == nullptr) { + if (!mf) { return {}; } @@ -575,7 +575,7 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny( std::shared_ptr<cmDebuggerVariablesManager> const& variablesManager, std::string const& name, bool supportsVariableType, cmGlobalGenerator* gen) { - if (gen == nullptr) { + if (!gen) { return {}; } @@ -624,10 +624,9 @@ std::shared_ptr<cmDebuggerVariables> cmDebuggerVariablesHelper::CreateIfAny( return ret; }); - if (gen->GetInstallComponents() != nullptr) { - variables->AddSubVariables( - CreateIfAny(variablesManager, "InstallComponents", supportsVariableType, - *gen->GetInstallComponents())); + if (const auto* ic = gen->GetInstallComponents()) { + variables->AddSubVariables(CreateIfAny( + variablesManager, "InstallComponents", supportsVariableType, *ic)); } variables->SetIgnoreEmptyStringEntries(true); diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 04bccce..34f67d0 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -154,7 +154,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, dependee = line.substr(1); // Add dependee to depender's list - if (currentDependencies != nullptr) { + if (currentDependencies) { currentDependencies->push_back(dependee); } @@ -210,7 +210,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, // Remove the information of this depender from the map, it needs // to be rescanned - if (currentDependencies != nullptr) { + if (currentDependencies) { validDeps.erase(depender); currentDependencies = nullptr; } diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 408a85b..a39bb37 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -96,7 +96,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // loaded in ValidDeps with this path as a key. std::string obj_i = this->LocalGenerator->MaybeRelativeToTopBinDir(obj); - if (this->ValidDeps != nullptr) { + if (this->ValidDeps) { auto const tmpIt = this->ValidDeps->find(obj_i); if (tmpIt != this->ValidDeps->end()) { dependencies.insert(tmpIt->second.begin(), tmpIt->second.end()); @@ -295,7 +295,7 @@ void cmDependsC::ReadCacheFile() } } } - } else if (cacheEntry != nullptr) { + } else if (cacheEntry) { UnscannedEntry entry; entry.FileName = line; if (cmSystemTools::GetLineFromStream(fin, line)) { diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index 27f328d..17ec43b 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -63,7 +63,7 @@ bool cmDependsCompiler::CheckDependencies( continue; } // This is a dependee line - if (currentDependencies != nullptr) { + if (currentDependencies) { currentDependencies->emplace_back(line.substr(1)); } } diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 6e617f6..e2718e4 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -309,7 +309,7 @@ void cmDependsJavaParserHelper::Error(const char* str) void cmDependsJavaParserHelper::UpdateCombine(const char* str1, const char* str2) { - if (this->CurrentCombine.empty() && str1 != nullptr) { + if (this->CurrentCombine.empty() && str1) { this->CurrentCombine = str1; } this->CurrentCombine += "."; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 00f3c74..4c6ddfc 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -297,7 +297,7 @@ bool cmExportCommand(std::vector<std::string> const& args, // if cmExportBuildFileGenerator is already defined for the file // and APPEND is not specified, if CMP0103 is OLD ignore previous definition // else raise an error - if (gg->GetExportedTargetsFile(fname) != nullptr) { + if (gg->GetExportedTargetsFile(fname)) { switch (mf.GetPolicyStatus(cmPolicies::CMP0103)) { case cmPolicies::WARN: mf.IssueMessage( @@ -332,7 +332,7 @@ bool cmExportCommand(std::vector<std::string> const& args, ebfg->SetExportFile(fname.c_str()); ebfg->SetNamespace(arguments.Namespace); ebfg->SetCxxModuleDirectory(arguments.CxxModulesDirectory); - if (exportSet != nullptr) { + if (exportSet) { ebfg->SetExportSet(exportSet); } else { ebfg->SetTargets(targets); @@ -345,7 +345,7 @@ bool cmExportCommand(std::vector<std::string> const& args, for (std::string const& ct : configurationTypes) { ebfg->AddConfiguration(ct); } - if (exportSet != nullptr) { + if (exportSet) { gg->AddBuildExportExportSet(ebfg.get()); } else { gg->AddBuildExportSet(ebfg.get()); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 7bd754a..7b62bb4 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -231,7 +231,7 @@ cmStateEnums::TargetType cmExportInstallFileGenerator::GetExportTargetType( // An OBJECT library installed with no OBJECTS DESTINATION // is transformed to an INTERFACE library. if (targetType == cmStateEnums::OBJECT_LIBRARY && - targetExport->ObjectsGenerator == nullptr) { + !targetExport->ObjectsGenerator) { targetType = cmStateEnums::INTERFACE_LIBRARY; } return targetType; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 8d7f33e..bc58447 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -494,7 +494,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget( xml.StartElement("Target"); xml.Attribute("title", targetName); - if (target != nullptr) { + if (target) { int cbTargetType = this->GetCBTargetType(target); std::string workingDir = lg->GetCurrentBinaryDirectory(); if (target->GetType() == cmStateEnums::EXECUTABLE) { diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 205a691..37c4a7c 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -242,7 +242,7 @@ void cmExtraSublimeTextGenerator::AppendTarget( MapSourceFileFlags& sourceFileFlags, bool firstTarget) { - if (target != nullptr) { + if (target) { std::vector<cmSourceFile*> sourceFiles; target->GetSourceFiles(sourceFiles, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 8840cdc..81e081c 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -5,7 +5,6 @@ #include <algorithm> #include <cstddef> #include <deque> -#include <functional> #include <iterator> #include <map> #include <utility> @@ -149,7 +148,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) return false; } auto command = this->Makefile->GetState()->GetCommand(args[j]); - if (command == nullptr) { + if (!command) { this->SetError(cmStrCat( "command specified for \"VALIDATOR\" is undefined: ", args[j], '.')); return false; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 59f5ce2..cc150fd 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -106,7 +106,7 @@ public: bool isDirentryToIgnore(const char* const fname) { - assert(fname != nullptr); + assert(fname); assert(fname[0] != 0); return fname[0] == '.' && (fname[1] == 0 || (fname[1] == '.' && fname[2] == 0)); diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 8a2a69e..dd22b41 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -327,7 +327,7 @@ std::string cmFindProgramCommand::GetBundleExecutable( // returned executableURL is relative to <appbundle>/Contents/MacOS/ CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle); - if (executableURL != nullptr) { + if (executableURL) { const int MAX_OSX_PATH_SIZE = 1024; UInt8 buffer[MAX_OSX_PATH_SIZE]; diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 0abd968..4452f2d 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -78,7 +78,7 @@ public: } static inline bool StartsWithGeneratorExpression(const char* input) { - return input != nullptr && input[0] == '$' && input[1] == '<'; + return input && input[0] == '$' && input[1] == '<'; } static void ReplaceInstallPrefix(std::string& input, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9f814c2..56f6a80 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1043,7 +1043,7 @@ void cmGeneratorTarget::AppendCustomCommandSideEffects( sideEffects.insert(this); } else { for (auto const& source : this->GetAllConfigSources()) { - if (source.Source->GetCustomCommand() != nullptr) { + if (source.Source->GetCustomCommand()) { sideEffects.insert(this); break; } @@ -1192,7 +1192,7 @@ void cmGeneratorTarget::AddSystemIncludeCacheKey( cmLinkImplementation const* impl = this->GetLinkImplementation(config, UseTo::Compile); - if (impl != nullptr) { + if (impl) { auto runtimeEntries = impl->LanguageRuntimeLibraries.find(language); if (runtimeEntries != impl->LanguageRuntimeLibraries.end()) { for (auto const& lib : runtimeEntries->second) { @@ -2846,8 +2846,7 @@ bool cmGeneratorTarget::ComputeCompileFeatures( } // Custom updates for the CUDA standard. - if (generatorTargetLanguageStandard != nullptr && - (language.first == "CUDA")) { + if (generatorTargetLanguageStandard && (language.first == "CUDA")) { if (generatorTargetLanguageStandard->Value == "98") { this->LanguageStandardMap[key].Value = "03"; } diff --git a/Source/cmGeneratorTarget_CompatibleInterface.cxx b/Source/cmGeneratorTarget_CompatibleInterface.cxx index 3af205e..d710aab 100644 --- a/Source/cmGeneratorTarget_CompatibleInterface.cxx +++ b/Source/cmGeneratorTarget_CompatibleInterface.cxx @@ -393,7 +393,7 @@ bool getTypedProperty<bool>(cmGeneratorTarget const* tgt, const std::string& prop, cmGeneratorExpressionInterpreter* genexInterpreter) { - if (genexInterpreter == nullptr) { + if (!genexInterpreter) { return tgt->GetPropertyAsBool(prop); } @@ -408,7 +408,7 @@ const char* getTypedProperty<const char*>( { cmValue value = tgt->GetProperty(prop); - if (genexInterpreter == nullptr) { + if (!genexInterpreter) { return value.GetCStr(); } @@ -422,7 +422,7 @@ std::string getTypedProperty<std::string>( { cmValue value = tgt->GetProperty(prop); - if (genexInterpreter == nullptr) { + if (!genexInterpreter) { return valueAsString(value); } diff --git a/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx index 6db467f..a05b1a2 100644 --- a/Source/cmGeneratorTarget_IncludeDirectories.cxx +++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx @@ -309,7 +309,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories( this->GetLinkImplementationLibraries(config, UseTo::Compile)) { for (cmLinkImplItem const& lib : impl->Libraries) { std::string libDir; - if (lib.Target == nullptr) { + if (!lib.Target) { libDir = cmSystemTools::CollapseFullPath( lib.AsStr(), this->Makefile->GetHomeOutputDirectory()); } else if (lib.Target->Target->IsFrameworkOnApple() || diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 309a140..343b24e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -3163,7 +3163,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( // install_strip const char* install_strip = this->GetInstallStripTargetName(); - if ((install_strip != nullptr) && (mf->IsSet("CMAKE_STRIP"))) { + if (install_strip && mf->IsSet("CMAKE_STRIP")) { gti.Name = install_strip; gti.Message = "Installing the project stripped..."; gti.UsesTerminal = true; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index b051d67..222b927 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -2068,7 +2068,7 @@ std::string cmGlobalNinjaGenerator::CMakeCmd() const std::string cmGlobalNinjaGenerator::NinjaCmd() const { const auto& lgen = this->LocalGenerators[0]; - if (lgen != nullptr) { + if (lgen) { return lgen->ConvertToOutputFormat(this->NinjaCommand, cmOutputConverter::SHELL); } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index b4683aa..0eb05d4 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -56,7 +56,7 @@ static bool VSIsArm64Host() USHORT processMachine; USHORT nativeMachine; - return s_IsWow64Process2Impl != nullptr && + return s_IsWow64Process2Impl && s_IsWow64Process2Impl(GetCurrentProcess(), &processMachine, &nativeMachine) && nativeMachine == IMAGE_FILE_MACHINE_ARM64; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 6c3afef..55cc815 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -46,7 +46,7 @@ char const* const GRAPHVIZ_NODE_SHAPE_UTILITY = "box"; const char* getShapeForTarget(const cmLinkItem& item) { - if (item.Target == nullptr) { + if (!item.Target) { return GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN; } @@ -473,7 +473,7 @@ bool cmGraphVizWriter::ItemExcluded(cmLinkItem const& item) return true; } - if (item.Target == nullptr) { + if (!item.Target) { return !this->GenerateForExternals; } diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 2fa4b55..54dfc92 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -15,7 +15,7 @@ static unsigned int ChompStrlen(const char* line) { - if (line == nullptr) { + if (!line) { return 0; } unsigned int length = static_cast<unsigned int>(strlen(line)); @@ -132,7 +132,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( { char buf[1024]; FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb"); - if (inFile == nullptr) { + if (!inFile) { return Binary; } @@ -181,11 +181,11 @@ bool cmHexFileConverter::TryConvert(const std::string& inFileName, // try to open the file FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb"); FILE* outFile = cmsys::SystemTools::Fopen(outFileName, "wb"); - if ((inFile == nullptr) || (outFile == nullptr)) { - if (inFile != nullptr) { + if (!inFile || !outFile) { + if (inFile) { fclose(inFile); } - if (outFile != nullptr) { + if (outFile) { fclose(outFile); } return false; @@ -194,7 +194,7 @@ bool cmHexFileConverter::TryConvert(const std::string& inFileName, // convert them line by line bool success = false; char buf[1024]; - while (fgets(buf, 1024, inFile) != nullptr) { + while (fgets(buf, 1024, inFile)) { if (type == MotorolaSrec) { success = ConvertMotorolaSrecLine(buf, outFile); } else if (type == IntelHex) { diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 7309316..2565647 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -41,7 +41,7 @@ const std::string& cmInstallCommandArguments::GetDestination() const if (!this->DestinationString.empty()) { return this->DestinationString; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetDestination(); } return EmptyString; @@ -52,7 +52,7 @@ const std::string& cmInstallCommandArguments::GetComponent() const if (!this->Component.empty()) { return this->Component; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetComponent(); } if (!this->DefaultComponentName.empty()) { @@ -75,7 +75,7 @@ const std::string& cmInstallCommandArguments::GetRename() const if (!this->Rename.empty()) { return this->Rename; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetRename(); } return EmptyString; @@ -86,7 +86,7 @@ const std::string& cmInstallCommandArguments::GetPermissions() const if (!this->PermissionsString.empty()) { return this->PermissionsString; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetPermissions(); } return EmptyString; @@ -97,7 +97,7 @@ bool cmInstallCommandArguments::GetOptional() const if (this->Optional) { return true; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetOptional(); } return false; @@ -108,7 +108,7 @@ bool cmInstallCommandArguments::GetExcludeFromAll() const if (this->ExcludeFromAll) { return true; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetExcludeFromAll(); } return false; @@ -119,7 +119,7 @@ bool cmInstallCommandArguments::GetNamelinkOnly() const if (this->NamelinkOnly) { return true; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetNamelinkOnly(); } return false; @@ -130,7 +130,7 @@ bool cmInstallCommandArguments::GetNamelinkSkip() const if (this->NamelinkSkip) { return true; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetNamelinkSkip(); } return false; @@ -141,7 +141,7 @@ bool cmInstallCommandArguments::HasNamelinkComponent() const if (!this->NamelinkComponent.empty()) { return true; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->HasNamelinkComponent(); } return false; @@ -163,7 +163,7 @@ const std::vector<std::string>& cmInstallCommandArguments::GetConfigurations() if (!this->Configurations.empty()) { return this->Configurations; } - if (this->GenericArguments != nullptr) { + if (this->GenericArguments) { return this->GenericArguments->GetConfigurations(); } return this->Configurations; diff --git a/Source/cmLinkItemGraphVisitor.cxx b/Source/cmLinkItemGraphVisitor.cxx index eabc8b9..ca574d4 100644 --- a/Source/cmLinkItemGraphVisitor.cxx +++ b/Source/cmLinkItemGraphVisitor.cxx @@ -24,7 +24,7 @@ void cmLinkItemGraphVisitor::VisitItem(cmLinkItem const& item) void cmLinkItemGraphVisitor::VisitLinks(cmLinkItem const& item, cmLinkItem const& rootItem) { - if (item.Target == nullptr) { + if (!item.Target) { return; } @@ -100,7 +100,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target, { const auto* implementationLibraries = target.GetLinkImplementationLibraries( config, cmGeneratorTarget::UseTo::Link); - if (implementationLibraries != nullptr) { + if (implementationLibraries) { for (auto const& lib : implementationLibraries->Libraries) { auto const& name = lib.AsStr(); dependencies[name] = Dependency(DependencyType::LinkPrivate, lib); @@ -109,7 +109,7 @@ void cmLinkItemGraphVisitor::GetDependencies(cmGeneratorTarget const& target, const auto* interfaceLibraries = target.GetLinkInterfaceLibraries( config, &target, cmGeneratorTarget::UseTo::Compile); - if (interfaceLibraries != nullptr) { + if (interfaceLibraries) { for (auto const& lib : interfaceLibraries->Libraries) { auto const& name = lib.AsStr(); if (dependencies.find(name) != dependencies.cend()) { diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 018b517..3963eb8 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -160,7 +160,7 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries( cmGeneratorTarget::UseTo::Link); for (const cmLinkImplItem& iter : linkImpl->Libraries) { - if (iter.Target != nullptr && + if (iter.Target && iter.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { std::string libPath = iter.Target->GetLocation(cli.GetConfig()); if (item.Value == libPath) { diff --git a/Source/cmList.cxx b/Source/cmList.cxx index 939fbb5..cf65bb2 100644 --- a/Source/cmList.cxx +++ b/Source/cmList.cxx @@ -146,7 +146,7 @@ public: { std::string result = argument; for (auto const& filter : this->Filters) { - if (filter != nullptr) { + if (filter) { result = filter(result); } } diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 1f18ff2..81edea5 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -55,7 +55,7 @@ struct SignalHandlerGuard { explicit SignalHandlerGuard(const char* name) { - LastName = name != nullptr ? name : "????"; + LastName = name ? name : "????"; signal(SIGSEGV, TrapsForSignals); #ifdef SIGBUS @@ -96,7 +96,7 @@ struct LoadedCommandImpl : cmLoadedCommandInfo #endif this->Destructor(this); } - if (this->Error != nullptr) { + if (this->Error) { free(this->Error); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 601f4b3..01f87b6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3443,7 +3443,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags( } const char* PICValue = target->GetLinkPIEProperty(config); - if (PICValue == nullptr) { + if (!PICValue) { // POSITION_INDEPENDENT_CODE is not set return; } @@ -3571,7 +3571,7 @@ void cmLocalGenerator::AppendCompileOptions( std::string& options, const std::vector<std::string>& options_vec, const char* regex) const { - if (regex != nullptr) { + if (regex) { // Filter flags upon specified reges. cmsys::RegularExpression r(regex); @@ -3591,7 +3591,7 @@ void cmLocalGenerator::AppendCompileOptions( std::vector<BT<std::string>>& options, const std::vector<BT<std::string>>& options_vec, const char* regex) const { - if (regex != nullptr) { + if (regex) { // Filter flags upon specified regular expressions. cmsys::RegularExpression r(regex); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 8577cc4..36d8b6a 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1265,9 +1265,9 @@ static std::string cmLocalVisualStudio7GeneratorEscapeForXML( static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue) { - return propertyValue == nullptr - ? std::string() - : cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue); + return propertyValue + ? cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue) + : std::string(); } void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2803279..d167b97 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -434,7 +434,7 @@ public: }); #endif #ifdef CMake_ENABLE_DEBUGGER - if (this->Makefile->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->Makefile->GetCMakeInstance()->GetDebugAdapter()) { this->Makefile->GetCMakeInstance() ->GetDebugAdapter() ->OnBeginFunctionCall(mf, lfc.FilePath, lff); @@ -451,7 +451,7 @@ public: --this->Makefile->RecursionDepth; this->Makefile->Backtrace = this->Makefile->Backtrace.Pop(); #ifdef CMake_ENABLE_DEBUGGER - if (this->Makefile->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->Makefile->GetCMakeInstance()->GetDebugAdapter()) { this->Makefile->GetCMakeInstance() ->GetDebugAdapter() ->OnEndFunctionCall(); @@ -696,7 +696,7 @@ bool cmMakefile::ReadDependentFile(const std::string& filename, IncludeScope incScope(this, filenametoread, noPolicyScope); #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnBeginFileParse( this, filenametoread); } @@ -706,7 +706,7 @@ bool cmMakefile::ReadDependentFile(const std::string& filename, if (!listFile.ParseFile(filenametoread.c_str(), this->GetMessenger(), this->Backtrace)) { #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnEndFileParse(); } #endif @@ -715,7 +715,7 @@ bool cmMakefile::ReadDependentFile(const std::string& filename, } #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnEndFileParse(); this->GetCMakeInstance()->GetDebugAdapter()->OnFileParsedSuccessfully( filenametoread, listFile.Functions); @@ -818,7 +818,7 @@ bool cmMakefile::ReadListFile(const std::string& filename) ListFileScope scope(this, filenametoread); #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnBeginFileParse( this, filenametoread); } @@ -828,7 +828,7 @@ bool cmMakefile::ReadListFile(const std::string& filename) if (!listFile.ParseFile(filenametoread.c_str(), this->GetMessenger(), this->Backtrace)) { #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnEndFileParse(); } #endif @@ -837,7 +837,7 @@ bool cmMakefile::ReadListFile(const std::string& filename) } #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnEndFileParse(); this->GetCMakeInstance()->GetDebugAdapter()->OnFileParsedSuccessfully( filenametoread, listFile.Functions); @@ -866,7 +866,7 @@ bool cmMakefile::ReadListFileAsString(const std::string& content, } #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnFileParsedSuccessfully( filenametoread, listFile.Functions); } @@ -1755,7 +1755,7 @@ void cmMakefile::Configure() this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart); #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnBeginFileParse( this, currentStart); } @@ -1765,7 +1765,7 @@ void cmMakefile::Configure() if (!listFile.ParseFile(currentStart.c_str(), this->GetMessenger(), this->Backtrace)) { #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnEndFileParse(); } #endif @@ -1774,7 +1774,7 @@ void cmMakefile::Configure() } #ifdef CMake_ENABLE_DEBUGGER - if (this->GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (this->GetCMakeInstance()->GetDebugAdapter()) { this->GetCMakeInstance()->GetDebugAdapter()->OnEndFileParse(); this->GetCMakeInstance()->GetDebugAdapter()->OnFileParsedSuccessfully( currentStart, listFile.Functions); @@ -2297,11 +2297,11 @@ cmSourceGroup* cmMakefile::GetSourceGroup( } } - if (sg != nullptr) { + if (sg) { // iterate through its children to find match source group for (unsigned int i = 1; i < name.size(); ++i) { sg = sg->LookupChild(name[i]); - if (sg == nullptr) { + if (!sg) { break; } } @@ -2326,7 +2326,7 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, for (i = lastElement; i >= 0; --i) { currentName.assign(name.begin(), name.begin() + i + 1); sg = this->GetSourceGroup(currentName); - if (sg != nullptr) { + if (sg) { break; } } @@ -2365,7 +2365,7 @@ cmSourceGroup* cmMakefile::GetOrCreateSourceGroup( const std::vector<std::string>& folders) { cmSourceGroup* sg = this->GetSourceGroup(folders); - if (sg == nullptr) { + if (!sg) { this->AddSourceGroup(folders); sg = this->GetSourceGroup(folders); } @@ -3872,7 +3872,7 @@ void cmMakefile::DisplayStatus(const std::string& message, float s) const cm->UpdateProgress(message, s); #ifdef CMake_ENABLE_DEBUGGER - if (cm->GetDebugAdapter() != nullptr) { + if (cm->GetDebugAdapter()) { cm->GetDebugAdapter()->OnMessageOutput(MessageType::MESSAGE, message); } #endif diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 68b3a5d..a4b2538 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -208,7 +208,7 @@ bool cmMessageCommand(std::vector<std::string> const& args, case Message::LogLevel::LOG_NOTICE: cmSystemTools::Message(IndentText(message, mf)); #ifdef CMake_ENABLE_DEBUGGER - if (mf.GetCMakeInstance()->GetDebugAdapter() != nullptr) { + if (mf.GetCMakeInstance()->GetDebugAdapter()) { mf.GetCMakeInstance()->GetDebugAdapter()->OnMessageOutput(type, message); } diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index a2e81db..01ff7f0 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -215,7 +215,7 @@ void cmMessenger::DisplayMessage(MessageType t, const std::string& text, displayMessage(t, msg); #ifdef CMake_ENABLE_DEBUGGER - if (DebuggerAdapter != nullptr) { + if (DebuggerAdapter) { DebuggerAdapter->OnMessageOutput(t, msg.str()); } #endif diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 75d1501..aa3155a 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -306,7 +306,7 @@ protected: // See if the cmSourceFile for it has any files specified as // dependency hints. - if (info->SourceFile != nullptr) { + if (info->SourceFile) { // Get the cmSourceFile corresponding to this. const cmSourceFile& cFile = *(info->SourceFile); diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 591c53e..2f377ae 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -166,7 +166,7 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget( std::string const& comment) { // Test if the target already exists - if (localGen->FindGeneratorTargetToUse(name) == nullptr) { + if (!localGen->FindGeneratorTargetToUse(name)) { cmMakefile const* makefile = localGen->GetMakefile(); // Create utility target @@ -196,7 +196,7 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoGen( if (it != this->GlobalAutoGenTargets_.end()) { cmGeneratorTarget const* target = localGen->FindGeneratorTargetToUse(it->second); - if (target != nullptr) { + if (target) { target->Target->AddUtility(targetName, false, localGen->GetMakefile()); } } @@ -209,7 +209,7 @@ void cmQtAutoGenGlobalInitializer::AddToGlobalAutoRcc( if (it != this->GlobalAutoRccTargets_.end()) { cmGeneratorTarget const* target = localGen->FindGeneratorTargetToUse(it->second); - if (target != nullptr) { + if (target) { target->Target->AddUtility(targetName, false, localGen->GetMakefile()); } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 915b2ef..37f4d69 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -357,7 +357,7 @@ void cmQtAutoGenInitializer::AddAutogenExecutableToDependencies( cmQtAutoGenInitializer::GenVarsT const& genVars, std::vector<std::string>& dependencies) const { - if (genVars.ExecutableTarget != nullptr) { + if (genVars.ExecutableTarget) { dependencies.push_back(genVars.ExecutableTarget->Target->GetName()); } else if (this->MultiConfig && this->UseBetterGraph) { cm::string_view const& configGenexWithCommandConfig = diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index ebdec12..376ac2a 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -130,7 +130,7 @@ bool cmQtAutoGenerator::FileRead(std::string& content, { content.clear(); if (!cmSystemTools::FileExists(filename, true)) { - if (error != nullptr) { + if (error) { *error = "Not a file."; } return false; @@ -142,7 +142,7 @@ bool cmQtAutoGenerator::FileRead(std::string& content, // Use lambda to save destructor calls of ifs return [&ifs, length, &content, error]() -> bool { if (!ifs) { - if (error != nullptr) { + if (error) { *error = "Opening the file for reading failed."; } return false; @@ -152,7 +152,7 @@ bool cmQtAutoGenerator::FileRead(std::string& content, content.assign(IsIt{ ifs }, IsIt{}); if (!ifs) { content.clear(); - if (error != nullptr) { + if (error) { *error = "Reading from the file failed."; } return false; @@ -167,7 +167,7 @@ bool cmQtAutoGenerator::FileWrite(std::string const& filename, { // Make sure the parent directory exists if (!cmQtAutoGenerator::MakeParentDirectory(filename)) { - if (error != nullptr) { + if (error) { *error = "Could not create parent directory."; } return false; @@ -179,14 +179,14 @@ bool cmQtAutoGenerator::FileWrite(std::string const& filename, // Use lambda to save destructor calls of ofs return [&ofs, &content, error]() -> bool { if (!ofs) { - if (error != nullptr) { + if (error) { *error = "Opening file for writing failed."; } return false; } ofs << content; if (!ofs.good()) { - if (error != nullptr) { + if (error) { *error = "File writing failed."; } return false; diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index c07f361..251ef3a 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -906,7 +906,7 @@ bool cmQtAutoMocUicT::JobT::RunProcess(GenT genType, // Log command if (this->Log().Verbose()) { cm::string_view info; - if (infoMessage != nullptr) { + if (infoMessage) { info = *infoMessage; } this->Log().Info( @@ -991,7 +991,7 @@ bool cmQtAutoMocUicT::JobMocPredefsT::Update(std::string* reason) const { // Test if the file exists if (!this->MocEval().PredefsTime.Load(this->MocConst().PredefsFileAbs)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(this->MocConst().PredefsFileAbs), ", because it doesn't exist."); @@ -1001,7 +1001,7 @@ bool cmQtAutoMocUicT::JobMocPredefsT::Update(std::string* reason) const // Test if the settings changed if (this->MocConst().SettingsChanged) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(this->MocConst().PredefsFileAbs), ", because the moc settings changed."); @@ -1015,7 +1015,7 @@ bool cmQtAutoMocUicT::JobMocPredefsT::Update(std::string* reason) const cmFileTime execTime; if (execTime.Load(exec)) { if (this->MocEval().PredefsTime.Older(execTime)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat( "Generating ", this->MessagePath(this->MocConst().PredefsFileAbs), " because it is older than ", this->MessagePath(exec), '.'); @@ -1853,7 +1853,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Test if the output file exists cmFileTime outputFileTime; if (!outputFileTime.Load(outputFile)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it doesn't exist, from ", this->MessagePath(sourceFile)); @@ -1863,7 +1863,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Test if any setting changed if (this->MocConst().SettingsChanged) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because the moc settings changed, from ", this->MessagePath(sourceFile)); @@ -1873,7 +1873,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Test if the source file is newer if (outputFileTime.Older(mapping.SourceFile->FileTime)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it's older than its source file, from ", this->MessagePath(sourceFile)); @@ -1884,7 +1884,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Test if the moc_predefs file is newer if (!this->MocConst().PredefsFileAbs.empty()) { if (outputFileTime.Older(this->MocEval().PredefsTime)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it's older than ", this->MessagePath(this->MocConst().PredefsFileAbs), @@ -1896,7 +1896,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Test if the moc executable is newer if (outputFileTime.Older(this->MocConst().ExecutableTime)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it's older than the moc executable, from ", this->MessagePath(sourceFile)); @@ -1915,7 +1915,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Find dependency file auto const depMatch = this->FindDependency(sourceDir, dep); if (depMatch.first.empty()) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), " from ", this->MessagePath(sourceFile), ", because its dependency ", @@ -1928,7 +1928,7 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, // Test if dependency file is older if (outputFileTime.Older(depMatch.second)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it's older than its dependency file ", this->MessagePath(depMatch.first), ", from ", @@ -2003,7 +2003,7 @@ bool cmQtAutoMocUicT::JobProbeDepsUicT::Probe(MappingT const& mapping, // Test if the build file exists cmFileTime outputFileTime; if (!outputFileTime.Load(outputFile)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it doesn't exist, from ", this->MessagePath(sourceFile)); @@ -2013,7 +2013,7 @@ bool cmQtAutoMocUicT::JobProbeDepsUicT::Probe(MappingT const& mapping, // Test if the uic settings changed if (this->UicConst().SettingsChanged) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because the uic settings changed, from ", this->MessagePath(sourceFile)); @@ -2023,7 +2023,7 @@ bool cmQtAutoMocUicT::JobProbeDepsUicT::Probe(MappingT const& mapping, // Test if the source file is newer if (outputFileTime.Older(mapping.SourceFile->FileTime)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), " because it's older than the source file ", this->MessagePath(sourceFile)); @@ -2033,7 +2033,7 @@ bool cmQtAutoMocUicT::JobProbeDepsUicT::Probe(MappingT const& mapping, // Test if the uic executable is newer if (outputFileTime.Older(this->UicConst().ExecutableTime)) { - if (reason != nullptr) { + if (reason) { *reason = cmStrCat("Generating ", this->MessagePath(outputFile), ", because it's older than the uic executable, from ", this->MessagePath(sourceFile)); diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 2b992ef..ec70c05 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -46,7 +46,7 @@ void cmSearchPath::AddPath(const std::string& path) void cmSearchPath::AddUserPath(const std::string& path) { - assert(this->FC != nullptr); + assert(this->FC); std::vector<std::string> outPaths; @@ -68,7 +68,7 @@ void cmSearchPath::AddUserPath(const std::string& path) void cmSearchPath::AddCMakePath(const std::string& variable) { - assert(this->FC != nullptr); + assert(this->FC); // Get a path from a CMake variable. if (cmValue value = this->FC->Makefile->GetDefinition(variable)) { @@ -92,7 +92,7 @@ void cmSearchPath::AddEnvPath(const std::string& variable) void cmSearchPath::AddCMakePrefixPath(const std::string& variable) { - assert(this->FC != nullptr); + assert(this->FC); // Get a path from a CMake variable. if (cmValue value = this->FC->Makefile->GetDefinition(variable)) { @@ -154,7 +154,7 @@ void cmSearchPath::AddSuffixes(const std::vector<std::string>& suffixes) void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, const char* base) { - assert(this->FC != nullptr); + assert(this->FC); // default for programs std::string subdir = "bin"; @@ -222,7 +222,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, void cmSearchPath::AddPathInternal(const std::string& path, const std::string& prefix, const char* base) { - assert(this->FC != nullptr); + assert(this->FC); std::string collapsedPath = cmSystemTools::CollapseFullPath(path, base); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 30ee369..5443c47 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -236,7 +236,7 @@ bool cmSourceFile::FindFullPath(std::string* error, "specifier or another FILE_SET within the target_sources() " "command."; } - if (error != nullptr) { + if (error) { *error = std::move(err); } else { makefile->IssueMessage(MessageType::FATAL_ERROR, err); diff --git a/Source/cmString.cxx b/Source/cmString.cxx index f7f6293..d7c0ec3 100644 --- a/Source/cmString.cxx +++ b/Source/cmString.cxx @@ -67,7 +67,7 @@ std::string const& String::str() const char* String::c_str() { const char* c = this->data(); - if (c == nullptr) { + if (!c) { return c; } diff --git a/Source/cmStringReplaceHelper.cxx b/Source/cmStringReplaceHelper.cxx index 998c135..768effd 100644 --- a/Source/cmStringReplaceHelper.cxx +++ b/Source/cmStringReplaceHelper.cxx @@ -27,7 +27,7 @@ bool cmStringReplaceHelper::Replace(const std::string& input, // Scan through the input for all matches. std::string::size_type base = 0; while (this->RegularExpression.find(input.c_str() + base)) { - if (this->Makefile != nullptr) { + if (this->Makefile) { this->Makefile->ClearMatches(); this->Makefile->StoreMatches(this->RegularExpression); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0a6b683..474aafd 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1958,7 +1958,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry) /* Use uname if it's present, else uid. */ p = archive_entry_uname(entry); - if ((p == nullptr) || (*p == '\0')) { + if (!p || (*p == '\0')) { snprintf(tmp, sizeof(tmp), "%lu ", static_cast<unsigned long>(archive_entry_uid(entry))); p = tmp; @@ -1970,7 +1970,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry) fprintf(out, "%-*s ", static_cast<int>(u_width), p); /* Use gname if it's present, else gid. */ p = archive_entry_gname(entry); - if (p != nullptr && p[0] != '\0') { + if (p && p[0] != '\0') { fprintf(out, "%s", p); w = strlen(p); } else { @@ -2115,7 +2115,7 @@ bool extract_tar(const std::string& outFileName, struct archive_entry* entry; struct archive* matching = archive_match_new(); - if (matching == nullptr) { + if (!matching) { cmSystemTools::Error("Out of memory"); return false; } @@ -2197,7 +2197,7 @@ bool extract_tar(const std::string& outFileName, } bool error_occured = false; - if (matching != nullptr) { + if (matching) { const char* p; int ar; diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 7e47b4e..4d8bc02 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -115,7 +115,7 @@ std::string cmTimestamp::CreateTimestampFromTimeT(time_t timeT, ptr = localtime(&timeT); } - if (ptr == nullptr) { + if (!ptr) { return std::string(); } diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index ccf24a0..809117e 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -178,7 +178,7 @@ bool cmVSSetupAPIHelper::CheckInstalledComponent( bool cmVSSetupAPIHelper::GetVSInstanceInfo( SmartCOMPtr<ISetupInstance2> pInstance, VSInstanceInfo& vsInstanceInfo) { - if (pInstance == nullptr) { + if (!pInstance) { return false; } @@ -219,8 +219,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo( } LPSAFEARRAY lpsaPackages; - if (FAILED(pInstance->GetPackages(&lpsaPackages)) || - lpsaPackages == nullptr) { + if (FAILED(pInstance->GetPackages(&lpsaPackages)) || !lpsaPackages) { return false; } @@ -232,7 +231,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo( SmartCOMPtr<ISetupPackageReference> package = nullptr; if (FAILED(ppData[i]->QueryInterface(IID_ISetupPackageReference, (void**)&package)) || - package == nullptr) { + !package) { continue; } @@ -372,8 +371,7 @@ bool cmVSSetupAPIHelper::EnumerateVSInstancesWithVswhere( bool cmVSSetupAPIHelper::EnumerateVSInstancesWithCOM( std::vector<VSInstanceInfo>& VSInstances) { - if (initializationFailure || setupConfig == nullptr || - setupConfig2 == nullptr || setupHelper == nullptr) { + if (initializationFailure || !setupConfig || !setupConfig2 || !setupHelper) { return false; } @@ -610,21 +608,21 @@ bool cmVSSetupAPIHelper::Initialize() if (FAILED(setupConfig.CoCreateInstance(CLSID_SetupConfiguration, nullptr, IID_ISetupConfiguration, CLSCTX_INPROC_SERVER)) || - setupConfig == nullptr) { + !setupConfig) { initializationFailure = true; return false; } if (FAILED(setupConfig.QueryInterface(IID_ISetupConfiguration2, (void**)&setupConfig2)) || - setupConfig2 == nullptr) { + !setupConfig2) { initializationFailure = true; return false; } if (FAILED( setupConfig.QueryInterface(IID_ISetupHelper, (void**)&setupHelper)) || - setupHelper == nullptr) { + !setupHelper) { initializationFailure = true; return false; } diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index b8be9b9..cc4d696 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -21,14 +21,14 @@ public: SmartCOMPtr(T* p) { ptr = p; - if (ptr != nullptr) { + if (ptr) { ptr->AddRef(); } } SmartCOMPtr(const SmartCOMPtr<T>& sptr) { ptr = sptr.ptr; - if (ptr != nullptr) { + if (ptr) { ptr->AddRef(); } } @@ -38,7 +38,7 @@ public: { if (*this != p) { ptr = p; - if (ptr != nullptr) { + if (ptr) { ptr->AddRef(); } } @@ -48,7 +48,7 @@ public: template <class I> HRESULT QueryInterface(REFCLSID rclsid, I** pp) { - if (pp != nullptr) { + if (pp) { return ptr->QueryInterface(rclsid, (void**)pp); } return E_FAIL; @@ -62,7 +62,7 @@ public: } ~SmartCOMPtr() { - if (ptr != nullptr) { + if (ptr) { ptr->Release(); } } diff --git a/Source/cmValue.cxx b/Source/cmValue.cxx index 044db29..df806cf 100644 --- a/Source/cmValue.cxx +++ b/Source/cmValue.cxx @@ -90,10 +90,10 @@ bool cmValue::IsInternallyOn(cm::string_view value) noexcept int cmValue::Compare(cmValue value) const noexcept { - if (this->Value == nullptr && !value) { + if (!this->Value && !value) { return 0; } - if (this->Value == nullptr) { + if (!this->Value) { return -1; } if (!value) { @@ -104,13 +104,13 @@ int cmValue::Compare(cmValue value) const noexcept int cmValue::Compare(cm::string_view value) const noexcept { - if (this->Value == nullptr && value.data() == nullptr) { + if (!this->Value && !value.data()) { return 0; } - if (this->Value == nullptr) { + if (!this->Value) { return -1; } - if (value.data() == nullptr) { + if (!value.data()) { return 1; } return cm::string_view(*this->Value).compare(value); diff --git a/Source/cmValue.h b/Source/cmValue.h index c924dda..6b9b795 100644 --- a/Source/cmValue.h +++ b/Source/cmValue.h @@ -34,16 +34,16 @@ public: const std::string* Get() const noexcept { return this->Value; } const char* GetCStr() const noexcept { - return this->Value == nullptr ? nullptr : this->Value->c_str(); + return this->Value ? this->Value->c_str() : nullptr; } const std::string* operator->() const noexcept { - return this->Value == nullptr ? &cmValue::Empty : this->Value; + return this->Value ? this->Value : &cmValue::Empty; } const std::string& operator*() const noexcept { - return this->Value == nullptr ? cmValue::Empty : *this->Value; + return this->Value ? *this->Value : cmValue::Empty; } explicit operator bool() const noexcept { return this->Value != nullptr; } @@ -58,8 +58,7 @@ public: */ bool IsOn() const noexcept { - return this->Value != nullptr && - cmValue::IsOn(cm::string_view(*this->Value)); + return this->Value && cmValue::IsOn(cm::string_view(*this->Value)); } /** * Does the value indicate a false or off value ? Note that this is @@ -70,18 +69,16 @@ public: */ bool IsOff() const noexcept { - return this->Value == nullptr || - cmValue::IsOff(cm::string_view(*this->Value)); + return !this->Value || cmValue::IsOff(cm::string_view(*this->Value)); } /** Return true if value is NOTFOUND or ends in -NOTFOUND. */ bool IsNOTFOUND() const noexcept { - return this->Value != nullptr && - cmValue::IsNOTFOUND(cm::string_view(*this->Value)); + return this->Value && cmValue::IsNOTFOUND(cm::string_view(*this->Value)); } bool IsEmpty() const noexcept { - return this->Value == nullptr || this->Value->empty(); + return !this->Value || this->Value->empty(); } /** @@ -91,7 +88,7 @@ public: */ bool IsInternallyOn() const noexcept { - return this->Value != nullptr && + return this->Value && cmValue::IsInternallyOn(cm::string_view(*this->Value)); } @@ -105,7 +102,7 @@ public: */ static bool IsOn(const char* value) noexcept { - return value != nullptr && IsOn(cm::string_view(value)); + return value && IsOn(cm::string_view(value)); } static bool IsOn(cm::string_view) noexcept; @@ -124,20 +121,20 @@ public: */ static bool IsOff(const char* value) noexcept { - return value == nullptr || IsOff(cm::string_view(value)); + return !value || IsOff(cm::string_view(value)); } static bool IsOff(cm::string_view) noexcept; /** Return true if value is NOTFOUND or ends in -NOTFOUND. */ static bool IsNOTFOUND(const char* value) noexcept { - return value == nullptr || IsNOTFOUND(cm::string_view(value)); + return !value || IsNOTFOUND(cm::string_view(value)); } static bool IsNOTFOUND(cm::string_view) noexcept; static bool IsEmpty(const char* value) noexcept { - return value == nullptr || *value == '\0'; + return !value || *value == '\0'; } static bool IsEmpty(cm::string_view value) noexcept { return value.empty(); } @@ -148,7 +145,7 @@ public: */ static bool IsInternallyOn(const char* value) noexcept { - return value != nullptr && IsInternallyOn(cm::string_view(value)); + return value && IsInternallyOn(cm::string_view(value)); } static bool IsInternallyOn(cm::string_view) noexcept; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 54bab9f..9c20ac7 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -5111,11 +5111,11 @@ std::string ComputeCertificateThumbprint(const std::string& source) cmsys::Encoding::ToWide(source.c_str()).c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); - if (certFile != INVALID_HANDLE_VALUE && certFile != nullptr) { + if (certFile != INVALID_HANDLE_VALUE && certFile) { DWORD fileSize = GetFileSize(certFile, nullptr); if (fileSize != INVALID_FILE_SIZE) { auto certData = cm::make_unique<BYTE[]>(fileSize); - if (certData != nullptr) { + if (certData) { DWORD dwRead = 0; if (ReadFile(certFile, certData.get(), fileSize, &dwRead, nullptr)) { cryptBlob.cbData = fileSize; @@ -5126,11 +5126,11 @@ std::string ComputeCertificateThumbprint(const std::string& source) // Open the certificate as a store certStore = PFXImportCertStore(&cryptBlob, nullptr, CRYPT_EXPORTABLE); - if (certStore != nullptr) { + if (certStore) { // There should only be 1 cert. certContext = CertEnumCertificatesInStore(certStore, certContext); - if (certContext != nullptr) { + if (certContext) { // The hash is 20 bytes BYTE hashData[20]; DWORD hashLength = 20; diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index dd8f459..2fbf657 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -71,7 +71,7 @@ private: void cmUVPipeBuffer::reset() { - if (this->UVPipe_.get() != nullptr) { + if (this->UVPipe_.get()) { this->EndFunction_ = nullptr; this->DataFunction_ = nullptr; this->Buffer_.clear(); @@ -83,7 +83,7 @@ void cmUVPipeBuffer::reset() bool cmUVPipeBuffer::init(uv_loop_t* uv_loop) { this->reset(); - if (uv_loop == nullptr) { + if (!uv_loop) { return false; } int ret = this->UVPipe_.init(*uv_loop, 0, this); @@ -93,7 +93,7 @@ bool cmUVPipeBuffer::init(uv_loop_t* uv_loop) bool cmUVPipeBuffer::startRead(DataFunction dataFunction, EndFunction endFunction) { - if (this->UVPipe_.get() == nullptr) { + if (!this->UVPipe_.get()) { return false; } if (!dataFunction || !endFunction) { @@ -120,7 +120,7 @@ void cmUVPipeBuffer::UVData(uv_stream_t* stream, ssize_t nread, { auto& pipe = *reinterpret_cast<cmUVPipeBuffer*>(stream->data); if (nread > 0) { - if (buf->base != nullptr) { + if (buf->base) { // Call data function pipe.DataFunction_(DataRange(buf->base, buf->base + nread)); } @@ -200,7 +200,7 @@ void cmUVReadOnlyProcess::setup(cmWorkerPool::ProcessResultT* result, bool cmUVReadOnlyProcess::start(uv_loop_t* uv_loop, std::function<void()> finishedCallback) { - if (this->IsStarted() || (this->Result() == nullptr)) { + if (this->IsStarted() || !this->Result()) { return false; } @@ -364,9 +364,8 @@ void cmUVReadOnlyProcess::UVTryFinish() // There still might be data in the pipes after the process has finished. // Therefore check if the process is finished AND all pipes are closed // before signaling the worker thread to continue. - if ((this->UVProcess_.get() != nullptr) || - (this->UVPipeOut_.uv_pipe() != nullptr) || - (this->UVPipeErr_.uv_pipe() != nullptr)) { + if ((this->UVProcess_.get()) || (this->UVPipeOut_.uv_pipe()) || + (this->UVPipeErr_.uv_pipe())) { return; } this->IsFinished_ = true; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 3a2c690..02b3d87 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2735,7 +2735,7 @@ bool cmake::StartDebuggerIfEnabled() return true; } - if (DebugAdapter == nullptr) { + if (!DebugAdapter) { if (this->GetDebuggerPipe().empty()) { std::cerr << "Error: --debugger-pipe must be set when debugging is enabled.\n"; @@ -2765,7 +2765,7 @@ void cmake::StopDebuggerIfNeeded(int exitCode) } // The debug adapter may have failed to start (e.g. invalid pipe path). - if (DebugAdapter != nullptr) { + if (DebugAdapter) { DebugAdapter->ReportExitCode(exitCode); DebugAdapter.reset(); } -- cgit v0.12