Author: David Spickett
Date: 2026-09-04T16:32:45+01:00
New Revision: 1268903b40387fc9e70b250662225fdd74074c22

URL: 
https://github.com/llvm/llvm-project/commit/1268903b40387fc9e70b250662225fdd74074c22
DIFF: 
https://github.com/llvm/llvm-project/commit/1268903b40387fc9e70b250662225fdd74074c22.diff

LOG: [lldb][Windows] Fix unused function GetModulePath warning with certain 
Python options (#221173)

If LLDB_PYTHON_DLL_RELATIVE_PATH is OFF, or it is ON and
LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME is OFF, then GetModulePath is
unused.
```
<...>/lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp(32,13): warning: 
unused function 'GetModulePath' [-Wunused-function]
   32 | std::string GetModulePath(HMODULE module) {
      |             ^~~~~~~~~~~~~
```

Rearrange the macros to define GetModulePath only if both options are
enabled.

Added: 
    

Modified: 
    lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp 
b/lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp
index 360a90ea81599..3f994daa92a0a 100644
--- a/lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp
+++ b/lldb/source/Host/windows/PythonRuntimeLoaderWindows.cpp
@@ -28,6 +28,8 @@ namespace lldb_private {
 
 namespace {
 
+#ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
+#ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
 /// Absolute path of \p module, or the running executable when null.
 std::string GetModulePath(HMODULE module) {
   std::vector<WCHAR> buffer(MAX_PATH);
@@ -46,8 +48,8 @@ std::string GetModulePath(HMODULE module) {
   }
   return "";
 }
+#endif // ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
 
-#ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
 std::string ExeRelativeCandidate() {
 #ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
   std::string exe = GetModulePath(nullptr);
@@ -61,9 +63,9 @@ std::string ExeRelativeCandidate() {
   return std::string(path);
 #else
   return "";
-#endif
+#endif // ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
 }
-#endif
+#endif // ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
 
 } // namespace
 


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to