base: avoid implicit conversions

This patch is a prerequisite for compiling the code with
the warnings -Wconversion enabled.

Issue #23
This commit is contained in:
Norman Feske
2021-12-02 11:21:14 +01:00
parent c79a59655d
commit 03047009b1
189 changed files with 947 additions and 819 deletions

View File

@ -178,7 +178,7 @@ namespace {
if (!cmsg)
return 0;
return (cmsg->cmsg_len - CMSG_ALIGN(sizeof(cmsghdr)))/sizeof(int);
return (unsigned)((cmsg->cmsg_len - CMSG_ALIGN(sizeof(cmsghdr)))/sizeof(int));
}
};
@ -352,7 +352,7 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
extract_sds_from_message(0, rcv_msg, rcv_header, rcv_msgbuf);
return Rpc_exception_code(rcv_header.protocol_word);
return Rpc_exception_code((int)rcv_header.protocol_word);
}

View File

@ -203,7 +203,7 @@ Native_capability Native_thread::Epoll::alloc_rpc_cap()
void Native_thread::Epoll::free_rpc_cap(Native_capability cap)
{
int const local_socket = Capability_space::ipc_cap_data(cap).rpc_obj_key.value();
int const local_socket = (int)Capability_space::ipc_cap_data(cap).rpc_obj_key.value();
_exec_control([&] () { _remove(Lx_sd{local_socket}); });
}

View File

@ -61,7 +61,7 @@ void Genode::binary_ready_hook_for_platform()
};
uint64_t flags = SECCOMP_FILTER_FLAG_TSYNC;
auto ret = lx_seccomp(SECCOMP_SET_MODE_FILTER, flags, &program);
auto ret = lx_seccomp(SECCOMP_SET_MODE_FILTER, (int)flags, &program);
if (ret != 0) {
error("SECCOMP_SET_MODE_FILTER failed ", ret);
throw Exception();

View File

@ -33,10 +33,13 @@
*/
/* Linux includes */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
/* Genode includes */
#include <base/thread.h>