From e4483b887147a8698a48babe6653ea9b9387d6e2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Nov 2023 18:31:15 -0500 Subject: Tests: Avoid compiling call to dap::optional(nullptr) --- Tests/CMakeLib/testDebugger.h | 2 +- Tests/CMakeLib/testDebuggerVariables.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/CMakeLib/testDebugger.h b/Tests/CMakeLib/testDebugger.h index d8d2caa..df67278 100644 --- a/Tests/CMakeLib/testDebugger.h +++ b/Tests/CMakeLib/testDebugger.h @@ -19,7 +19,7 @@ do { \ ASSERT_TRUE(x.name == expectedName); \ ASSERT_TRUE(x.value == expectedValue); \ - if (expectedType == nullptr) { \ + if (expectedType == std::string()) { \ ASSERT_TRUE(x.type == dap::optional()); \ } else { \ ASSERT_TRUE(x.type == dap::optional(expectedType)); \ diff --git a/Tests/CMakeLib/testDebuggerVariables.cxx b/Tests/CMakeLib/testDebuggerVariables.cxx index 0d8d18d..bb3f14d 100644 --- a/Tests/CMakeLib/testDebuggerVariables.cxx +++ b/Tests/CMakeLib/testDebuggerVariables.cxx @@ -196,8 +196,8 @@ static bool testNoSupportsVariableType() CreateVariablesRequest(vars->GetId())); ASSERT_TRUE(variables.size() == 2); - ASSERT_VARIABLE(variables[0], "Children", "", nullptr); - ASSERT_VARIABLE(variables[1], "test", "value", nullptr); + ASSERT_VARIABLE(variables[0], "Children", "", ""); + ASSERT_VARIABLE(variables[1], "test", "value", ""); return true; } -- cgit v0.12 From 641c02a3ce5bb693ca6a9bd125dbefe4906fd9e5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Nov 2023 18:34:09 -0500 Subject: cmList: Avoid using operator-> on input iterator As of C++23, some standard library iterator types deprecate it. --- Source/cmList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmList.h b/Source/cmList.h index 1b94c2f..c29aae7 100644 --- a/Source/cmList.h +++ b/Source/cmList.h @@ -1192,7 +1192,7 @@ private: } } else { for (; first != last; ++first) { - if (!first->empty() || emptyElements == EmptyElements::Yes) { + if (!(*first).empty() || emptyElements == EmptyElements::Yes) { insertPos = container.insert(insertPos, *first); ++insertPos; } -- cgit v0.12 From 85627a93c92afb628e2eb22f380966b9a0f45a8f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Nov 2023 18:34:58 -0500 Subject: cmCTestBuildCommand: Avoid requiring complete cmGlobalGenerator type publicly --- Source/CTest/cmCTestBuildCommand.cxx | 10 ++++++++++ Source/CTest/cmCTestBuildCommand.h | 11 ++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 50d69df..d8ef195 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -3,11 +3,13 @@ #include "cmCTestBuildCommand.h" #include +#include #include #include "cmCTest.h" #include "cmCTestBuildHandler.h" +#include "cmCommand.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" @@ -18,6 +20,14 @@ class cmExecutionStatus; +std::unique_ptr cmCTestBuildCommand::Clone() +{ + auto ni = cm::make_unique(); + ni->CTest = this->CTest; + ni->CTestScriptHandler = this->CTestScriptHandler; + return std::unique_ptr(std::move(ni)); +} + void cmCTestBuildCommand::BindArguments() { this->cmCTestHandlerCommand::BindArguments(); diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 1254dad..3b7f4f9 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -5,14 +5,13 @@ #include "cmConfigure.h" // IWYU pragma: keep #include -#include #include #include #include "cmCTestHandlerCommand.h" -#include "cmCommand.h" +class cmCommand; class cmCTestBuildHandler; class cmCTestGenericHandler; class cmExecutionStatus; @@ -31,13 +30,7 @@ public: /** * This is a virtual constructor for the command. */ - std::unique_ptr Clone() override - { - auto ni = cm::make_unique(); - ni->CTest = this->CTest; - ni->CTestScriptHandler = this->CTestScriptHandler; - return std::unique_ptr(std::move(ni)); - } + std::unique_ptr Clone() override; /** * The name of the command as specified in CMakeList.txt. -- cgit v0.12 From a0fabc47691a0bc76038c8fdf5f0e0a23ed954d0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 6 Nov 2023 18:38:19 -0500 Subject: cmGlobalGeneratorFactory: Provide complete cmGlobalGenerator to deleter The libc++ `unique_ptr` implementation requires this since C++23. Fixes: #25388 --- Source/cmGlobalGeneratorFactory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index a935079..b06da42 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -5,6 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmDocumentationEntry.h" // IWYU pragma: export +#include "cmGlobalGenerator.h" // IWYU pragma: keep // TODO The following headers are parts of the `cmGlobalGeneratorFactory` // public API, so could be defined as export to IWYU @@ -13,7 +14,6 @@ #include -class cmGlobalGenerator; class cmake; /** \class cmGlobalGeneratorFactory -- cgit v0.12