This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] [Minidump] Fix format string warnings on Windows
AbandonedPublic

Authored by mstorsjo on Sep 14 2021, 12:18 PM.

Details

Reviewers
labath
MaskRay
Summary

These variables are 'size_t' and thus should use %zu. On Windows,
'long' is always 32 bit.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Sep 14 2021, 12:18 PM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2021, 12:18 PM
bulbazord added a subscriber: bulbazord.

Adding MaskRay who fixed something similar to this yesterday.

mstorsjo abandoned this revision.Sep 14 2021, 1:48 PM

Oh, sorry, I worked on a checkout a couple weeks old, where I ran into this warning. It does indeed seem to be fixed in the current git main branch.

I fixed this in e69d359841b6358f1d17569212ef8cf91244ca11 and fixed some style issues.


This needs extra care.

While Clang -Wformat flags

printf("%llu", (size_t)3);

warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]

This is silent:

printf("%ld", (size_t)3);