Fix various compiler warnings (#5064)
authorcherusker <cherusker@users.noreply.github.com>
Tue, 27 Jun 2017 14:21:34 +0000 (16:21 +0200)
committerBernhard Urban <bernhard.urban@xamarin.com>
Tue, 27 Jun 2017 14:21:34 +0000 (16:21 +0200)
commit4aa28ede12ca06a77c2b3578cc5a9d8a1d7c4bc2
tree36b993df2d99cc07144f564b857daf2467e6a357
parent67f753a893184932c75b63f2d7cca0cd6323c081
Fix various compiler warnings (#5064)

* Fix compiler warnings (w32)

- add explicit (long long (unsigned)) type casts

- change %ld to %lld once, to match the general style of these logging messages

* Fix compiler warnings (threadpool)

- add explicit (void *) type casts

* Fix compiler warnings (boehm)

- add an explicit (long) type cast; the values are defined as gint64, an upgrade to at least "%ld" seems like a good idea

- about dropping const: const does not seem to be necessary as g_getenv() returns pointers to freshly allocated buffers whenever called. const might have been used to protect the return value of g_getenv() on unix systems with earlier versions of Mono (as a comment in gmisc-unix.c suggests). keeping const here causes a compiler warning, as the const qualifier gets dropped when *env is being used with g_free(). that led to the decision to drop the qualifier altogether.

* Fix compiler warnings (sgen)

- specify the arguments (void) to avoid -Wstrict-prototypes warnings

* Fix compiler warnings (misc - metadata)

- specify the arguments (void) to avoid -Wstrict-prototypes warnings

* Fix compiler warnings (misc)

- specify the arguments (void) to avoid -Wstrict-prototypes warnings

- add an explicit (void *) type cast; changing the return type to char* might be more usable and could be discussed

- ret is not being used and can be removed; fixes a -Wunused-but-set-variable warning

* Fix compiler warnings (mini)

- specify the arguments (void) to avoid -Wstrict-prototypes warnings

* [fixup!] Correct indentation

* [fixup!] Correct (void *)
- use GUINT_TO_POINTER and MONO_NATIVE_THREAD_ID_TO_UINT instead of (void *) to cast mono_native_thread_id_get () to %p

* [fixup!] Correct indentation of boehm-gc.c and add FIXME

* include <inttypes.h> and test the G_GINT64_FORMAT macro

* [fixup!] Use G_G*_FORMAT and PRIx32 macros instead of type casts wherever possible
15 files changed:
eglib/src/glib.h
mono/btls/btls-util.c
mono/metadata/boehm-gc.c
mono/metadata/handle.c
mono/metadata/icall.c
mono/metadata/sgen-bridge.c
mono/metadata/sgen-tarjan-bridge.c
mono/metadata/threadpool-worker-default.c
mono/metadata/threadpool.c
mono/metadata/w32file-unix.c
mono/metadata/w32process-unix.c
mono/mini/debugger-agent.c
mono/mini/main.c
mono/unit-tests/test-mono-handle.c
support/stdlib.c