[PATCH] D50412: Fix pointer-to-integer cast warnings on LLP64.

Charles Davis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 15:43:40 PDT 2018


cdavis5x updated this revision to Diff 159607.
cdavis5x added a comment.

Rebasing against HEAD.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D50412

Files:
  src/UnwindLevel1-gcc-ext.c
  src/UnwindLevel1.c


Index: src/UnwindLevel1.c
===================================================================
--- src/UnwindLevel1.c
+++ src/UnwindLevel1.c
@@ -287,7 +287,7 @@
     // If there is a personality routine, tell it we are unwinding.
     if (frameInfo.handler != 0) {
       __personality_routine p =
-          (__personality_routine)(long)(frameInfo.handler);
+          (__personality_routine)(intptr_t)(frameInfo.handler);
       _LIBUNWIND_TRACE_UNWINDING(
           "unwind_phase2_forced(ex_ojb=%p): calling personality function %p",
           (void *)exception_object, (void *)(uintptr_t)p);
Index: src/UnwindLevel1-gcc-ext.c
===================================================================
--- src/UnwindLevel1-gcc-ext.c
+++ src/UnwindLevel1-gcc-ext.c
@@ -33,9 +33,9 @@
                        (void *)exception_object,
                        (long)exception_object->unwinder_cache.reserved1);
 #else
-  _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld",
+  _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%" PRIdPTR,
                        (void *)exception_object,
-                       (long)exception_object->private_1);
+                       (intptr_t)exception_object->private_1);
 #endif
 
 #if defined(_LIBUNWIND_ARM_EHABI)
@@ -92,9 +92,9 @@
   unw_proc_info_t info;
   unw_getcontext(&uc);
   unw_init_local(&cursor, &uc);
-  unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(long) pc);
+  unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t) pc);
   if (unw_get_proc_info(&cursor, &info) == UNW_ESUCCESS)
-    return (void *)(long) info.start_ip;
+    return (void *)(intptr_t) info.start_ip;
   else
     return NULL;
 }
@@ -190,14 +190,14 @@
   unw_proc_info_t info;
   unw_getcontext(&uc);
   unw_init_local(&cursor, &uc);
-  unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(long) pc);
+  unw_set_reg(&cursor, UNW_REG_IP, (unw_word_t)(intptr_t) pc);
   unw_get_proc_info(&cursor, &info);
   bases->tbase = (uintptr_t)info.extra;
   bases->dbase = 0; // dbase not used on Mac OS X
   bases->func = (uintptr_t)info.start_ip;
   _LIBUNWIND_TRACE_API("_Unwind_Find_FDE(pc=%p) => %p", pc,
-                  (void *)(long) info.unwind_info);
-  return (void *)(long) info.unwind_info;
+                  (void *)(intptr_t) info.unwind_info);
+  return (void *)(intptr_t) info.unwind_info;
 }
 
 /// Returns the CFA (call frame area, or stack pointer at start of function)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50412.159607.patch
Type: text/x-patch
Size: 2438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180807/be3a66a2/attachment.bin>


More information about the llvm-commits mailing list