unwind: silence -Wconversion warnings
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 11 Feb 2015 05:20:42 +0000 (05:20 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 11 Feb 2015 05:20:42 +0000 (05:20 +0000)
Clean up implicit uint8_t to uint32_t conversion warnings identified by GCC.

llvm-svn: 228805

libcxxabi/src/Unwind/Unwind-EHABI.cpp
libcxxabi/src/Unwind/UnwindCursor.hpp

index e2fced2..5830758 100644 (file)
@@ -324,7 +324,8 @@ _Unwind_Reason_Code _Unwind_VRS_Interpret(
             case 0xb3: {
               uint8_t v = getByte(data, offset++);
               _Unwind_VRS_Pop(context, _UVRSC_VFP,
-                              RegisterRange(v >> 4, v & 0x0f), _UVRSD_VFPX);
+                              RegisterRange(static_cast<uint8_t>(v >> 4),
+                                            v & 0x0f), _UVRSD_VFPX);
               break;
             }
             case 0xb4:
@@ -352,7 +353,7 @@ _Unwind_Reason_Code _Unwind_VRS_Interpret(
               break;
             case 0xc6: {
               uint8_t v = getByte(data, offset++);
-              uint8_t start = v >> 4;
+              uint8_t start = static_cast<uint8_t>(v >> 4);
               uint8_t count_minus_one = v & 0xf;
               if (start + count_minus_one >= 16)
                 return _URC_FAILURE;
@@ -371,7 +372,8 @@ _Unwind_Reason_Code _Unwind_VRS_Interpret(
             case 0xc8:
             case 0xc9: {
               uint8_t v = getByte(data, offset++);
-              uint8_t start = ((byte == 0xc8) ? 16 : 0) + (v >> 4);
+              uint8_t start =
+                  static_cast<uint8_t>(((byte == 0xc8) ? 16 : 0) + (v >> 4));
               uint8_t count_minus_one = v & 0xf;
               if (start + count_minus_one >= 32)
                 return _URC_FAILURE;
@@ -904,7 +906,7 @@ _Unwind_VRS_Result _Unwind_VRS_Pop(
         return _UVRSR_FAILED;
       }
       for (uint32_t i = 0; i < 16; ++i) {
-        if (!(discriminator & (1 << i)))
+        if (!(discriminator & static_cast<uint32_t>(1 << i)))
           continue;
         uint32_t value = *sp++;
         if (regclass == _UVRSC_CORE && i == 13)
index 10c866a..6817485 100644 (file)
@@ -736,8 +736,8 @@ bool UnwindCursor<A, R>::getInfoFromEHABISection(
   // in compact form (section 6.3 EHABI).
   if (exceptionTableData & 0x80000000) {
     // Grab the index of the personality routine from the compact form.
-    int choice = (exceptionTableData & 0x0f000000) >> 24;
-    int extraWords = 0;
+    uint32_t choice = (exceptionTableData & 0x0f000000) >> 24;
+    uint32_t extraWords = 0;
     switch (choice) {
       case 0:
         personalityRoutine = (unw_word_t) &__aeabi_unwind_cpp_pr0;