[all-commits] [llvm/llvm-project] 4d6046: [libcxx] Fix printf formats in two tests.
Simon Tatham via All-commits
all-commits at lists.llvm.org
Fri Oct 16 05:48:13 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 4d60467f99a0b00df230c363170a29e36c8ad798
https://github.com/llvm/llvm-project/commit/4d60467f99a0b00df230c363170a29e36c8ad798
Author: Simon Tatham <simon.tatham at arm.com>
Date: 2020-10-16 (Fri, 16 Oct 2020)
Changed paths:
M libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
M libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
Log Message:
-----------
[libcxx] Fix printf formats in two tests.
rGcc69d211d0d65d7b introduced several uses of `printf` with format
directives `%lu` and `%ld` to format values of type `size_t` and
`ptrdiff_t` respectively.
That doesn't reliably work in all C implementations, because those
types aren't necessarily the same thing as 'long int': sometimes
they're not even the same size, and when they are the same size, they
might be officially defined as int rather than long (for example),
which causes clang to emit a diagnostic for the mismatch.
C has special-purpose printf modifier letters for these two types, so
it's safer to use them. Changed all `%lu` on `size_t` to `%zu`, and
all `%ld` on `ptrdiff_t` to `%td`.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D89545
More information about the All-commits
mailing list