Skip to content

Commit bcb7b87

Browse files
committed
[libcxxabi] Fix printf formats in a test.
This is the libcxxabi counterpart of 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`. Reviewed By: ldionne, #libc_abi Differential Revision: https://reviews.llvm.org/D89547
1 parent 4d60467 commit bcb7b87

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

libcxxabi/test/test_fallback_malloc.pass.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void exhaustion_test1 () {
7373

7474
// Delete in allocation order
7575
ptrs = alloc_series ( 32 );
76-
std::printf("Allocated %lu 32 byte chunks\n", ptrs.size());
76+
std::printf("Allocated %zu 32 byte chunks\n", ptrs.size());
7777
print_free_list ();
7878
for ( container::iterator iter = ptrs.begin (); iter != ptrs.end (); ++iter )
7979
fallback_free ( *iter );
@@ -82,15 +82,15 @@ void exhaustion_test1 () {
8282

8383
// Delete in reverse order
8484
ptrs = alloc_series ( 32 );
85-
std::printf("Allocated %lu 32 byte chunks\n", ptrs.size());
85+
std::printf("Allocated %zu 32 byte chunks\n", ptrs.size());
8686
for ( container::reverse_iterator iter = ptrs.rbegin (); iter != ptrs.rend (); ++iter )
8787
fallback_free ( *iter );
8888
print_free_list ();
8989
std::printf("----\n");
9090

9191
// Alternate deletions
9292
ptrs = alloc_series ( 32 );
93-
std::printf("Allocated %lu 32 byte chunks\n", ptrs.size());
93+
std::printf("Allocated %zu 32 byte chunks\n", ptrs.size());
9494
while ( ptrs.size () > 0 )
9595
fallback_free ( pop ( ptrs, ptrs.size () % 1 == 1 ));
9696
print_free_list ();
@@ -105,7 +105,8 @@ void exhaustion_test2 () {
105105
// Delete in allocation order
106106
ptrs = alloc_series ( 32, 1.5 );
107107

108-
std::printf("Allocated %lu { 32, 48, 72, 108, 162 ... } byte chunks\n", ptrs.size());
108+
std::printf("Allocated %zu { 32, 48, 72, 108, 162 ... } byte chunks\n",
109+
ptrs.size());
109110
print_free_list ();
110111
for ( container::iterator iter = ptrs.begin (); iter != ptrs.end (); ++iter )
111112
fallback_free ( *iter );
@@ -115,15 +116,17 @@ void exhaustion_test2 () {
115116
// Delete in reverse order
116117
print_free_list ();
117118
ptrs = alloc_series ( 32, 1.5 );
118-
std::printf("Allocated %lu { 32, 48, 72, 108, 162 ... } byte chunks\n", ptrs.size());
119+
std::printf("Allocated %zu { 32, 48, 72, 108, 162 ... } byte chunks\n",
120+
ptrs.size());
119121
for ( container::reverse_iterator iter = ptrs.rbegin (); iter != ptrs.rend (); ++iter )
120122
fallback_free ( *iter );
121123
print_free_list ();
122124
std::printf("----\n");
123125

124126
// Alternate deletions
125127
ptrs = alloc_series ( 32, 1.5 );
126-
std::printf("Allocated %lu { 32, 48, 72, 108, 162 ... } byte chunks\n", ptrs.size());
128+
std::printf("Allocated %zu { 32, 48, 72, 108, 162 ... } byte chunks\n",
129+
ptrs.size());
127130
while ( ptrs.size () > 0 )
128131
fallback_free ( pop ( ptrs, ptrs.size () % 1 == 1 ));
129132
print_free_list ();
@@ -139,7 +142,7 @@ void exhaustion_test3 () {
139142

140143
// Delete in allocation order
141144
ptrs = alloc_series ( allocs, sizeof ( allocs ) / sizeof ( allocs[0] ));
142-
std::printf("Allocated %lu chunks\n", ptrs.size());
145+
std::printf("Allocated %zu chunks\n", ptrs.size());
143146
print_free_list ();
144147
for ( container::iterator iter = ptrs.begin (); iter != ptrs.end (); ++iter )
145148
fallback_free ( *iter );
@@ -149,15 +152,15 @@ void exhaustion_test3 () {
149152
// Delete in reverse order
150153
print_free_list ();
151154
ptrs = alloc_series ( allocs, sizeof ( allocs ) / sizeof ( allocs[0] ));
152-
std::printf("Allocated %lu chunks\n", ptrs.size());
155+
std::printf("Allocated %zu chunks\n", ptrs.size());
153156
for ( container::reverse_iterator iter = ptrs.rbegin (); iter != ptrs.rend (); ++iter )
154157
fallback_free ( *iter );
155158
print_free_list ();
156159
std::printf("----\n");
157160

158161
// Alternate deletions
159162
ptrs = alloc_series ( allocs, sizeof ( allocs ) / sizeof ( allocs[0] ));
160-
std::printf("Allocated %lu chunks\n", ptrs.size());
163+
std::printf("Allocated %zu chunks\n", ptrs.size());
161164
while ( ptrs.size () > 0 )
162165
fallback_free ( pop ( ptrs, ptrs.size () % 1 == 1 ));
163166
print_free_list ();

0 commit comments

Comments
 (0)