[libcxx-commits] [PATCH] D89545: [libcxx] Fix printf formats in two tests.

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4d60467f99a0: [libcxx] Fix printf formats in two tests. (authored by simon_tatham).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89545/new/

https://reviews.llvm.org/D89545

Files:
  libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
  libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp


Index: libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
===================================================================
--- libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -77,7 +77,8 @@
 bool balanced_allocs() {
     std::vector<int> temp1, temp2;
 
-    std::printf("Allocations = %lu, deallocations = %lu\n", ca_allocs.size(), ca_deallocs.size());
+    std::printf("Allocations = %zu, deallocations = %zu\n", ca_allocs.size(),
+                ca_deallocs.size());
     if (ca_allocs.size() != ca_deallocs.size())
         return false;
 
@@ -85,12 +86,12 @@
     std::sort(temp1.begin(), temp1.end());
     temp2.clear();
     std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
-    std::printf("There were %lu different allocators\n", temp2.size());
+    std::printf("There were %zu different allocators\n", temp2.size());
 
     for (std::vector<int>::const_iterator it = temp2.begin(); it != temp2.end(); ++it ) {
         std::ptrdiff_t const allocs = std::count(ca_allocs.begin(), ca_allocs.end(), *it);
         std::ptrdiff_t const deallocs = std::count(ca_deallocs.begin(), ca_deallocs.end(), *it);
-        std::printf("%d: %ld vs %ld\n", *it, allocs, deallocs);
+        std::printf("%d: %td vs %td\n", *it, allocs, deallocs);
         if (allocs != deallocs)
             return false;
     }
@@ -99,12 +100,12 @@
     std::sort(temp1.begin(), temp1.end());
     temp2.clear();
     std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
-    std::printf("There were %lu different (de)allocators\n", temp2.size());
+    std::printf("There were %zu different (de)allocators\n", temp2.size());
 
     for (std::vector<int>::const_iterator it = ca_deallocs.begin(); it != ca_deallocs.end(); ++it ) {
         std::ptrdiff_t const allocs = std::count(ca_allocs.begin(), ca_allocs.end(), *it);
         std::ptrdiff_t const deallocs = std::count(ca_deallocs.begin(), ca_deallocs.end(), *it);
-        std::printf("%d: %ld vs %ld\n", *it, allocs, deallocs);
+        std::printf("%d: %td vs %td\n", *it, allocs, deallocs);
         if (allocs != deallocs)
             return false;
     }
Index: libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
===================================================================
--- libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
+++ libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
@@ -31,12 +31,12 @@
 
 template <class Deque>
 static void print(const Deque& d) {
-  std::printf("%lu : __front_spare() == %lu"
-                 " : __back_spare() == %lu"
-                 " : __capacity() == %lu"
-                 " : bytes allocated == %lu\n",
-      d.size(), d.__front_spare(), d.__back_spare(), d.__capacity(),
-      malloc_allocator_base::outstanding_bytes);
+  std::printf("%zu : __front_spare() == %zu"
+              " : __back_spare() == %zu"
+              " : __capacity() == %zu"
+              " : bytes allocated == %zu\n",
+              d.size(), d.__front_spare(), d.__back_spare(), d.__capacity(),
+              malloc_allocator_base::outstanding_bytes);
 }
 
 template <class T>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89545.298607.patch
Type: text/x-patch
Size: 3340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201016/6844ca6b/attachment-0001.bin>


More information about the libcxx-commits mailing list