[libcxx-commits] [libcxxabi] c4a735d - [libcxxabi] [test] Use the correct printf formats for printing pointers
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 17 07:50:48 PDT 2023
Author: Martin Storsjö
Date: 2023-04-17T17:49:56+03:00
New Revision: c4a735d445fd2e780e6e45e80ae721c0bd3d05d1
URL: https://github.com/llvm/llvm-project/commit/c4a735d445fd2e780e6e45e80ae721c0bd3d05d1
DIFF: https://github.com/llvm/llvm-project/commit/c4a735d445fd2e780e6e45e80ae721c0bd3d05d1.diff
LOG: [libcxxabi] [test] Use the correct printf formats for printing pointers
Don't cast the pointers to long, as that's not large enough for
pointers on 64 bit Windows.
Differential Revision: https://reviews.llvm.org/D147640
Added:
Modified:
libcxxabi/test/test_fallback_malloc.pass.cpp
Removed:
################################################################################
diff --git a/libcxxabi/test/test_fallback_malloc.pass.cpp b/libcxxabi/test/test_fallback_malloc.pass.cpp
index e7d22a57d2bc4..ff6ef60710c56 100644
--- a/libcxxabi/test/test_fallback_malloc.pass.cpp
+++ b/libcxxabi/test/test_fallback_malloc.pass.cpp
@@ -9,6 +9,7 @@
#include <cstdio>
#include <deque>
#include <cassert>
+#include <inttypes.h>
#include <__threading_support>
@@ -192,11 +193,11 @@ int main () {
print_free_list ();
char *p = (char *) fallback_malloc ( 1024 ); // too big!
- std::printf("fallback_malloc ( 1024 ) --> %lu\n", (unsigned long ) p);
+ std::printf("fallback_malloc ( 1024 ) --> %" PRIuPTR"\n", (uintptr_t) p);
print_free_list ();
p = (char *) fallback_malloc ( 32 );
- std::printf("fallback_malloc ( 32 ) --> %lu\n", (unsigned long) (p - heap));
+ std::printf("fallback_malloc ( 32 ) --> %" PRIuPTR"\n", (uintptr_t) (p - heap));
if ( !is_fallback_ptr ( p ))
std::printf("### p is not a fallback pointer!!\n");
More information about the libcxx-commits
mailing list