From 45d3ffaa957709e6c7bdc34dd6ad5afd9a45753d Mon Sep 17 00:00:00 2001 From: Martin Duffy Date: Mon, 17 Feb 2025 10:21:31 -0500 Subject: instrumentation: Use auto for variables holding closures --- Source/cmCTest.cxx | 3 +-- Source/cmake.cxx | 9 ++++----- Source/cmakemain.cxx | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 0b4aef8..2e0b07e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -2725,7 +2724,7 @@ int cmCTest::ExecuteTests(std::vector const& args) handler.SetVerbose(this->Impl->Verbose); cmInstrumentation instrumentation(this->GetBinaryDir()); - std::function processHandler = [&handler]() { + auto processHandler = [&handler]() -> int { return handler.ProcessHandler(); }; int ret = instrumentation.InstrumentCommand("ctest", args, processHandler); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d525a5a..0bee1cc 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2624,7 +2624,7 @@ int cmake::ActualConfigure() cmSystemTools::Error(this->Instrumentation->errorMsg); return 1; } - std::function doConfigure = [this]() -> int { + auto doConfigure = [this]() -> int { this->GlobalGenerator->Configure(); return 0; }; @@ -3023,7 +3023,7 @@ int cmake::Generate() auto startTime = std::chrono::steady_clock::now(); #if !defined(CMAKE_BOOTSTRAP) auto profilingRAII = this->CreateProfilingEntry("project", "generate"); - std::function doGenerate = [this]() -> int { + auto doGenerate = [this]() -> int { if (!this->GlobalGenerator->Compute()) { return -1; } @@ -3975,9 +3975,8 @@ int cmake::Build(int jobs, std::string dir, std::vector targets, // are being executed to the `output` parameter. If CMake is verbose, print // this out. std::ostream& verbose_ostr = verbose ? std::cout : ostr; - std::function doBuild = [this, jobs, dir, projName, targets, - &verbose_ostr, config, buildOptions, verbose, - nativeOptions]() { + auto doBuild = [this, jobs, dir, projName, targets, &verbose_ostr, config, + buildOptions, verbose, nativeOptions]() -> int { return this->GlobalGenerator->Build( jobs, "", dir, projName, targets, verbose_ostr, "", config, buildOptions, verbose, cmDuration::zero(), cmSystemTools::OUTPUT_PASSTHROUGH, diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index cc55343..60b59ad 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -971,8 +971,7 @@ int do_install(int ac, char const* const* av) } } - std::function doInstall = [&handler, &verbose, &jobs, - &instrumentation]() -> int { + auto doInstall = [&handler, &verbose, &jobs, &instrumentation]() -> int { int ret_ = 0; if (handler.IsParallel()) { ret_ = handler.Install(jobs, instrumentation); -- cgit v0.12