[Lldb-commits] [lldb] r361295 - Fix LLDB warnings when compiling with Clang 8.0

Alexandre Ganea via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 12:35:06 PDT 2019


Author: aganea
Date: Tue May 21 12:35:06 2019
New Revision: 361295

URL: http://llvm.org/viewvc/llvm-project?rev=361295&view=rev
Log:
Fix LLDB warnings when compiling with Clang 8.0

Differential Revision: https://reviews.llvm.org/D62021

Modified:
    lldb/trunk/source/Host/common/GetOptInc.cpp
    lldb/trunk/source/Host/common/MainLoop.cpp
    lldb/trunk/source/Host/common/Socket.cpp
    lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
    lldb/trunk/source/Host/windows/Windows.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp

Modified: lldb/trunk/source/Host/common/GetOptInc.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/GetOptInc.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/GetOptInc.cpp (original)
+++ lldb/trunk/source/Host/common/GetOptInc.cpp Tue May 21 12:35:06 2019
@@ -97,9 +97,9 @@ static void permute_args(int panonopt_st
         pos += nopts;
       swap = nargv[pos];
       /* LINTED const cast */
-      ((char **)nargv)[pos] = nargv[cstart];
+      const_cast<char **>(nargv)[pos] = nargv[cstart];
       /* LINTED const cast */
-      ((char **)nargv)[cstart] = swap;
+      const_cast<char **>(nargv)[cstart] = swap;
     }
   }
 }

Modified: lldb/trunk/source/Host/common/MainLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MainLoop.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/MainLoop.cpp (original)
+++ lldb/trunk/source/Host/common/MainLoop.cpp Tue May 21 12:35:06 2019
@@ -61,10 +61,12 @@ using namespace lldb_private;
 
 static sig_atomic_t g_signal_flags[NSIG];
 
+#ifndef SIGNAL_POLLING_UNSUPPORTED
 static void SignalHandler(int signo, siginfo_t *info, void *) {
   assert(signo < NSIG);
   g_signal_flags[signo] = 1;
 }
+#endif
 
 class MainLoop::RunImpl {
 public:

Modified: lldb/trunk/source/Host/common/Socket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Socket.cpp (original)
+++ lldb/trunk/source/Host/common/Socket.cpp Tue May 21 12:35:06 2019
@@ -394,8 +394,8 @@ Status Socket::Close() {
 
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
   if (log)
-    log->Printf("%p Socket::Close (fd = %i)", static_cast<void *>(this),
-                m_socket);
+    log->Printf("%p Socket::Close (fd = %" PRIu64 ")",
+                static_cast<void *>(this), static_cast<uint64_t>(m_socket));
 
 #if defined(_WIN32)
   bool success = !!closesocket(m_socket);

Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp Tue May 21 12:35:06 2019
@@ -30,8 +30,9 @@ void CreateEnvironmentBuffer(const Envir
   for (const auto &KV : env) {
     std::wstring warg;
     if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
-      buffer.insert(buffer.end(), (char *)warg.c_str(),
-                    (char *)(warg.c_str() + warg.size() + 1));
+      buffer.insert(
+          buffer.end(), reinterpret_cast<const char *>(warg.c_str()),
+          reinterpret_cast<const char *>(warg.c_str() + warg.size() + 1));
     }
   }
   // One null wchar_t (to end the block) is two null bytes

Modified: lldb/trunk/source/Host/windows/Windows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Windows.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/Windows.cpp (original)
+++ lldb/trunk/source/Host/windows/Windows.cpp Tue May 21 12:35:06 2019
@@ -84,7 +84,7 @@ char *strcasestr(const char *s, const ch
     } while (strncasecmp(s, find, len) != 0);
     s--;
   }
-  return ((char *)s);
+  return const_cast<char *>(s);
 }
 
 char *realpath(const char *name, char *resolved) {

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Tue May 21 12:35:06 2019
@@ -631,6 +631,7 @@ void ProcessWindows::RefreshStateAfterSt
                "Creating stop info with the exception.");
       // FALLTHROUGH:  We'll treat this as a generic exception record in the
       // default case.
+      LLVM_FALLTHROUGH;
     }
   }
 

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp Tue May 21 12:35:06 2019
@@ -83,6 +83,7 @@ TargetThreadWindows::CreateRegisterConte
 #else
         LLDB_LOG(log, "LLDB is 32-bit, but the target process is 64-bit.");
 #endif
+        LLVM_FALLTHROUGH;
       default:
         break;
       }

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp?rev=361295&r1=361294&r2=361295&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp Tue May 21 12:35:06 2019
@@ -66,92 +66,128 @@ RegisterInfo g_register_infos[] = {
      {dwarf_rax_x86_64, dwarf_rax_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_rax_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rbx, nullptr),
      {dwarf_rbx_x86_64, dwarf_rbx_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_rbx_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rcx, nullptr),
      {dwarf_rcx_x86_64, dwarf_rcx_x86_64, LLDB_REGNUM_GENERIC_ARG1,
       LLDB_INVALID_REGNUM, lldb_rcx_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rdx, nullptr),
      {dwarf_rdx_x86_64, dwarf_rdx_x86_64, LLDB_REGNUM_GENERIC_ARG2,
       LLDB_INVALID_REGNUM, lldb_rdx_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rdi, nullptr),
      {dwarf_rdi_x86_64, dwarf_rdi_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_rdi_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rsi, nullptr),
      {dwarf_rsi_x86_64, dwarf_rsi_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_rsi_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rbp, "fp"),
      {dwarf_rbp_x86_64, dwarf_rbp_x86_64, LLDB_REGNUM_GENERIC_FP,
       LLDB_INVALID_REGNUM, lldb_rbp_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rsp, "sp"),
      {dwarf_rsp_x86_64, dwarf_rsp_x86_64, LLDB_REGNUM_GENERIC_SP,
       LLDB_INVALID_REGNUM, lldb_rsp_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r8, nullptr),
      {dwarf_r8_x86_64, dwarf_r8_x86_64, LLDB_REGNUM_GENERIC_ARG3,
       LLDB_INVALID_REGNUM, lldb_r8_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r9, nullptr),
      {dwarf_r9_x86_64, dwarf_r9_x86_64, LLDB_REGNUM_GENERIC_ARG4,
       LLDB_INVALID_REGNUM, lldb_r9_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r10, nullptr),
      {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_REGNUM_GENERIC_ARG5,
       LLDB_INVALID_REGNUM, lldb_r10_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r11, nullptr),
      {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_REGNUM_GENERIC_ARG6,
       LLDB_INVALID_REGNUM, lldb_r11_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r12, nullptr),
      {dwarf_r12_x86_64, dwarf_r12_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_r12_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r13, nullptr),
      {dwarf_r13_x86_64, dwarf_r13_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_r13_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r14, nullptr),
      {dwarf_r14_x86_64, dwarf_r14_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_r14_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(r15, nullptr),
      {dwarf_r15_x86_64, dwarf_r15_x86_64, LLDB_INVALID_REGNUM,
       LLDB_INVALID_REGNUM, lldb_r15_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR(rip, "pc"),
      {dwarf_rip_x86_64, dwarf_rip_x86_64, LLDB_REGNUM_GENERIC_PC,
       LLDB_INVALID_REGNUM, lldb_rip_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
     {DEFINE_GPR_BIN(eflags, "flags"),
      {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS,
       LLDB_INVALID_REGNUM, lldb_rflags_x86_64},
      nullptr,
-     nullptr},
+     nullptr,
+     nullptr,
+     0},
 };
 
 static size_t k_num_register_infos = llvm::array_lengthof(g_register_infos);




More information about the lldb-commits mailing list