[Lldb-commits] [lldb] [lldb] Avoid build warnings when building for Windows. NFC. (PR #159345)

via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 17 05:24:54 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Martin Storsjö (mstorsjo)

<details>
<summary>Changes</summary>

This avoids the following warnings from Clang:

    ../../lldb/source/Host/windows/Host.cpp:324:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
      324 |   default:
          |   ^
    ../../lldb/source/Host/common/File.cpp:662:26: warning: cast from 'const void *' to 'char *' drops const qualifier [-Wcast-qual]
      662 |           .write((char *)buf, num_bytes);
          |                          ^

---
Full diff: https://github.com/llvm/llvm-project/pull/159345.diff


2 Files Affected:

- (modified) lldb/source/Host/common/File.cpp (+1-1) 
- (modified) lldb/source/Host/windows/Host.cpp (-1) 


``````````diff
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index 8fd1ca069dc01..1272f13c1d82d 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -659,7 +659,7 @@ Status NativeFile::Write(const void *buf, size_t &num_bytes) {
 #ifdef _WIN32
     if (is_windows_console) {
       llvm::raw_fd_ostream(_fileno(m_stream), false)
-          .write((char *)buf, num_bytes);
+          .write((const char *)buf, num_bytes);
       return error;
     }
 #endif
diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp
index e8973a3fb937a..d5704eed10ecb 100644
--- a/lldb/source/Host/windows/Host.cpp
+++ b/lldb/source/Host/windows/Host.cpp
@@ -321,7 +321,6 @@ void Host::SystemLog(Severity severity, llvm::StringRef message) {
     stream << "[Error] ";
     break;
   case lldb::eSeverityInfo:
-  default:
     stream << "[Info] ";
     break;
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/159345


More information about the lldb-commits mailing list