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

@@ -40,13 +40,11 @@ using namespace Genode;
** Support for core memory management **
****************************************/
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr,
unsigned size) {
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr, size_t size) {
return map_local(phys_addr, virt_addr, size / get_page_size()); }
bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t,
unsigned size) {
bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t, size_t size) {
return unmap_local(virt_addr, size / get_page_size()); }

View File

@@ -16,7 +16,10 @@
/* OKL4 includes */
namespace Okl4 { extern "C" {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wconversion"
#include <l4/config.h>
#include <l4/types.h>
#include <l4/ipc.h>
@@ -28,6 +31,7 @@ namespace Okl4 { extern "C" {
#include <l4/map.h>
#include <l4/interrupt.h>
#include <l4/security.h>
#pragma GCC diagnostic pop
#undef UTCB_SIZE
} }

View File

@@ -106,9 +106,9 @@ static L4_Word_t extract_msg_from_utcb(L4_MsgTag_t rcv_tag, Msgbuf_base &rcv_msg
*/
static void copy_msg_to_utcb(Msgbuf_base const &snd_msg, L4_Word_t local_name)
{
unsigned const num_header_words = 3 + 2*snd_msg.used_caps();
unsigned const num_data_words = snd_msg.data_size()/sizeof(L4_Word_t);
unsigned const num_msg_words = num_data_words + num_header_words;
uint8_t const num_header_words = (uint8_t)(3 + 2*snd_msg.used_caps());
uint8_t const num_data_words = (uint8_t)(snd_msg.data_size()/sizeof(L4_Word_t));
uint8_t const num_msg_words = num_data_words + num_header_words;
if (num_msg_words >= L4_GetMessageRegisters()) {
raw("Message does not fit into UTCB message registers");
@@ -118,7 +118,7 @@ static void copy_msg_to_utcb(Msgbuf_base const &snd_msg, L4_Word_t local_name)
L4_MsgTag_t snd_tag;
snd_tag.raw = 0;
snd_tag.X.u = num_msg_words;
snd_tag.X.u = (num_msg_words & 0x3f); /* bitfield X.u has 6 bits */
L4_LoadMR(0, snd_tag.raw);
L4_LoadMR(1, local_name);