Fix many printf warnings (mono/mono#16484)
authorJay Krell <jaykrell@microsoft.com>
Tue, 14 Jan 2020 21:03:22 +0000 (13:03 -0800)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 14 Jan 2020 21:03:22 +0000 (22:03 +0100)
commit21244a1b9c07948cf54917148afc0c312e40a46c
treebcea9339d17e41fff205333df8e76a33a0afed39
parent590f336d296125eb3fba7656d71ae66351f52898
Fix many printf warnings (mono/mono#16484)

* Do not `printf` `long long` or `unsigned long long`.

*Do* printf `gint64` or `guint64`.

Do not printf %ll.
Do not printf %z.

 gint64 ==  int64_t, which could be long, or long long, or maybe other
guint64 == uint64_t, ditto

For printing gint64/guint64, use PRId64, PRIx64, etc.
For printing gsize/gssize, use `G_GSIZE_FORMAT` (seems like excess `G`).

%z definitely would warn for every single use, with Mingw.

And %ll might also, since on 64bit platforms, gint64 tends to be
long, not long long, and would merit %l not %ll.
(No matter that %ll is merited on 32bit, and the behavior
would then be correct on both.).

If there becomes a system w/o PRId64 etc., and it is a 64bit system,
then we could use %l under a portable name.
Or %I64. This appears unlikely (unless reach is extended to older Windows runtime).

Note that PRIxPTR for gsize/intptr_t may be a good idea too.

Commit migrated from https://github.com/mono/mono/commit/07402062541fa9555bef99dbaac84cfb587926cd
35 files changed:
src/mono/mono/dis/declsec.c
src/mono/mono/dis/dis-cil.c
src/mono/mono/dis/dump.c
src/mono/mono/eglib/test/endian.c
src/mono/mono/metadata/debug-helpers.c
src/mono/mono/metadata/object.c
src/mono/mono/metadata/sgen-mono.c
src/mono/mono/metadata/threads.c
src/mono/mono/metadata/w32handle.c
src/mono/mono/metadata/w32process-unix.c
src/mono/mono/mini/aot-compiler.c
src/mono/mono/mini/interp/interp.c
src/mono/mono/mini/interp/mintops.c
src/mono/mono/mini/jit-icalls.c
src/mono/mono/mini/mini-codegen.c
src/mono/mono/mini/mini-runtime.c
src/mono/mono/mini/trace.c
src/mono/mono/profiler/mprof-report.c
src/mono/mono/sgen/sgen-alloc.c
src/mono/mono/sgen/sgen-gc.c
src/mono/mono/sgen/sgen-gc.h
src/mono/mono/sgen/sgen-internal.c
src/mono/mono/sgen/sgen-los.c
src/mono/mono/sgen/sgen-marksweep.c
src/mono/mono/sgen/sgen-memory-governor.c
src/mono/mono/sgen/sgen-nursery-allocator.c
src/mono/mono/sgen/sgen-pinning.c
src/mono/mono/sgen/sgen-protocol-def.h
src/mono/mono/utils/mono-counters.c
src/mono/mono/utils/mono-log-flight-recorder.c
src/mono/mono/utils/mono-merp.c
src/mono/mono/utils/mono-mmap-windows.c
src/mono/mono/utils/mono-mmap.c
src/mono/mono/utils/mono-proclib.c
src/mono/mono/utils/mono-state.c