[Lldb-commits] [PATCH] D13866: Remove more gcc warnings.

Hafiz Abid Qadeer via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 19 05:59:25 PDT 2015


abidh created this revision.
abidh added a reviewer: clayborg.
abidh added a subscriber: lldb-commits.

I saw following gcc warnings in 3 places and they seem to make sense.

"comparison of unsigned expression >= 0 is always true [-Wtype-limits]"

To fix the warnings, I have removed the offending checks. OK?

http://reviews.llvm.org/D13866

Files:
  source/Plugins/Instruction/ARM/EmulationStateARM.cpp
  source/Utility/ARM64_DWARF_Registers.cpp

Index: source/Utility/ARM64_DWARF_Registers.cpp
===================================================================
--- source/Utility/ARM64_DWARF_Registers.cpp
+++ source/Utility/ARM64_DWARF_Registers.cpp
@@ -109,7 +109,7 @@
     ::memset (&reg_info, 0, sizeof(RegisterInfo));
     ::memset (reg_info.kinds, LLDB_INVALID_REGNUM, sizeof(reg_info.kinds));
     
-    if (reg_num >= x0 && reg_num <= pc)
+    if (reg_num <= pc)
     {
         reg_info.byte_size = 8;
         reg_info.format = eFormatHex;
Index: source/Plugins/Instruction/ARM/EmulationStateARM.cpp
===================================================================
--- source/Plugins/Instruction/ARM/EmulationStateARM.cpp
+++ source/Plugins/Instruction/ARM/EmulationStateARM.cpp
@@ -77,7 +77,7 @@
 bool
 EmulationStateARM::StorePseudoRegisterValue (uint32_t reg_num, uint64_t value)
 {
-    if ((dwarf_r0 <= reg_num) && (reg_num <= dwarf_cpsr))
+    if (reg_num <= dwarf_cpsr)
         m_gpr[reg_num  - dwarf_r0] = (uint32_t) value;
     else if ((dwarf_s0 <= reg_num) && (reg_num <= dwarf_s31))
     {
@@ -105,7 +105,7 @@
     uint64_t value = 0;
     success = true;
     
-    if ((dwarf_r0 <= reg_num) && (reg_num <= dwarf_cpsr))
+    if (reg_num <= dwarf_cpsr)
         value = m_gpr[reg_num  - dwarf_r0];
     else if ((dwarf_s0 <= reg_num) && (reg_num <= dwarf_s31))
     {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13866.37747.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151019/aa2b5ad0/attachment.bin>


More information about the lldb-commits mailing list