mach, hurd: Cast through uintptr_t
authorSergey Bugaev <bugaevc@gmail.com>
Sun, 12 Feb 2023 11:10:34 +0000 (14:10 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 12 Feb 2023 14:55:04 +0000 (15:55 +0100)
commit62d6c3303089d9c708527ab7bf98348a6429e8c3
tree73a5a9637c522d97df9281137cb26c44809e9167
parentf4315054b46d5e58b44a709a51943fb73f846afb
mach, hurd: Cast through uintptr_t

When casting between a pointer and an integer of a different size, GCC
emits a warning (which is escalated to a build failure by -Werror).
Indeed, if what you start with is a pointer, which you then cast to a
shorter integer and then back again, you're going to cut off some bits
of the pointer.

But if you start with an integer (such as mach_port_t), then cast it to
a longer pointer (void *), and then back to a shorter integer, you are
fine. To keep GCC happy, cast through an intermediary uintptr_t, which
is always the same size as a pointer.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-4-bugaevc@gmail.com>
htl/cthreads-compat.c
hurd/fopenport.c
hurd/hurd/port.h
hurd/port-cleanup.c
hurd/vpprintf.c
mach/devstream.c