Page MenuHomePhabricator

[libcxx] Fix printf formats in two tests.
ClosedPublic

Authored by simon_tatham on Oct 16 2020, 5:43 AM.

Details

Reviewers
ldionne
miyuki
Group Reviewers
Restricted Project
Commits
rG4d60467f99a0: [libcxx] Fix printf formats in two tests.
Summary

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.

Diff Detail

Event Timeline

simon_tatham created this revision.Oct 16 2020, 5:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2020, 5:43 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
simon_tatham requested review of this revision.Oct 16 2020, 5:43 AM
ldionne accepted this revision.Oct 16 2020, 5:43 AM

Good catch, thanks.

This revision is now accepted and ready to land.Oct 16 2020, 5:43 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the quick review – sorry I wasn't on the ball enough to fold D89547 into this one too...

Thanks for the quick review – sorry I wasn't on the ball enough to fold D89547 into this one too...

No worries.