[libcxx-commits] [PATCH] D89547: [libcxxabi] Fix printf formats in a test.

Simon Tatham via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 16 05:57:07 PDT 2020


simon_tatham created this revision.
simon_tatham added reviewers: ldionne, miyuki.
Herald added subscribers: libcxx-commits, dexonsmith.
Herald added a project: libc++abi.
Herald added a reviewer: libc++abi.
simon_tatham requested review of this revision.

This is the libcxxabi counterpart of D89545 <https://reviews.llvm.org/D89545>, and would have been part
of that patch if I'd spotted it soon enough (oops). One test in
libcxxabi is using the `%lu` printf format to refer to `size_t`, which
should be `%zu`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89547

Files:
  libcxxabi/test/test_fallback_malloc.pass.cpp


Index: libcxxabi/test/test_fallback_malloc.pass.cpp
===================================================================
--- libcxxabi/test/test_fallback_malloc.pass.cpp
+++ libcxxabi/test/test_fallback_malloc.pass.cpp
@@ -73,7 +73,7 @@
 
 //  Delete in allocation order
     ptrs = alloc_series ( 32 );
-    std::printf("Allocated %lu 32 byte chunks\n", ptrs.size());
+    std::printf("Allocated %zu 32 byte chunks\n", ptrs.size());
     print_free_list ();
     for ( container::iterator iter = ptrs.begin (); iter != ptrs.end (); ++iter )
         fallback_free ( *iter );
@@ -82,7 +82,7 @@
 
 //  Delete in reverse order
     ptrs = alloc_series ( 32 );
-    std::printf("Allocated %lu 32 byte chunks\n", ptrs.size());
+    std::printf("Allocated %zu 32 byte chunks\n", ptrs.size());
     for ( container::reverse_iterator iter = ptrs.rbegin (); iter != ptrs.rend (); ++iter )
         fallback_free ( *iter );
     print_free_list ();
@@ -90,7 +90,7 @@
 
 //  Alternate deletions
     ptrs = alloc_series ( 32 );
-    std::printf("Allocated %lu 32 byte chunks\n", ptrs.size());
+    std::printf("Allocated %zu 32 byte chunks\n", ptrs.size());
     while ( ptrs.size () > 0 )
         fallback_free ( pop ( ptrs, ptrs.size () % 1 == 1 ));
     print_free_list ();
@@ -105,7 +105,8 @@
 //  Delete in allocation order
     ptrs = alloc_series ( 32, 1.5 );
 
-    std::printf("Allocated %lu { 32, 48, 72, 108, 162 ... } byte chunks\n", ptrs.size());
+    std::printf("Allocated %zu { 32, 48, 72, 108, 162 ... } byte chunks\n",
+                ptrs.size());
     print_free_list ();
     for ( container::iterator iter = ptrs.begin (); iter != ptrs.end (); ++iter )
         fallback_free ( *iter );
@@ -115,7 +116,8 @@
 //  Delete in reverse order
     print_free_list ();
     ptrs = alloc_series ( 32, 1.5 );
-    std::printf("Allocated %lu { 32, 48, 72, 108, 162 ... } byte chunks\n", ptrs.size());
+    std::printf("Allocated %zu { 32, 48, 72, 108, 162 ... } byte chunks\n",
+                ptrs.size());
     for ( container::reverse_iterator iter = ptrs.rbegin (); iter != ptrs.rend (); ++iter )
         fallback_free ( *iter );
     print_free_list ();
@@ -123,7 +125,8 @@
 
 //  Alternate deletions
     ptrs = alloc_series ( 32, 1.5 );
-    std::printf("Allocated %lu { 32, 48, 72, 108, 162 ... } byte chunks\n", ptrs.size());
+    std::printf("Allocated %zu { 32, 48, 72, 108, 162 ... } byte chunks\n",
+                ptrs.size());
     while ( ptrs.size () > 0 )
         fallback_free ( pop ( ptrs, ptrs.size () % 1 == 1 ));
     print_free_list ();
@@ -139,7 +142,7 @@
 
 //  Delete in allocation order
     ptrs = alloc_series ( allocs, sizeof ( allocs ) / sizeof ( allocs[0] ));
-    std::printf("Allocated %lu chunks\n", ptrs.size());
+    std::printf("Allocated %zu chunks\n", ptrs.size());
     print_free_list ();
     for ( container::iterator iter = ptrs.begin (); iter != ptrs.end (); ++iter )
         fallback_free ( *iter );
@@ -149,7 +152,7 @@
 //  Delete in reverse order
     print_free_list ();
     ptrs = alloc_series ( allocs, sizeof ( allocs ) / sizeof ( allocs[0] ));
-    std::printf("Allocated %lu chunks\n", ptrs.size());
+    std::printf("Allocated %zu chunks\n", ptrs.size());
     for ( container::reverse_iterator iter = ptrs.rbegin (); iter != ptrs.rend (); ++iter )
         fallback_free ( *iter );
     print_free_list ();
@@ -157,7 +160,7 @@
 
 //  Alternate deletions
     ptrs = alloc_series ( allocs, sizeof ( allocs ) / sizeof ( allocs[0] ));
-    std::printf("Allocated %lu chunks\n", ptrs.size());
+    std::printf("Allocated %zu chunks\n", ptrs.size());
     while ( ptrs.size () > 0 )
         fallback_free ( pop ( ptrs, ptrs.size () % 1 == 1 ));
     print_free_list ();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89547.298609.patch
Type: text/x-patch
Size: 3732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201016/59088b14/attachment.bin>


More information about the libcxx-commits mailing list