Isn't PRIuPTR (from inttypes.h) the portable way to print a uintptr_t?
On 12/27/17, 10:47 AM, "cfe-commits on behalf of Chandler Carruth via cfe-commits" <cfe-commits-boun...@lists.llvm.org on behalf of cfe-commits@lists.llvm.org> wrote: Author: chandlerc Date: Tue Dec 26 21:46:53 2017 New Revision: 321469 URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D321469-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=MrCL0yxupzyiw5gb5FUuieLYS_IsKGZWx7bEvlEEcIA&s=TtvpLBY95jLHo_IzHMotPEJ5BSh0lIHhmXjuGYj9GcY&e= 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: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libunwind_trunk_src_AddressSpace.hpp-3Frev-3D321469-26r1-3D321468-26r2-3D321469-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=MrCL0yxupzyiw5gb5FUuieLYS_IsKGZWx7bEvlEEcIA&s=ek_G7axgNz_LrqBu1RZ3clq1PkTu1FwDkkaFjZFu1T8&e= ============================================================================== --- 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) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=MrCL0yxupzyiw5gb5FUuieLYS_IsKGZWx7bEvlEEcIA&s=lW2e-8AqrhoM9xYXcuGtLKrqsZAff2PFJllWlzitxAc&e=
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits