[libcxxabi] r211912 - Silence the implicit signed/unsigned conversion warning.

Logan Chien tzuhsiang.chien at gmail.com
Fri Jun 27 10:17:44 PDT 2014


Author: logan
Date: Fri Jun 27 12:17:44 2014
New Revision: 211912

URL: http://llvm.org/viewvc/llvm-project?rev=211912&view=rev
Log:
Silence the implicit signed/unsigned conversion warning.

Modified:
    libcxxabi/trunk/src/Unwind/AddressSpace.hpp
    libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp

Modified: libcxxabi/trunk/src/Unwind/AddressSpace.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/AddressSpace.hpp?rev=211912&r1=211911&r2=211912&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/AddressSpace.hpp (original)
+++ libcxxabi/trunk/src/Unwind/AddressSpace.hpp Fri Jun 27 12:17:44 2014
@@ -329,7 +329,7 @@ inline bool LocalAddressSpace::findUnwin
   int length = 0;
   info.arm_section = (uintptr_t) dl_unwind_find_exidx(
       (_Unwind_Ptr) targetAddr, &length);
-  info.arm_section_length = length;
+  info.arm_section_length = (uintptr_t)length;
   _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x\n",
                              info.arm_section, info.arm_section_length);
   if (info.arm_section && info.arm_section_length)

Modified: libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp?rev=211912&r1=211911&r2=211912&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp (original)
+++ libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp Fri Jun 27 12:17:44 2014
@@ -30,7 +30,7 @@ namespace {
 // signinficant byte.
 uint8_t getByte(uint32_t* data, size_t offset) {
   uint8_t* byteData = reinterpret_cast<uint8_t*>(data);
-  return byteData[(offset & ~0x03) + (3 - (offset&0x03))];
+  return byteData[(offset & ~(size_t)0x03) + (3 - (offset & (size_t)0x03))];
 }
 
 const char* getNextWord(const char* data, uint32_t* out) {
@@ -73,7 +73,8 @@ _Unwind_Reason_Code ProcessDescriptors(
     struct _Unwind_Context* context,
     Descriptor::Format format,
     const char* descriptorStart,
-    int flags) {
+    uint32_t flags) {
+
   // EHT is inlined in the index using compact form. No descriptors. #5
   if (flags & 0x1)
     return _URC_CONTINUE_UNWIND;
@@ -106,8 +107,8 @@ _Unwind_Reason_Code ProcessDescriptors(
         static_cast<Descriptor::Kind>((length & 0x1) | ((offset & 0x1) << 1));
 
     // Clear off flag from last bit.
-    length &= ~1;
-    offset &= ~1;
+    length &= ~1u;
+    offset &= ~1u;
     uintptr_t scopeStart = ucbp->pr_cache.fnstart + offset;
     uintptr_t scopeEnd = scopeStart + length;
     uintptr_t pc = _Unwind_GetIP(context);
@@ -209,7 +210,7 @@ uint32_t RegisterMask(uint8_t start, uin
 // Generates mask discriminator for _Unwind_VRS_Pop, e.g. for _UVRSC_VFP /
 // _UVRSD_DOUBLE.
 uint32_t RegisterRange(uint8_t start, uint8_t count_minus_one) {
-  return (start << 16) | (count_minus_one + 1);
+  return ((uint32_t)start << 16) | ((uint32_t)count_minus_one + 1);
 }
 
 } // end anonymous namespace
@@ -227,20 +228,21 @@ _Unwind_Reason_Code _Unwind_VRS_Interpre
       uint32_t sp;
       _Unwind_VRS_Get(context, _UVRSC_CORE, UNW_ARM_SP, _UVRSD_UINT32, &sp);
       if (byte & 0x40)
-        sp -= ((byte & 0x3f) << 2) + 4;
+        sp -= (((uint32_t)byte & 0x3f) << 2) + 4;
       else
-        sp += (byte << 2) + 4;
+        sp += ((uint32_t)byte << 2) + 4;
       _Unwind_VRS_Set(context, _UVRSC_CORE, UNW_ARM_SP, _UVRSD_UINT32, &sp);
     } else {
       switch (byte & 0xf0) {
         case 0x80: {
           if (offset >= len)
             return _URC_FAILURE;
-          uint16_t registers =
-              ((byte & 0x0f) << 12) | (getByte(data, offset++) << 4);
+          uint32_t registers =
+              (((uint32_t)byte & 0x0f) << 12) |
+              (((uint32_t)getByte(data, offset++)) << 4);
           if (!registers)
             return _URC_FAILURE;
-          if (registers & (1<<15))
+          if (registers & (1 << 15))
             wrotePC = true;
           _Unwind_VRS_Pop(context, _UVRSC_CORE, registers, _UVRSD_UINT32);
           break;
@@ -259,7 +261,7 @@ _Unwind_Reason_Code _Unwind_VRS_Interpre
         case 0xa0: {
           uint32_t registers = RegisterMask(4, byte & 0x07);
           if (byte & 0x08)
-            registers |= 1<<14;
+            registers |= 1 << 14;
           _Unwind_VRS_Pop(context, _UVRSC_CORE, registers, _UVRSD_UINT32);
           break;
         }
@@ -758,15 +760,15 @@ _Unwind_VRS_Result _Unwind_VRS_Set(
     case _UVRSC_CORE:
       if (representation != _UVRSD_UINT32 || regno > 15)
         return _UVRSR_FAILED;
-      return unw_set_reg(cursor, UNW_ARM_R0 + regno, *(unw_word_t *)valuep) ==
-                     UNW_ESUCCESS
+      return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
+                         *(unw_word_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
     case _UVRSC_WMMXC:
       if (representation != _UVRSD_UINT32 || regno > 3)
         return _UVRSR_FAILED;
-      return unw_set_reg(cursor, UNW_ARM_WC0 + regno, *(unw_word_t *)valuep) ==
-                     UNW_ESUCCESS
+      return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
+                         *(unw_word_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
     case _UVRSC_VFP:
@@ -781,14 +783,14 @@ _Unwind_VRS_Result _Unwind_VRS_Set(
         if (regno > 31)
           return _UVRSR_FAILED;
       }
-      return unw_set_fpreg(cursor, UNW_ARM_D0 + regno,
+      return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno),
                            *(unw_fpreg_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
     case _UVRSC_WMMXD:
       if (representation != _UVRSD_DOUBLE || regno > 31)
         return _UVRSR_FAILED;
-      return unw_set_fpreg(cursor, UNW_ARM_WR0 + regno,
+      return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
                            *(unw_fpreg_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
@@ -806,15 +808,15 @@ static _Unwind_VRS_Result _Unwind_VRS_Ge
     case _UVRSC_CORE:
       if (representation != _UVRSD_UINT32 || regno > 15)
         return _UVRSR_FAILED;
-      return unw_get_reg(cursor, UNW_ARM_R0 + regno, (unw_word_t *)valuep) ==
-                     UNW_ESUCCESS
+      return unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno),
+                         (unw_word_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
     case _UVRSC_WMMXC:
       if (representation != _UVRSD_UINT32 || regno > 3)
         return _UVRSR_FAILED;
-      return unw_get_reg(cursor, UNW_ARM_WC0 + regno, (unw_word_t *)valuep) ==
-                     UNW_ESUCCESS
+      return unw_get_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno),
+                         (unw_word_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
     case _UVRSC_VFP:
@@ -829,14 +831,14 @@ static _Unwind_VRS_Result _Unwind_VRS_Ge
         if (regno > 31)
           return _UVRSR_FAILED;
       }
-      return unw_get_fpreg(cursor, UNW_ARM_D0 + regno, (unw_fpreg_t *)valuep) ==
-                     UNW_ESUCCESS
+      return unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno),
+                           (unw_fpreg_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
     case _UVRSC_WMMXD:
       if (representation != _UVRSD_DOUBLE || regno > 31)
         return _UVRSR_FAILED;
-      return unw_get_fpreg(cursor, UNW_ARM_WR0 + regno,
+      return unw_get_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno),
                            (unw_fpreg_t *)valuep) == UNW_ESUCCESS
                  ? _UVRSR_OK
                  : _UVRSR_FAILED;
@@ -880,8 +882,8 @@ _Unwind_VRS_Result _Unwind_VRS_Pop(
                           _UVRSD_UINT32, &sp) != _UVRSR_OK) {
         return _UVRSR_FAILED;
       }
-      for (int i = 0; i < 16; ++i) {
-        if (!(discriminator & (1<<i)))
+      for (uint32_t i = 0; i < 16; ++i) {
+        if (!(discriminator & (1 << i)))
           continue;
         uint32_t value = *sp++;
         if (regclass == _UVRSC_CORE && i == 13)





More information about the cfe-commits mailing list