[libunwind] r321469 - There is no portable format string for printing `uintptr_t` values.

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 26 21:46:53 PST 2017


Author: chandlerc
Date: Tue Dec 26 21:46:53 2017
New Revision: 321469

URL: http://llvm.org/viewvc/llvm-project?rev=321469&view=rev
Log:
There is no portable format string for printing `uintptr_t` values.
Instead, cast them to `void *` which has a portable format string syntax
of `%p`.

This fixes a -Wformat error when building libunwind.

Modified:
    libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=321469&r1=321468&r2=321469&view=diff
==============================================================================
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Tue Dec 26 21:46:53 2017
@@ -384,13 +384,13 @@ inline bool LocalAddressSpace::findUnwin
   // Bare metal is statically linked, so no need to ask the dynamic loader
   info.dwarf_section_length = (uintptr_t)(&__eh_frame_end - &__eh_frame_start);
   info.dwarf_section =        (uintptr_t)(&__eh_frame_start);
-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
-                             info.dwarf_section, info.dwarf_section_length);
+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %p length %p",
+                             (void *)info.dwarf_section, (void *)info.dwarf_section_length);
 #if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX)
   info.dwarf_index_section =        (uintptr_t)(&__eh_frame_hdr_start);
   info.dwarf_index_section_length = (uintptr_t)(&__eh_frame_hdr_end - &__eh_frame_hdr_start);
-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: index section %X length %x",
-                             info.dwarf_index_section, info.dwarf_index_section_length);
+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: index section %p length %p",
+                             (void *)info.dwarf_index_section, (void *)info.dwarf_index_section_length);
 #endif
   if (info.dwarf_section_length)
     return true;
@@ -398,8 +398,8 @@ inline bool LocalAddressSpace::findUnwin
   // Bare metal is statically linked, so no need to ask the dynamic loader
   info.arm_section =        (uintptr_t)(&__exidx_start);
   info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start);
-  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
-                             info.arm_section, info.arm_section_length);
+  _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %p length %p",
+                             (void *)info.arm_section, (void *)info.arm_section_length);
   if (info.arm_section && info.arm_section_length)
     return true;
 #elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) && defined(_WIN32)




More information about the cfe-commits mailing list