[Lldb-commits] [lldb] [LLDB] Silence warnings when building on Windows (PR #191566)
Alexandre Ganea via lldb-commits
lldb-commits at lists.llvm.org
Sat Apr 11 06:44:48 PDT 2026
https://github.com/aganea updated https://github.com/llvm/llvm-project/pull/191566
>From 0c7b54bdb63c353f58b15c2fb88fa50d732dc3af Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <aganea at havenstudios.com>
Date: Fri, 10 Apr 2026 18:04:53 -0400
Subject: [PATCH 1/3] [LLDB] Silence warnings when building on Windows
---
lldb/source/Host/windows/PythonPathSetup/PythonPathSetup.cpp | 5 ++++-
lldb/tools/lldb-dap/RunInTerminal.cpp | 2 +-
lldb/unittests/Platform/TestUtils.cpp | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Host/windows/PythonPathSetup/PythonPathSetup.cpp b/lldb/source/Host/windows/PythonPathSetup/PythonPathSetup.cpp
index b71e10b9c82e7..25b602286ce12 100644
--- a/lldb/source/Host/windows/PythonPathSetup/PythonPathSetup.cpp
+++ b/lldb/source/Host/windows/PythonPathSetup/PythonPathSetup.cpp
@@ -19,6 +19,8 @@
using namespace llvm;
+#if defined(LLDB_PYTHON_DLL_RELATIVE_PATH) || \
+ defined(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME)
static std::string GetModulePath(HMODULE module) {
std::vector<WCHAR> buffer(MAX_PATH);
while (buffer.size() <= PATHCCH_MAX_CCH) {
@@ -36,11 +38,12 @@ static std::string GetModulePath(HMODULE module) {
}
return "";
}
+#endif
+#ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
/// Returns the full path to the lldb.exe executable.
static std::string GetPathToExecutable() { return GetModulePath(NULL); }
-#ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
bool AddPythonDLLToSearchPath() {
std::string path_str = GetPathToExecutable();
if (path_str.empty())
diff --git a/lldb/tools/lldb-dap/RunInTerminal.cpp b/lldb/tools/lldb-dap/RunInTerminal.cpp
index 28be4a9904942..75bdac910f1f8 100644
--- a/lldb/tools/lldb-dap/RunInTerminal.cpp
+++ b/lldb/tools/lldb-dap/RunInTerminal.cpp
@@ -171,7 +171,7 @@ Expected<std::shared_ptr<FifoFile>> CreateRunInTerminalCommFile() {
SmallString<256> comm_file;
#if _WIN32
char pipe_name[MAX_PATH];
- sprintf(pipe_name, "\\\\.\\pipe\\lldb-dap-run-in-terminal-comm-%d",
+ sprintf(pipe_name, "\\\\.\\pipe\\lldb-dap-run-in-terminal-comm-%lu",
GetCurrentProcessId());
return CreateFifoFile(pipe_name);
#else
diff --git a/lldb/unittests/Platform/TestUtils.cpp b/lldb/unittests/Platform/TestUtils.cpp
index 7330395c803f8..d28375b220d82 100644
--- a/lldb/unittests/Platform/TestUtils.cpp
+++ b/lldb/unittests/Platform/TestUtils.cpp
@@ -36,6 +36,7 @@ std::string lldb_private::CreateFile(llvm::StringRef filename,
int fd;
std::error_code ret = llvm::sys::fs::openFileForWrite(path, fd);
assert(!ret && "Failed to create test file.");
+ (void)ret;
::close(fd);
return path.c_str();
>From 3708ae5162614407237ceec2d09a9ec25ac09144 Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <aganea at havenstudios.com>
Date: Sat, 11 Apr 2026 09:29:29 -0400
Subject: [PATCH 2/3] [[maybe_unused]] instead of void cast
---
lldb/unittests/Platform/TestUtils.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/unittests/Platform/TestUtils.cpp b/lldb/unittests/Platform/TestUtils.cpp
index d28375b220d82..16f6423e2f649 100644
--- a/lldb/unittests/Platform/TestUtils.cpp
+++ b/lldb/unittests/Platform/TestUtils.cpp
@@ -36,7 +36,7 @@ std::string lldb_private::CreateFile(llvm::StringRef filename,
int fd;
std::error_code ret = llvm::sys::fs::openFileForWrite(path, fd);
assert(!ret && "Failed to create test file.");
- (void)ret;
+ [[maybe_unused]] ret;
::close(fd);
return path.c_str();
>From 24a6f2644e1e3bdd4cfb4d3c36e81a4592b3ff42 Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <aganea at havenstudios.com>
Date: Sat, 11 Apr 2026 09:44:27 -0400
Subject: [PATCH 3/3] Put back void cast
---
lldb/unittests/Platform/TestUtils.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/unittests/Platform/TestUtils.cpp b/lldb/unittests/Platform/TestUtils.cpp
index 16f6423e2f649..d28375b220d82 100644
--- a/lldb/unittests/Platform/TestUtils.cpp
+++ b/lldb/unittests/Platform/TestUtils.cpp
@@ -36,7 +36,7 @@ std::string lldb_private::CreateFile(llvm::StringRef filename,
int fd;
std::error_code ret = llvm::sys::fs::openFileForWrite(path, fd);
assert(!ret && "Failed to create test file.");
- [[maybe_unused]] ret;
+ (void)ret;
::close(fd);
return path.c_str();
More information about the lldb-commits
mailing list