This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Make format specifiers more portable
ClosedPublic

Authored by bcain on Feb 24 2022, 8:21 PM.

Details

Summary

These printf()s fail to compile on hexagon.

Diff Detail

Event Timeline

bcain requested review of this revision.Feb 24 2022, 8:21 PM
bcain created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2022, 8:21 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Looks great to me, but this diff affects Microsoft code where @STL_MSFT wrote the upstream version and @Mordante copied/maintains the fork here, so I think they both need to approve this too.

bcain added a subscriber: sidneym.Feb 25 2022, 1:38 PM

The microsoft/STL repo follows a convention of always avoiding functional-style C-semantics casts like size_t(value), so these should be static_cast<size_t>(value). (The rationale is that size_t(value) is willing to reinterpret pointer values and is difficult to search for.)

Separately, I am not a huge fan of the size_t type here - it introduces machine-bitness-variation that's unrelated to these values (which are always 32-bit). That said, there's no danger and minimal risk of confusion, and there aren't great alternatives, so I'll live with it.

Thanks for fixing these warnings!

Mordante requested changes to this revision.Feb 28 2022, 10:25 AM

Please upload the next version with @STL_MSFT's comments addressed with the complete context. Having the complete context makes reviewing easier.

This revision now requires changes to proceed.Feb 28 2022, 10:25 AM
bcain updated this revision to Diff 411846.Feb 28 2022, 10:52 AM

Looks good to me, thanks.

Mordante accepted this revision.Mar 1 2022, 10:40 AM

@Mordante LGTY, right?

Yes LGTM!

This revision is now accepted and ready to land.Mar 1 2022, 10:40 AM
This revision was automatically updated to reflect the committed changes.