Skip to content

Conversation

@mstorsjo
Copy link
Member

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);
      |                          ^

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);
          |                          ^
@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2025

@llvm/pr-subscribers-lldb

Author: Martin Storsjö (mstorsjo)

Changes

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 --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;
   }

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mstorsjo mstorsjo merged commit 1c5fcb1 into llvm:main Sep 17, 2025
11 checks passed
@mstorsjo mstorsjo deleted the lldb-windows-warnings branch September 17, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants