[Lldb-commits] [lldb] [lldb] Fix build on NetBSD (PR #74190)

Brad Smith via lldb-commits lldb-commits at lists.llvm.org
Sat Dec 2 00:55:01 PST 2023


https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/74190

```
lldb/source/Host/netbsd/HostNetBSD.cpp:112:32: error: reinterpret_cast from 'const uint8_t *' (aka 'const unsigned char *') to 'char *' casts away qualifiers
                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

>From e1ecbbc29128f54bc03b6515b92e4a642586f829 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Sat, 2 Dec 2023 03:52:38 -0500
Subject: [PATCH] [lldb] Fix build on NetBSD

lldb/source/Host/netbsd/HostNetBSD.cpp:112:32: error: reinterpret_cast from 'const uint8_t *' (aka 'const unsigned char *') to 'char *' casts away qualifiers
                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
---
 lldb/source/Host/netbsd/HostNetBSD.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp
index c47b96a5ceda614..7e5dbcae8232d8c 100644
--- a/lldb/source/Host/netbsd/HostNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostNetBSD.cpp
@@ -109,7 +109,7 @@ static bool GetNetBSDProcessCPUType(ProcessInstanceInfo &process_info) {
         process_info.GetExecutableFile(), 0x20, 0);
     if (buffer_sp) {
       uint8_t exe_class = llvm::object::getElfArchType(
-                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
+                              {reinterpret_cast<const char *>(buffer_sp->GetBytes()),
                                size_t(buffer_sp->GetByteSize())})
                               .first;
 



More information about the lldb-commits mailing list