[Lldb-commits] [PATCH] D15357: Update code to silent some ARM/ARM64 specific compiler warnings

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 8 15:20:34 PST 2015


omjavaid created this revision.
omjavaid added a reviewer: tberghammer.
omjavaid added a subscriber: lldb-commits.
Herald added subscribers: rengolin, aemerson.

Following changes remove conditions where an unsigned integer is being tested to be greater or equal to zero.

These conditions will always remain true and will result in compiler warning though most compilers will optimize this out.

http://reviews.llvm.org/D15357

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: D15357.42239.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151208/eabe45c6/attachment.bin>


More information about the lldb-commits mailing list