Page MenuHomePhabricator

Fix LLDB warnings when compiling with Clang 8.0
ClosedPublic

Authored by aganea on May 16 2019, 11:38 AM.

Details

Summary

Ditto. Please see warnings list:

[2660/3259] Building CXX object tools\lldb\source\Host\CMakeFiles\lldbHost.dir\common\GetOptInc.cpp.obj
F:\svn\lldb\source\Host\common\GetOptInc.cpp(100,17): warning: cast from 'char *const *' to 'char **' drops const qualifier [-Wcast-qual]
      ((char **)nargv)[pos] = nargv[cstart];
                ^
F:\svn\lldb\source\Host\common\GetOptInc.cpp(102,17): warning: cast from 'char *const *' to 'char **' drops const qualifier [-Wcast-qual]
      ((char **)nargv)[cstart] = swap;
                ^
2 warnings generated.
[2677/3259] Building CXX object tools\lldb\source\Host\CMakeFiles\lldbHost.dir\common\MainLoop.cpp.obj
F:\svn\lldb\source\Host\common\MainLoop.cpp(64,13): warning: unused function 'SignalHandler' [-Wunused-function]
static void SignalHandler(int signo, siginfo_t *info, void *) {
            ^
1 warning generated.
[2694/3259] Building CXX object tools\lldb\source\Host\CMakeFiles\lldbHost.dir\common\Socket.cpp.obj
F:\svn\lldb\source\Host\common\Socket.cpp(398,17): warning: format specifies type 'int' but the argument has type 'lldb_private::NativeSocket' (aka 'unsigned long long') [-Wformat]
                m_socket);
                ^~~~~~~~
1 warning generated.
[2704/3259] Building CXX object tools\lldb\source\Host\CMakeFiles\lldbHost.dir\windows\Windows.cpp.obj
F:\svn\lldb\source\Host\windows\Windows.cpp(87,19): warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
  return ((char *)s);
                  ^
1 warning generated.
[2706/3259] Building CXX object tools\lldb\source\Host\CMakeFiles\lldbHost.dir\windows\ProcessLauncherWindows.cpp.obj
F:\svn\lldb\source\Host\windows\ProcessLauncherWindows.cpp(33,43): warning: cast from 'const wchar_t *' to 'char *' drops const qualifier [-Wcast-qual]
      buffer.insert(buffer.end(), (char *)warg.c_str(),
                                          ^
F:\svn\lldb\source\Host\windows\ProcessLauncherWindows.cpp(34,29): warning: cast from 'const wchar_t *' to 'char *' drops const qualifier [-Wcast-qual]
                    (char *)(warg.c_str() + warg.size() + 1));
                            ^
2 warnings generated.
[2944/3259] Building CXX object tools\lldb\source\Plugins\Process\Windows\Common...eFiles\lldbPluginProcessWindowsCommon.dir\x64\RegisterContextWindows_x64.cpp.obj
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(69,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(74,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(79,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(84,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(89,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(94,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(99,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(104,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(109,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(114,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(119,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(124,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(129,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(134,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(139,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(144,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(149,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\x64\RegisterContextWindows_x64.cpp(154,13): warning: missing field 'dynamic_size_dwarf_expr_bytes' initializer [-Wmissing-field-initializers]
     nullptr},
            ^
18 warnings generated.
[2953/3259] Building CXX object tools\lldb\source\Plugins\Process\Windows\Common\CMakeFiles\lldbPluginProcessWindowsCommon.dir\TargetThreadWindows.cpp.obj
F:\svn\lldb\source\Plugins\Process\Windows\Common\TargetThreadWindows.cpp(86,7): warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      default:
      ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\TargetThreadWindows.cpp(86,7): note: insert 'break;' to avoid fall-through
      default:
      ^
      break;
1 warning generated.
[2968/3259] Building CXX object tools\lldb\source\Plugins\Process\Windows\Common\CMakeFiles\lldbPluginProcessWindowsCommon.dir\ProcessWindows.cpp.obj
F:\svn\lldb\source\Plugins\Process\Windows\Common\ProcessWindows.cpp(637,3): warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  default: {
  ^
F:\svn\lldb\source\Plugins\Process\Windows\Common\ProcessWindows.cpp(637,3): note: insert 'LLVM_FALLTHROUGH;' to silence this warning
  default: {
  ^
  LLVM_FALLTHROUGH;
F:\svn\lldb\source\Plugins\Process\Windows\Common\ProcessWindows.cpp(637,3): note: insert 'break;' to avoid fall-through
  default: {
  ^
  break;
1 warning generated.

Diff Detail

Repository
rL LLVM

Event Timeline

aganea created this revision.May 16 2019, 11:38 AM

LGTM, thanks!

This revision is now accepted and ready to land.May 16 2019, 12:37 PM
JDevlieghere accepted this revision.May 16 2019, 4:37 PM
labath added a subscriber: labath.May 17 2019, 12:10 AM
labath added inline comments.
source/Host/windows/ProcessLauncherWindows.cpp
35–37 ↗(On Diff #199867)

I don't believe the const_cast here is needed. You should be able to just reinterpret_cast to const char *..

aganea marked 2 inline comments as done.May 17 2019, 9:56 AM
aganea added inline comments.
source/Host/windows/ProcessLauncherWindows.cpp
35–37 ↗(On Diff #199867)

You're right - fixed.

This revision was automatically updated to reflect the committed changes.
aganea marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2019, 12:32 PM