sanitise sign comparisons
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 2 Apr 2014 03:51:35 +0000 (03:51 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 2 Apr 2014 03:51:35 +0000 (03:51 +0000)
This is a mechanical change addressing the various sign comparison warnings that
are identified by both clang and gcc.  This helps cleanup some of the warning
spew that occurs during builds.

llvm-svn: 205390

41 files changed:
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Commands/CommandObjectBreakpoint.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/CommandObjectQuit.cpp
lldb/source/Commands/CommandObjectSettings.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Core/ConnectionMachPort.cpp
lldb/source/Core/DataBufferMemoryMap.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Core/Opcode.cpp
lldb/source/DataFormatters/CF.cpp
lldb/source/Expression/IRInterpreter.cpp
lldb/source/Host/common/Host.cpp
lldb/source/Host/common/Terminal.cpp
lldb/source/Host/linux/Host.cpp
lldb/source/Host/macosx/Host.mm
lldb/source/Interpreter/Args.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/Options.cpp
lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/source/Symbol/ClangASTType.cpp
lldb/source/Symbol/ObjectFile.cpp
lldb/source/Symbol/UnwindPlan.cpp
lldb/source/Target/PathMappingList.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/Thread.cpp
lldb/source/lldb.cpp

index f1faa13ba981c8f1e5b307f9cd77bd131f659639..419c1570170c02e26da621fd3d55df1249b5a000 100644 (file)
@@ -176,7 +176,8 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
         return 0;
         
     size_t current_line_size = strlen (current_line);
-    if (cursor - current_line > current_line_size || last_char - current_line > current_line_size)
+    if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) ||
+        last_char - current_line > static_cast<ptrdiff_t>(current_line_size))
         return 0;
         
     if (log)
index ad4e6a83bcf84477360d899a444e44e5f430bb51..e5210418880db41e6468dc0506f10f4c7a899137 100644 (file)
@@ -1843,7 +1843,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
             if (breakpoint != NULL)
             {
                 const size_t num_locations = breakpoint->GetNumLocations();
-                if (cur_bp_id.GetLocationID() > num_locations)
+                if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations)
                 {
                     StreamString id_str;
                     BreakpointID::GetCanonicalReference (&id_str, 
index 0ef973261508cbcab5f8bde2f18acdecd147e6e0..9143f1d3680126d8c617f7a31b5cedbd2f9e7df3 100644 (file)
@@ -204,7 +204,7 @@ protected:
             
             if (m_options.relative_frame_offset < 0)
             {
-                if (frame_idx >= -m_options.relative_frame_offset)
+                if (static_cast<int32_t>(frame_idx) >= -m_options.relative_frame_offset)
                     frame_idx += m_options.relative_frame_offset;
                 else
                 {
@@ -224,7 +224,7 @@ protected:
                 // I don't want "up 20" where "20" takes you past the top of the stack to produce
                 // an error, but rather to just go to the top.  So I have to count the stack here...
                 const uint32_t num_frames = thread->GetStackFrameCount();
-                if (num_frames - frame_idx > m_options.relative_frame_offset)
+                if (static_cast<int32_t>(num_frames - frame_idx) > m_options.relative_frame_offset)
                     frame_idx += m_options.relative_frame_offset;
                 else
                 {
index ffe2a924072619e3a669f83f5a22b7bc6cdf44e3..dd0efc61b2d06108b239dfa4cc03880f6113b05c 100644 (file)
@@ -53,7 +53,7 @@ CommandObjectQuit::ShouldAskForConfirmation (bool& is_a_detach)
             continue;
         const TargetList& target_list(debugger_sp->GetTargetList());
         for (uint32_t target_idx = 0;
-             target_idx < target_list.GetNumTargets();
+             target_idx < static_cast<uint32_t>(target_list.GetNumTargets());
              target_idx++)
         {
             TargetSP target_sp(target_list.GetTargetAtIndex(target_idx));
index 78a5ad6ca86a3ec4413039609ba697b1be754917..c5338745df3736f284422aff87e7461a70ced974 100644 (file)
@@ -164,7 +164,8 @@ insert-before or insert-after.\n");
         const size_t argc = input.GetArgumentCount();
         const char *arg = NULL;
         int setting_var_idx;
-        for (setting_var_idx = 1; setting_var_idx < argc; ++setting_var_idx)
+        for (setting_var_idx = 1; setting_var_idx < static_cast<int>(argc);
+             ++setting_var_idx)
         {
             arg = input.GetArgumentAtIndex(setting_var_idx);
             if (arg && arg[0] != '-')
index a8cef0fb1ba5120e48452006f5d440709908c516..364d9effb61a7a74231a47a7fdbdec4d9e9e7163 100644 (file)
@@ -100,7 +100,7 @@ public:
 static bool
 WarnOnPotentialUnquotedUnsignedType (Args& command, CommandReturnObject &result)
 {
-    for (int idx = 0; idx < command.GetArgumentCount(); idx++)
+    for (unsigned idx = 0; idx < command.GetArgumentCount(); idx++)
     {
         const char* arg = command.GetArgumentAtIndex(idx);
         if (idx+1 < command.GetArgumentCount())
index 4a090dbe5ec88b6109b70bbc29f8db6b86899415..05ada9872b5b30bf718be751a956c86f486685f9 100644 (file)
@@ -127,7 +127,7 @@ ConnectionMachPort::BootstrapCheckIn (const char *port, Error *error_ptr)
     {
         name_t port_name;
         int len = snprintf(port_name, sizeof(port_name), "%s", port);
-        if (len < sizeof(port_name))
+        if (static_cast<size_t>(len) < sizeof(port_name))
         {
             kret = ::bootstrap_check_in (bootstrap_port, 
                                          port_name, 
@@ -160,7 +160,7 @@ ConnectionMachPort::BootstrapLookup (const char *port,
 
     if (port && port[0])
     {
-        if (::snprintf (port_name, sizeof (port_name), "%s", port) >= sizeof (port_name))
+        if (static_cast<size_t>(::snprintf (port_name, sizeof (port_name), "%s", port)) >= sizeof (port_name))
         {
             if (error_ptr)
                 error_ptr->SetErrorString ("port netname is too long");
index b385a252b9eb68ebf11c2060168248075731e3f0..9dc536b9586a6c17f4ada78384fd27c7de111e5e 100644 (file)
@@ -240,7 +240,8 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd,
         struct stat stat;
         if (::fstat(fd, &stat) == 0)
         {
-            if (S_ISREG(stat.st_mode) && (stat.st_size > offset))
+            if (S_ISREG(stat.st_mode) &&
+                (stat.st_size > static_cast<off_t>(offset)))
             {
                 const size_t max_bytes_available = stat.st_size - offset;
                 if (length == SIZE_MAX)
index 7c1f5f257b67621ccff6bd0ad1bc94e7aa627a5e..738780de0bb969229002bf070f743d2e0fdfc405 100644 (file)
@@ -1332,7 +1332,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                     const size_t max_length = help_delegate_ap->GetMaxLineLength();
                     Rect bounds = GetBounds();
                     bounds.Inset(1, 1);
-                    if (max_length + 4 < bounds.size.width)
+                    if (max_length + 4 < static_cast<size_t>(bounds.size.width))
                     {
                         bounds.origin.x += (bounds.size.width - max_length + 4)/2;
                         bounds.size.width = max_length + 4;
@@ -1347,7 +1347,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                         }
                     }
                     
-                    if (num_lines + 2 < bounds.size.height)
+                    if (num_lines + 2 < static_cast<size_t>(bounds.size.height))
                     {
                         bounds.origin.y += (bounds.size.height - num_lines + 2)/2;
                         bounds.size.height = num_lines + 2;
@@ -1845,9 +1845,9 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
         for (size_t i=0; i<num_submenus; ++i)
         {
             Menu *submenu = submenus[i].get();
-            if (m_max_submenu_name_length < submenu->m_name.size())
+            if (static_cast<size_t>(m_max_submenu_name_length) < submenu->m_name.size())
                 m_max_submenu_name_length = submenu->m_name.size();
-            if (m_max_submenu_key_name_length < submenu->m_key_name.size())
+            if (static_cast<size_t>(m_max_submenu_key_name_length) < submenu->m_key_name.size())
                 m_max_submenu_key_name_length = submenu->m_key_name.size();
         }
     }
@@ -1856,9 +1856,9 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
     Menu::AddSubmenu (const MenuSP &menu_sp)
     {
         menu_sp->m_parent = this;
-        if (m_max_submenu_name_length < menu_sp->m_name.size())
+        if (static_cast<size_t>(m_max_submenu_name_length) < menu_sp->m_name.size())
             m_max_submenu_name_length = menu_sp->m_name.size();
-        if (m_max_submenu_key_name_length < menu_sp->m_key_name.size())
+        if (static_cast<size_t>(m_max_submenu_key_name_length) < menu_sp->m_key_name.size())
             m_max_submenu_key_name_length = menu_sp->m_key_name.size();
         m_submenus.push_back(menu_sp);
     }
@@ -1874,7 +1874,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
             if (width > 2)
             {
                 width -= 2;
-                for (size_t i=0; i< width; ++i)
+                for (int i=0; i< width; ++i)
                     window.PutChar(ACS_HLINE);
             }
             window.PutChar(ACS_RTEE);
@@ -1975,7 +1975,8 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                 window.Box();
                 for (size_t i=0; i<num_submenus; ++i)
                 {
-                    const bool is_selected = i == selected_idx;
+                    const bool is_selected =
+                      (i == static_cast<size_t>(selected_idx));
                     window.MoveCursor(x, y + i);
                     if (is_selected)
                     {
@@ -2014,7 +2015,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                 case KEY_DOWN:
                 case KEY_UP:
                     // Show last menu or first menu
-                    if (selected_idx < num_submenus)
+                    if (selected_idx < static_cast<int>(num_submenus))
                         run_menu_sp = submenus[selected_idx];
                     else if (!submenus.empty())
                         run_menu_sp = submenus.front();
@@ -2024,9 +2025,9 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                 case KEY_RIGHT:
                 {
                     ++m_selected;
-                    if (m_selected >= num_submenus)
+                    if (m_selected >= static_cast<int>(num_submenus))
                         m_selected = 0;
-                    if (m_selected < num_submenus)
+                    if (m_selected < static_cast<int>(num_submenus))
                         run_menu_sp = submenus[m_selected];
                     else if (!submenus.empty())
                         run_menu_sp = submenus.front();
@@ -2039,7 +2040,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                     --m_selected;
                     if (m_selected < 0)
                         m_selected = num_submenus - 1;
-                    if (m_selected < num_submenus)
+                    if (m_selected < static_cast<int>(num_submenus))
                         run_menu_sp = submenus[m_selected];
                     else if (!submenus.empty())
                         run_menu_sp = submenus.front();
@@ -2093,7 +2094,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                         const int start_select = m_selected;
                         while (++m_selected != start_select)
                         {
-                            if (m_selected >= num_submenus)
+                            if (static_cast<size_t>(m_selected) >= num_submenus)
                                 m_selected = 0;
                             if (m_submenus[m_selected]->GetType() == Type::Separator)
                                 continue;
@@ -2110,7 +2111,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                         const int start_select = m_selected;
                         while (--m_selected != start_select)
                         {
-                            if (m_selected < 0)
+                            if (m_selected < static_cast<int>(0))
                                 m_selected = num_submenus - 1;
                             if (m_submenus[m_selected]->GetType() == Type::Separator)
                                 continue;
@@ -2122,7 +2123,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
                     break;
                     
                 case KEY_RETURN:
-                    if (selected_idx < num_submenus)
+                    if (static_cast<size_t>(selected_idx) < num_submenus)
                     {
                         if (submenus[selected_idx]->Action() == MenuActionResult::Quit)
                             return eQuitApplication;
@@ -2679,7 +2680,8 @@ public:
                 window.PutChar (ACS_DIAMOND);
                 window.PutChar (ACS_HLINE);
             }
-            bool highlight = (selected_row_idx == m_row_idx) && window.IsActive();
+            bool highlight =
+              (selected_row_idx == static_cast<size_t>(m_row_idx)) && window.IsActive();
 
             if (highlight)
                 window.AttributeOn(A_REVERSE);
@@ -2746,11 +2748,11 @@ public:
     TreeItem *
     GetItemForRowIndex (uint32_t row_idx)
     {
-        if (m_row_idx == row_idx)
+        if (static_cast<uint32_t>(m_row_idx) == row_idx)
             return this;
         if (m_children.empty())
             return NULL;
-        if (m_children.back().m_row_idx < row_idx)
+        if (static_cast<uint32_t>(m_children.back().m_row_idx) < row_idx)
             return NULL;
         if (IsExpanded())
         {
@@ -3459,7 +3461,7 @@ public:
                 // Page up key
                 if (m_first_visible_row > 0)
                 {
-                    if (m_first_visible_row > m_max_y)
+                    if (static_cast<int>(m_first_visible_row) > m_max_y)
                         m_first_visible_row -= m_max_y;
                     else
                         m_first_visible_row = 0;
@@ -3470,7 +3472,7 @@ public:
             case '.':
             case KEY_NPAGE:
                 // Page down key
-                if (m_num_rows > m_max_y)
+                if (m_num_rows > static_cast<size_t>(m_max_y))
                 {
                     if (m_first_visible_row + m_max_y < m_num_rows)
                     {
@@ -3637,7 +3639,7 @@ protected:
             // Save the row index in each Row structure
             row.row_idx = m_num_rows;
             if ((m_num_rows >= m_first_visible_row) &&
-                ((m_num_rows - m_first_visible_row) < NumVisibleRows()))
+                ((m_num_rows - m_first_visible_row) < static_cast<size_t>(NumVisibleRows())))
             {
                 row.x = m_min_x;
                 row.y = m_num_rows - m_first_visible_row + 1;
@@ -4009,7 +4011,7 @@ HelpDialogDelegate::WindowDelegateDraw (Window &window, bool force)
     int y = 1;
     const int min_y = y;
     const int max_y = window_height - 1 - y;
-    const int num_visible_lines = max_y - min_y + 1;
+    const size_t num_visible_lines = max_y - min_y + 1;
     const size_t num_lines = m_text.GetSize();
     const char *bottom_message;
     if (num_lines <= num_visible_lines)
@@ -4057,7 +4059,7 @@ HelpDialogDelegate::WindowDelegateHandleChar (Window &window, int key)
             case ',':
                 if (m_first_visible_line > 0)
                 {
-                    if (m_first_visible_line >= num_visible_lines)
+                    if (static_cast<size_t>(m_first_visible_line) >= num_visible_lines)
                         m_first_visible_line -= num_visible_lines;
                     else
                         m_first_visible_line = 0;
@@ -4068,7 +4070,7 @@ HelpDialogDelegate::WindowDelegateHandleChar (Window &window, int key)
                 if (m_first_visible_line + num_visible_lines < num_lines)
                 {
                     m_first_visible_line += num_visible_lines;
-                    if (m_first_visible_line > num_lines)
+                    if (static_cast<size_t>(m_first_visible_line) > num_lines)
                         m_first_visible_line = num_lines - num_visible_lines;
                 }
                 break;
@@ -4681,7 +4683,7 @@ public:
                     {
                         // Same file, nothing to do, we should either have the
                         // lines or not (source file missing)
-                        if (m_selected_line >= m_first_visible_line)
+                        if (m_selected_line >= static_cast<size_t>(m_first_visible_line))
                         {
                             if (m_selected_line >= m_first_visible_line + num_visible_lines)
                                 m_first_visible_line = m_selected_line - 10;
@@ -4825,7 +4827,7 @@ public:
             const attr_t selected_highlight_attr = A_REVERSE;
             const attr_t pc_highlight_attr = COLOR_PAIR(1);
 
-            for (int i=0; i<num_visible_lines; ++i)
+            for (size_t i=0; i<num_visible_lines; ++i)
             {
                 const uint32_t curr_line = m_first_visible_line + i;
                 if (curr_line < num_source_lines)
@@ -4947,12 +4949,12 @@ public:
                 }
 
                 const uint32_t non_visible_pc_offset = (num_visible_lines / 5);
-                if (m_first_visible_line >= num_disassembly_lines)
+                if (static_cast<size_t>(m_first_visible_line) >= num_disassembly_lines)
                     m_first_visible_line = 0;
 
                 if (pc_idx < num_disassembly_lines)
                 {
-                    if (pc_idx < m_first_visible_line ||
+                    if (pc_idx < static_cast<uint32_t>(m_first_visible_line) ||
                         pc_idx >= m_first_visible_line + num_visible_lines)
                         m_first_visible_line = pc_idx - non_visible_pc_offset;
                 }
@@ -5087,7 +5089,7 @@ public:
             case ',':
             case KEY_PPAGE:
                 // Page up key
-                if (m_first_visible_line > num_visible_lines)
+                if (static_cast<uint32_t>(m_first_visible_line) > num_visible_lines)
                     m_first_visible_line -= num_visible_lines;
                 else
                     m_first_visible_line = 0;
@@ -5112,7 +5114,7 @@ public:
                 if (m_selected_line > 0)
                 {
                     m_selected_line--;
-                    if (m_first_visible_line > m_selected_line)
+                    if (static_cast<size_t>(m_first_visible_line) > m_selected_line)
                         m_first_visible_line = m_selected_line;
                 }
                 return eKeyHandled;
index 2bf7f5eae9b0871a39dff81d99fb144be987e24a..73f5f85923c6d91e874eedba709b234f992ce3c7 100644 (file)
@@ -63,7 +63,7 @@ Opcode::Dump (Stream *s, uint32_t min_byte_width)
 
     // Add spaces to make sure bytes dispay comes out even in case opcodes
     // aren't all the same size
-    if (bytes_written < min_byte_width)
+    if (static_cast<uint32_t>(bytes_written) < min_byte_width)
         bytes_written = s->Printf ("%*s", min_byte_width - bytes_written, "");
     return bytes_written;
 }
index a4b7a1235ffab8cdc7594481c1bb534e17e3ec60..342ced78effe20b42eda56f7cf789e97c919328d 100644 (file)
@@ -160,7 +160,7 @@ lldb_private::formatters::CFBitVectorSummaryProvider (ValueObject& valobj, Strea
     if (error.Fail() || num_bytes == 0)
         return false;
     uint8_t *bytes = buffer_sp->GetBytes();
-    for (int byte_idx = 0; byte_idx < num_bytes-1; byte_idx++)
+    for (uint64_t byte_idx = 0; byte_idx < num_bytes-1; byte_idx++)
     {
         uint8_t byte = bytes[byte_idx];
         bool bit0 = (byte & 1) == 1;
index 5552cb3d5d7644ad912f334f4409a1effd5b4721..6b5748b52ce9e5f76cbcbdd7a8e2bf09ab2120e4 100644 (file)
@@ -642,7 +642,7 @@ IRInterpreter::Interpret (llvm::Module &module,
          ai != ae;
          ++ai, ++arg_index)
     {
-        if (args.size() < arg_index)
+        if (args.size() < static_cast<size_t>(arg_index))
         {
             error.SetErrorString ("Not enough arguments passed in to function");
             return false;
index 624ff4205d62f1aed1f1c6a0902fb8ed2d330e3f..2886644c5ebd513a30930b34f9c90b8bf1ceb465 100644 (file)
@@ -1786,8 +1786,8 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i
         cpu_type_t cpu = arch_spec.GetMachOCPUType();
         cpu_type_t sub = arch_spec.GetMachOCPUSubType();
         if (cpu != 0 &&
-            cpu != UINT32_MAX &&
-            cpu != LLDB_INVALID_CPUTYPE &&
+            cpu != static_cast<cpu_type_t>(UINT32_MAX) &&
+            cpu != static_cast<cpu_type_t>(LLDB_INVALID_CPUTYPE) &&
             !(cpu == 0x01000007 && sub == 8)) // If haswell is specified, don't try to set the CPU type or we will fail 
         {
             size_t ocount = 0;
@@ -2306,7 +2306,7 @@ Host::Readlink (const char *path, char *buf, size_t buf_len)
     ssize_t count = ::readlink(path, buf, buf_len);
     if (count < 0)
         error.SetErrorToErrno();
-    else if (count < (buf_len-1))
+    else if (static_cast<size_t>(count) < (buf_len-1))
         buf[count] = '\0'; // Success
     else
         error.SetErrorString("'buf' buffer is too small to contain link contents");
@@ -2391,7 +2391,8 @@ Host::WriteFile (lldb::user_id_t fd, uint64_t offset, const void* src, uint64_t
         error.SetErrorString ("invalid host backing file");
         return UINT64_MAX;
     }
-    if (file_sp->SeekFromStart(offset, &error) != offset || error.Fail())
+    if (static_cast<uint64_t>(file_sp->SeekFromStart(offset, &error)) != offset ||
+        error.Fail())
         return UINT64_MAX;
     size_t bytes_written = src_len;
     error = file_sp->Write(src, bytes_written);
@@ -2421,7 +2422,8 @@ Host::ReadFile (lldb::user_id_t fd, uint64_t offset, void* dst, uint64_t dst_len
         error.SetErrorString ("invalid host backing file");
         return UINT64_MAX;
     }
-    if (file_sp->SeekFromStart(offset, &error) != offset || error.Fail())
+    if (static_cast<uint64_t>(file_sp->SeekFromStart(offset, &error)) != offset ||
+        error.Fail())
         return UINT64_MAX;
     size_t bytes_read = dst_len;
     error = file_sp->Read(dst ,bytes_read);
index f63c468bb92c71168fed0f4305f053c17b9aa32c..811d712ea0de053dca0a6aabd8b9804100387d6f 100644 (file)
@@ -250,7 +250,7 @@ TerminalState::TTYStateIsValid() const
 bool
 TerminalState::ProcessGroupIsValid() const
 {
-    return m_process_group != -1;
+    return static_cast<int32_t>(m_process_group) != -1;
 }
 
 //------------------------------------------------------------------
index 441a431fe0a5a166df1086ff95c4f32e88f39ade..3c05243f92a87715aac8185e1c609448519c4338 100644 (file)
@@ -520,7 +520,7 @@ Host::GetDistributionId ()
             "/usr/bin/lsb_release"
         };
 
-        for (int exe_index = 0;
+        for (size_t exe_index = 0;
              exe_index < sizeof (exe_paths) / sizeof (exe_paths[0]);
              ++exe_index)
         {
index b9d2419dcdfd1956bc520f72bb9820f376dd2355..4817f412e0bdd446c31d7021d2b4e7c444489315 100644 (file)
@@ -1171,7 +1171,7 @@ GetMacOSXProcessArgs (const ProcessInstanceInfoMatch *match_info_ptr,
                     }
                     // Now extract all arguments
                     Args &proc_args = process_info.GetArguments();
-                    for (int i=0; i<argc; ++i)
+                    for (int i=0; i<static_cast<int>(argc); ++i)
                     {
                         cstr = data.GetCStr(&offset);
                         if (cstr)
@@ -1248,7 +1248,7 @@ Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstance
     bool all_users = match_info.GetMatchAllUsers();
     const lldb::pid_t our_pid = getpid();
     const uid_t our_uid = getuid();
-    for (int i = 0; i < actual_pid_count; i++)
+    for (size_t i = 0; i < actual_pid_count; i++)
     {
         const struct kinfo_proc &kinfo = kinfos[i];
         
@@ -1263,7 +1263,7 @@ Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstance
           kinfo_user_matches = true;
 
         if (kinfo_user_matches == false         || // Make sure the user is acceptable
-            kinfo.kp_proc.p_pid == our_pid      || // Skip this process
+            static_cast<lldb::pid_t>(kinfo.kp_proc.p_pid) == our_pid || // Skip this process
             kinfo.kp_proc.p_pid == 0            || // Skip kernel (kernel pid is zero)
             kinfo.kp_proc.p_stat == SZOMB       || // Zombies are bad, they like brains...
             kinfo.kp_proc.p_flag & P_TRACED     || // Being debugged?
@@ -1327,9 +1327,9 @@ PackageXPCArguments (xpc_object_t message, const char *prefix, const Args& args)
     memset(buf, 0, 50);
     sprintf(buf, "%sCount", prefix);
        xpc_dictionary_set_int64(message, buf, count);
-    for (int i=0; i<count; i++) {
+    for (size_t i=0; i<count; i++) {
         memset(buf, 0, 50);
-        sprintf(buf, "%s%i", prefix, i);
+        sprintf(buf, "%s%zi", prefix, i);
         xpc_dictionary_set_string(message, buf, args.GetArgumentAtIndex(i));
     }
 }
index b6f34fd1f7fb5bc3a7339ab67eb069e2d237f137..774d1bbc5682d2a1d77252bb302a219c9d0fb9a4 100644 (file)
@@ -1516,11 +1516,11 @@ Args::ParseArgsForCompletion
             // were passed.  This will be useful when we come to restricting completions based on what other
             // options we've seen on the line.
 
-            if (OptionParser::GetOptionIndex() < dummy_vec.size() - 1
+            if (static_cast<size_t>(OptionParser::GetOptionIndex()) < dummy_vec.size() - 1
                 && (strcmp (dummy_vec[OptionParser::GetOptionIndex()-1], "--") == 0))
             {
                 dash_dash_pos = OptionParser::GetOptionIndex() - 1;
-                if (OptionParser::GetOptionIndex() - 1 == cursor_index)
+                if (static_cast<size_t>(OptionParser::GetOptionIndex() - 1) == cursor_index)
                 {
                     option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDoubleDash, OptionParser::GetOptionIndex() - 1,
                                                                    OptionArgElement::eBareDoubleDash));
@@ -1630,7 +1630,7 @@ Args::ParseArgsForCompletion
     // the option_element_vector, but only if it is not after the "--".  But it turns out that OptionParser::Parse just ignores
     // an isolated "-".  So we have to look it up by hand here.  We only care if it is AT the cursor position.
     
-    if ((dash_dash_pos == -1 || cursor_index < dash_dash_pos)
+    if ((static_cast<int32_t>(dash_dash_pos) == -1 || cursor_index < dash_dash_pos)
          && strcmp (GetArgumentAtIndex(cursor_index), "-") == 0)
     {
         option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDash, cursor_index, 
index 18f108bb58aeac6cd1aed7785b9d779a7a6fa9e9..6dfb2ca72801f55d87e94cc7ab8ad487b3225e33 100644 (file)
@@ -1363,7 +1363,7 @@ CommandInterpreter::BuildAliasResult (const char *alias_name,
                         int index = GetOptionArgumentPosition (value.c_str());
                         if (index == 0)
                             result_str.Printf ("%s", value.c_str());
-                        else if (index >= cmd_args.GetArgumentCount())
+                        else if (static_cast<size_t>(index) >= cmd_args.GetArgumentCount())
                         {
                             
                             result.AppendErrorWithFormat
@@ -2254,7 +2254,7 @@ CommandInterpreter::BuildAliasCommandArgs (CommandObject *alias_cmd_obj,
                         }
 
                     }
-                    else if (index >= cmd_args.GetArgumentCount())
+                    else if (static_cast<size_t>(index) >= cmd_args.GetArgumentCount())
                     {
                         result.AppendErrorWithFormat
                                     ("Not enough arguments provided; you need at least %d arguments to use this alias.\n",
index c6995366c87a0a9ac0806f1440badcf236433bc1..0dba2a3283fbf3ee71d717722331353f7d674d6f 100644 (file)
@@ -477,7 +477,7 @@ CommandObject::GetNumArgumentEntries  ()
 CommandObject::CommandArgumentEntry *
 CommandObject::GetArgumentEntryAtIndex (int idx)
 {
-    if (idx < m_arguments.size())
+    if (static_cast<size_t>(idx) < m_arguments.size())
         return &(m_arguments[idx]);
 
     return NULL;
index 9a015580bd6cbb413c188ebd736b0ebd1f65bcd2..ee70a0ac1fc42608ddc487bd9441c23dc9a122a9 100644 (file)
@@ -222,7 +222,8 @@ OptionValueArray::SetArgs (const Args &args, VarSetOperationType op)
             size_t i;
             for (i=0; i<argc; ++i)
             {
-                const int idx = Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
+                const size_t idx =
+                  Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
                 if (idx >= size)
                 {
                     all_indexes_valid = false;
index c6c66d8ac650d766ea51849757e8c1df6b5a08ce..ce987576a97a630980866e41486eadb8f1a808ac 100644 (file)
@@ -344,7 +344,7 @@ Options::OutputFormattedUsageText
 
     // Will it all fit on one line?
 
-    if ((len + strm.GetIndentLevel()) < output_max_columns)
+    if (static_cast<uint32_t>(len + strm.GetIndentLevel()) < output_max_columns)
     {
         // Output it as a single line.
         strm.Indent (text);
index 1b6c7ef55ae7c06e0b38d1f5a7c0dc91c25a4b8a..a7f6ce64d67ce6df8b8217f270fb675cd36f2c6a 100644 (file)
@@ -237,10 +237,10 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread,
 {
     RegisterContext *reg_ctx = thread.GetRegisterContext().get();
     if (!reg_ctx)
-        return false;    
-    
+        return false;
+
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-    
+
     if (log)
     {
         StreamString s;
@@ -249,8 +249,8 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread,
                  (uint64_t)sp,
                  (uint64_t)func_addr,
                  (uint64_t)return_addr);
-        
-        for (int i = 0; i < args.size(); ++i)
+
+        for (size_t i = 0; i < args.size(); ++i)
             s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]);
         s.PutCString (")");
         log->PutCString(s.GetString().c_str());
@@ -259,12 +259,12 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread,
     const uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
     const uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
     const uint32_t ra_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
-    
+
     // x0 - x7 contain first 8 simple args
     if (args.size() > 8) // TODO handle more than 6 arguments
         return false;
-    
-    for (int i = 0; i < args.size(); ++i)
+
+    for (size_t i = 0; i < args.size(); ++i)
     {
         const RegisterInfo *reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
         if (log)
@@ -276,15 +276,15 @@ ABIMacOSX_arm64::PrepareTrivialCall (Thread &thread,
     // Set "lr" to the return address
     if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (ra_reg_num), return_addr))
         return false;
-    
+
     // Set "sp" to the requested value
     if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (sp_reg_num), sp))
         return false;
-    
+
     // Set "pc" to the address requested
     if (!reg_ctx->WriteRegisterFromUnsigned (reg_ctx->GetRegisterInfoAtIndex (pc_reg_num), func_addr))
         return false;
-    
+
     return true;
 }
 
index 763a00aa9a7fe5acc39e52aa0eefb7d1a14ad290..1316da48eedd0de5ebd59e4ffbe6ddfe933cc1f6 100644 (file)
@@ -316,8 +316,8 @@ ABISysV_x86_64::PrepareTrivialCall (Thread &thread,
                     (uint64_t)func_addr,
                     (uint64_t)return_addr);
 
-        for (int i = 0; i < args.size(); ++i)
-            s.Printf (", arg%d = 0x%" PRIx64, i + 1, args[i]);
+        for (size_t i = 0; i < args.size(); ++i)
+            s.Printf (", arg%zd = 0x%" PRIx64, i + 1, args[i]);
         s.PutCString (")");
         log->PutCString(s.GetString().c_str());
     }
@@ -331,11 +331,11 @@ ABISysV_x86_64::PrepareTrivialCall (Thread &thread,
     if (args.size() > 6) // TODO handle more than 6 arguments
         return false;
     
-    for (int i = 0; i < args.size(); ++i)
+    for (size_t i = 0; i < args.size(); ++i)
     {
         reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1 + i);
         if (log)
-            log->Printf("About to write arg%d (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
+            log->Printf("About to write arg%zd (0x%" PRIx64 ") into %s", i + 1, args[i], reg_info->name);
         if (!reg_ctx->WriteRegisterFromUnsigned(reg_info, args[i]))
             return false;
     }
index f475dbd773db39f1e140d01caebc37bdcc89cacd..2b9b34685463b2210216912c4dc4383da17174d6 100644 (file)
@@ -635,11 +635,11 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpointHit (void *baton,
         if (abi->GetArgumentValues (exe_ctx.GetThreadRef(), argument_values))
         {
             uint32_t dyld_mode = argument_values.GetValueAtIndex(0)->GetScalar().UInt (-1);
-            if (dyld_mode != -1)
+            if (dyld_mode != static_cast<uint32_t>(-1))
             {
                 // Okay the mode was right, now get the number of elements, and the array of new elements...
                 uint32_t image_infos_count = argument_values.GetValueAtIndex(1)->GetScalar().UInt (-1);
-                if (image_infos_count != -1)
+                if (image_infos_count != static_cast<uint32_t>(-1))
                 {
                     // Got the number added, now go through the array of added elements, putting out the mach header 
                     // address, and adding the image.
index 530e11af22c179d9616cd7aad05e0f1b265f7569..ec0f093e6ad2a79e354d2750c5fe60f68576fc4f 100644 (file)
@@ -329,7 +329,7 @@ ObjectFileJIT::ReadSectionData (const lldb_private::Section *section,
                                 size_t dst_len) const
 {
     lldb::offset_t file_size = section->GetFileSize();
-    if (section_offset < file_size)
+    if (section_offset < static_cast<off_t>(file_size))
     {
         uint64_t src_len = file_size - section_offset;
         if (src_len > dst_len)
index 814df8897a44ec7c7d36cedbef530d8546082ad1..84e3dddd16f04a1657bcb99a1cc5b054aeacd500 100644 (file)
@@ -4646,7 +4646,7 @@ ObjectFileMachO::GetProcessSharedCacheUUID (Process *process)
 
         Error err;
         uint32_t version_or_magic = process->ReadUnsignedIntegerFromMemory (all_image_infos, 4, -1, err);
-        if (version_or_magic != -1 
+        if (version_or_magic != static_cast<uint32_t>(-1)
             && version_or_magic != MH_MAGIC
             && version_or_magic != MH_CIGAM
             && version_or_magic != MH_MAGIC_64
index 198a1eb595c17a17e4c8375167cdbb988b30998a..8583f67ab0e73d3b9849b8ed70dcd9351df30a65 100644 (file)
@@ -1142,7 +1142,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
     if (envp == NULL || envp[0] == NULL)
         envp = const_cast<const char **>(environ);
 
-    if ((pid = terminal.Fork(err_str, err_len)) == -1)
+    if ((pid = terminal.Fork(err_str, err_len)) == static_cast<lldb::pid_t>(-1))
     {
         args->m_error.SetErrorToGenericError();
         args->m_error.SetErrorString("Process fork failed.");
@@ -1203,7 +1203,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
     }
 
     // Wait for the child process to to trap on its call to execve.
-    pid_t wpid;
+    lldb::pid_t wpid;
     int status;
     if ((wpid = waitpid(pid, &status, 0)) < 0)
     {
@@ -1746,7 +1746,7 @@ ProcessMonitor::StopThread(lldb::tid_t tid)
         if (log)
             log->Printf ("ProcessMonitor::%s(bp) waitpid, pid = %" PRIu64 ", status = %d", __FUNCTION__, wait_pid, status);
 
-        if (wait_pid == -1)
+        if (wait_pid == static_cast<lldb::pid_t>(-1))
         {
             // If we got interrupted by a signal (in our process, not the
             // inferior) try again.
index b7867c385e831f13d27d571bcdb8793d096f953c..744d7ada9c8cea40ac6705d4eab753ef33e6a9f4 100644 (file)
@@ -323,7 +323,7 @@ DynamicRegisterInfo::SetRegisterInfo (const lldb_private::PythonDictionary &dict
                     reg_info.encoding = (Encoding)reg_info_dict.GetItemForKeyAsInteger (encoding_pystr, eEncodingUint);
 
                 const int64_t set = reg_info_dict.GetItemForKeyAsInteger(set_pystr, -1);
-                if (set >= m_sets.size())
+                if (static_cast<size_t>(set) >= m_sets.size())
                 {
                     Clear();
                     return 0;
@@ -379,7 +379,7 @@ DynamicRegisterInfo::SetRegisterInfo (const lldb_private::PythonDictionary &dict
                                 if (invalidate_reg_num)
                                 {
                                     const int64_t r = invalidate_reg_num.GetInteger();
-                                    if (r != UINT64_MAX)
+                                    if (r != static_cast<int64_t>(UINT64_MAX))
                                         m_invalidate_regs_map[i].push_back(r);
                                     else
                                         printf("error: 'invalidate-regs' list value wasn't a valid integer\n");
index 5db08e5c26de5c83598ca975540a20d5d2d7675e..37fd4f489552ed916f2c6efc1c4de6cf51bcc9f6 100644 (file)
@@ -347,7 +347,7 @@ bool
 UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_reg)
 {
     int64_t frame_num = starting_frame_num;
-    if (frame_num >= m_frames.size())
+    if (static_cast<size_t>(frame_num) >= m_frames.size())
         return false;
 
     // Never interrogate more than one level while looking for the saved pc value.  If the value
index f436799a86a1f2cffdbce8ff76988492856b320b..706d67ea961a4a7fe665a933bdc0928acbe3e12f 100644 (file)
@@ -3106,7 +3106,7 @@ GDBRemoteCommunicationClient::GetFilePermissions(const char *path, uint32_t &fil
         else
         {
             const uint32_t mode = response.GetS32(-1);
-            if (mode == -1)
+            if (static_cast<int32_t>(mode) == -1)
             {
                 if (response.GetChar() == ',')
                 {
index 9e5b0d79e1017777c71612f99391727cbec7b3aa..acaf825d18b542bcf5aab8189836d4725cf2d511 100644 (file)
@@ -689,23 +689,23 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data
                             size_including_slice_registers += reg_info->byte_size;
                             if (reg_info->value_regs == NULL)
                                 size_not_including_slice_registers += reg_info->byte_size;
-                            if (reg_info->byte_offset >= size_by_highest_offset)
+                            if (static_cast<off_t>(reg_info->byte_offset) >= size_by_highest_offset)
                                 size_by_highest_offset = reg_info->byte_offset + reg_info->byte_size;
                         }
 
                         bool use_byte_offset_into_buffer;
-                        if (size_by_highest_offset == restore_data.GetByteSize())
+                        if (static_cast<size_t>(size_by_highest_offset) == restore_data.GetByteSize())
                         {
                             // The size of the packet agrees with the highest offset: + size in the register file
                             use_byte_offset_into_buffer = true;
                         }
-                        else if (size_not_including_slice_registers == restore_data.GetByteSize())
+                        else if (static_cast<size_t>(size_not_including_slice_registers) == restore_data.GetByteSize())
                         {
                             // The size of the packet is the same as concenating all of the registers sequentially,
                             // skipping the slice registers
                             use_byte_offset_into_buffer = true;
                         }
-                        else if (size_including_slice_registers == restore_data.GetByteSize())
+                        else if (static_cast<size_t>(size_including_slice_registers) == restore_data.GetByteSize())
                         {
                             // The slice registers are present in the packet (when they shouldn't be).
                             // Don't try to use the RegisterInfo byte_offset into the restore_data, it will
index b0375d1ceb37e582589825f1436e1401d95cf16a..f7eb613034dddee70fbb122689fff073a0eb5528 100644 (file)
@@ -795,7 +795,7 @@ DWARFDebugLine::ParseStatementTable
                 // as a multiple of LEB128 operands for each opcode.
                 {
                     uint8_t i;
-                    assert (opcode - 1 < prologue->standard_opcode_lengths.size());
+                    assert (static_cast<size_t>(opcode - 1) < prologue->standard_opcode_lengths.size());
                     const uint8_t opcode_length = prologue->standard_opcode_lengths[opcode - 1];
                     for (i=0; i<opcode_length; ++i)
                         debug_line_data.Skip_LEB128(offset_ptr);
index a7ed0e90a2c997ace0a1ddc500b6bc40051c52aa..b4495fde00c0efff301bf0cc4d46a187c1f7004f 100644 (file)
@@ -620,7 +620,8 @@ SystemRuntimeMacOSX::GetPendingItemRefsForQueue (lldb::addr_t queue)
                         pending_item_refs.new_style = true;
                         uint32_t item_size = extractor.GetU32(&offset);
                         uint32_t start_of_array_offset = offset;
-                        while (offset < pending_items_pointer.items_buffer_size && i < pending_items_pointer.count)
+                        while (offset < pending_items_pointer.items_buffer_size &&
+                               static_cast<size_t>(i) < pending_items_pointer.count)
                         {
                             offset = start_of_array_offset + (i * item_size);
                             ItemRefAndCodeAddress item;
@@ -634,7 +635,8 @@ SystemRuntimeMacOSX::GetPendingItemRefsForQueue (lldb::addr_t queue)
                     {
                         offset = 0;
                         pending_item_refs.new_style = false;
-                        while (offset < pending_items_pointer.items_buffer_size && i < pending_items_pointer.count)
+                        while (offset < pending_items_pointer.items_buffer_size &&
+                               static_cast<size_t>(i) < pending_items_pointer.count)
                         {
                             ItemRefAndCodeAddress item;
                             item.item_ref = extractor.GetPointer (&offset);
index 1768798f71d4e90ec743707b218afafd03ab7a86..ff7f758cf95d06bef6baea53a6f0cb0693629aff 100644 (file)
@@ -479,7 +479,8 @@ AssemblyParse_x86::instruction_length (Address addr, int &length)
     const bool prefer_file_cache = true;
     Error error;
     Target *target = m_exe_ctx.GetTargetPtr();
-    if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(), max_op_byte_size, error) == -1)
+    if (target->ReadMemory (addr, prefer_file_cache, opcode_data.data(),
+                            max_op_byte_size, error) == static_cast<size_t>(-1))
     {
         return false;
     }
@@ -552,7 +553,8 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan)
             // An unrecognized/junk instruction
             break;
         }
-        if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1)
+        if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes,
+                                insn_len, error) == static_cast<size_t>(-1))
         {
            // Error reading the instruction out of the file, stop scanning
            break;
@@ -600,7 +602,7 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan)
             bool need_to_push_row = false;
             // the PUSH instruction has moved the stack pointer - if the CFA is set in terms of the stack pointer,
             // we need to add a new row of instructions.
-            if (row->GetCFARegister() == m_lldb_sp_regnum)
+            if (row->GetCFARegister() == static_cast<uint32_t>(m_lldb_sp_regnum))
             {
                 need_to_push_row = true;
                 row->SetCFAOffset (current_sp_bytes_offset_from_cfa);
@@ -645,7 +647,7 @@ AssemblyParse_x86::get_non_call_site_unwind_plan (UnwindPlan &unwind_plan)
         if (sub_rsp_pattern_p (stack_offset))
         {
             current_sp_bytes_offset_from_cfa += stack_offset;
-            if (row->GetCFARegister() == m_lldb_sp_regnum)
+            if (row->GetCFARegister() == static_cast<uint32_t>(m_lldb_sp_regnum))
             {
                 row->SetOffset (current_func_text_offset + insn_len);
                 row->SetCFAOffset (current_sp_bytes_offset_from_cfa);
@@ -699,7 +701,8 @@ loopnext:
         uint8_t bytebuf[7];
         Address last_seven_bytes(end_of_fun);
         last_seven_bytes.SetOffset (last_seven_bytes.GetOffset() - 7);
-        if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7, error) != -1)
+        if (target->ReadMemory (last_seven_bytes, prefer_file_cache, bytebuf, 7,
+                                error) != static_cast<size_t>(-1))
         {
             if (bytebuf[5] == 0x5d && bytebuf[6] == 0xc3)  // mov, ret
             {
@@ -715,7 +718,8 @@ loopnext:
         uint8_t bytebuf[2];
         Address last_two_bytes(end_of_fun);
         last_two_bytes.SetOffset (last_two_bytes.GetOffset() - 2);
-        if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2, error) != -1)
+        if (target->ReadMemory (last_two_bytes, prefer_file_cache, bytebuf, 2,
+                                error) != static_cast<size_t>(-1))
         {
             if (bytebuf[0] == 0x5d && bytebuf[1] == 0xc3) // mov, ret
             {
@@ -776,7 +780,8 @@ AssemblyParse_x86::get_fast_unwind_plan (AddressRange& func, UnwindPlan &unwind_
     uint8_t bytebuf[4];
     Error error;
     const bool prefer_file_cache = true;
-    if (target->ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf, sizeof (bytebuf), error) == -1)
+    if (target->ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf,
+                            sizeof (bytebuf), error) == static_cast<size_t>(-1))
         return false;
 
     uint8_t i386_prologue[] = {0x55, 0x89, 0xe5};
@@ -859,7 +864,8 @@ AssemblyParse_x86::find_first_non_prologue_insn (Address &address)
             // An error parsing the instruction, i.e. probably data/garbage - stop scanning
             break;
         }
-        if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1)
+        if (target->ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes,
+                                insn_len, error) == static_cast<size_t>(-1))
         {
            // Error reading the instruction out of the file, stop scanning
            break;
index aff032f4cf2ea05c8b198be7f8590ed63eb41fd6..cbaf36c89c5526be1ec06232128c90fb011a95fb 100644 (file)
@@ -3268,7 +3268,7 @@ ClangASTType::GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
                                     // Setting this to UINT32_MAX to make sure we don't compute it twice...
                                     bit_offset = UINT32_MAX;
                                     
-                                    if (child_byte_offset == LLDB_INVALID_IVAR_OFFSET)
+                                    if (child_byte_offset == static_cast<int32_t>(LLDB_INVALID_IVAR_OFFSET))
                                     {
                                         bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx);
                                         child_byte_offset = bit_offset / 8;
index 931433540c6894644eb085718e4496da76268168..c3294c9437569e7a0ef39e7b4f1fe589ddc0b526 100644 (file)
@@ -486,7 +486,7 @@ ObjectFile::ReadSectionData (const Section *section, off_t section_offset, void
     else
     {
         const uint64_t section_file_size = section->GetFileSize();
-        if (section_offset < section_file_size)
+        if (section_offset < static_cast<off_t>(section_file_size))
         {
             const uint64_t section_bytes_left = section_file_size - section_offset;
             uint64_t section_dst_len = dst_len;
index 7b361e7d2eb9255f93735a48a14ba5c61f63e79d..470a3d50a632a76f1832d9d5a85e6f2701ec8097 100644 (file)
@@ -326,7 +326,7 @@ UnwindPlan::GetRowForFunctionOffset (int offset) const
             collection::const_iterator pos, end = m_row_list.end();
             for (pos = m_row_list.begin(); pos != end; ++pos)
             {
-                if ((*pos)->GetOffset() <= offset)
+                if ((*pos)->GetOffset() <= static_cast<lldb::offset_t>(offset))
                     row = *pos;
                 else
                     break;
index db23a0b27130d5801a2d497644ff23b33216bd45..0d70d03a4767b9055b0ac4cabd9c701a14f35b9b 100644 (file)
@@ -134,7 +134,7 @@ PathMappingList::Replace (const ConstString &path,
 bool
 PathMappingList::Remove (off_t index, bool notify)
 {
-    if (index >= m_pairs.size())
+    if (static_cast<size_t>(index) >= m_pairs.size())
         return false;
 
     ++m_mod_id;
@@ -161,7 +161,7 @@ PathMappingList::Dump (Stream *s, int pair_index)
     }
     else
     {
-        if (pair_index < numPairs)
+        if (static_cast<unsigned int>(pair_index) < numPairs)
             s->Printf("%s -> %s",
                       m_pairs[pair_index].first.GetCString(), m_pairs[pair_index].second.GetCString());
     }
index a936a57d048d93bbf2740ffdf91486fc5b2371a7..0ba30bed35f2bdeaae5a199c6333b3a520a0b6ea 100644 (file)
@@ -861,7 +861,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
                                                                             valobj_sp->GetTypeName().AsCString("<invalid type>"),
                                                                             var_expr_path_strm.GetString().c_str());
                                         }
-                                        else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
+                                        else if (static_cast<uint32_t>(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
                                         {
                                             valobj_sp->GetExpressionPath (var_expr_path_strm, false);
                                             error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", 
@@ -937,7 +937,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
                                                                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
                                                                         var_expr_path_strm.GetString().c_str());
                                     }
-                                    else if (child_index >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
+                                    else if (static_cast<uint32_t>(child_index) >= synthetic->GetNumChildren() /* synthetic does not have that many values */)
                                     {
                                         valobj_sp->GetExpressionPath (var_expr_path_strm, false);
                                         error.SetErrorStringWithFormat ("array index %ld is not valid for \"(%s) %s\"", 
index 1d7da985fbace98e51f53bd789b3619a38e40022..0f82617acf68f5c03ba4b73f35717810dd41db62 100644 (file)
@@ -2121,7 +2121,8 @@ Thread::IsStillAtLastBreakpointHit ()
             {
                 lldb::addr_t pc = reg_ctx_sp->GetPC();
                 BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(pc);
-                if (bp_site_sp && value == bp_site_sp->GetID())
+                if (bp_site_sp &&
+                    static_cast<break_id_t>(value) == bp_site_sp->GetID())
                     return true;
             }
         }
index 30f446d5bb51629a628326f01aa3233db6799bf7..23a70947e7fd6b0aacdfe5faff9b14446657b986 100644 (file)
@@ -297,7 +297,8 @@ lldb_private::GetVersion ()
         
         size_t version_len = sizeof(g_version_string);
         
-        if (newline_loc && (newline_loc - version_string < version_len))
+        if (newline_loc &&
+            (newline_loc - version_string < static_cast<ptrdiff_t>(version_len)))
             version_len = newline_loc - version_string;
         
         ::strncpy(g_version_string, version_string, version_len);