From f7c0a480daf5259c632903eb8d254588f6241bda Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 29 Jan 2013 08:37:51 +0100 Subject: [PATCH] codezero: fix compiler warnings int/unsigned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warnings like the following: warning: narrowing conversion of ‘((Genode::Platform_pd*)this)->Genode::Platform_pd::_space_id’ from ‘int’ to ‘Codezero::l4id_t {aka unsigned int}’ inside { } is ill-formed in C++11 [-Wnarrowing] --- base-codezero/src/core/include/platform_pd.h | 2 +- base-codezero/src/core/include/platform_thread.h | 6 +++--- base-codezero/src/core/platform_pd.cc | 6 +++--- base-codezero/src/core/platform_thread.cc | 4 ++-- base-codezero/src/core/thread_start.cc | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/base-codezero/src/core/include/platform_pd.h b/base-codezero/src/core/include/platform_pd.h index d173c371f..9f4b39a1e 100644 --- a/base-codezero/src/core/include/platform_pd.h +++ b/base-codezero/src/core/include/platform_pd.h @@ -31,7 +31,7 @@ namespace Genode { enum { UTCB_VIRT_BASE = 0x30000000 }; enum { UTCB_AREA_SIZE = MAX_THREADS_PER_PD*sizeof(struct Codezero::utcb) }; - int _space_id; + unsigned _space_id; bool utcb_in_use[MAX_THREADS_PER_PD]; diff --git a/base-codezero/src/core/include/platform_thread.h b/base-codezero/src/core/include/platform_thread.h index cb06ad86d..5eed8d62f 100644 --- a/base-codezero/src/core/include/platform_thread.h +++ b/base-codezero/src/core/include/platform_thread.h @@ -30,8 +30,8 @@ namespace Genode { enum { PD_NAME_MAX_LEN = 64 }; - int _tid; /* global codezero thread ID */ - int _space_id; + unsigned _tid; /* global codezero thread ID */ + unsigned _space_id; addr_t _utcb; char _name[PD_NAME_MAX_LEN]; Pager_object *_pager; @@ -41,7 +41,7 @@ namespace Genode { * * This function is called from 'Platform_pd::bind_thread'. */ - void _assign_physical_thread(int tid, int space_id, addr_t utcb) { + void _assign_physical_thread(unsigned tid, unsigned space_id, addr_t utcb) { _tid = tid; _space_id = space_id; _utcb = utcb; } public: diff --git a/base-codezero/src/core/platform_pd.cc b/base-codezero/src/core/platform_pd.cc index fcfb510fb..c2bb69831 100644 --- a/base-codezero/src/core/platform_pd.cc +++ b/base-codezero/src/core/platform_pd.cc @@ -97,15 +97,15 @@ Platform_pd::Platform_pd(bool core) } -Platform_pd::Platform_pd(signed pd_id, bool create) : _space_id(-1) +Platform_pd::Platform_pd(signed pd_id, bool create) : _space_id(TASK_ID_INVALID) { - _space_id = -1; + _space_id = TASK_ID_INVALID; /* mark all UTCBs of the new PD as free */ for (int i = 0; i < MAX_THREADS_PER_PD; i++) utcb_in_use[i] = false; - struct task_ids ids = { -1, -1, -1 }; + struct task_ids ids = { TASK_ID_INVALID, TASK_ID_INVALID, TASK_ID_INVALID }; int ret = l4_thread_control(THREAD_CREATE | TC_NEW_SPACE, &ids); if (ret < 0) { diff --git a/base-codezero/src/core/platform_thread.cc b/base-codezero/src/core/platform_thread.cc index c44fdbc74..1c1929992 100644 --- a/base-codezero/src/core/platform_thread.cc +++ b/base-codezero/src/core/platform_thread.cc @@ -35,7 +35,7 @@ void Platform_thread::affinity(unsigned int cpu_no) int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) { - Native_thread_id pager = _pager ? _pager->cap().dst() : -1; + Native_thread_id pager = _pager ? _pager->cap().dst() : THREAD_INVALID; /* setup thread context */ struct exregs_data exregs; @@ -100,7 +100,7 @@ void Platform_thread::cancel_blocking() Platform_thread::Platform_thread(const char *name, unsigned, addr_t, int thread_id) -: _tid(-1) +: _tid(THREAD_INVALID) { strncpy(_name, name, sizeof(_name)); } diff --git a/base-codezero/src/core/thread_start.cc b/base-codezero/src/core/thread_start.cc index 9ebf93045..8df438f48 100644 --- a/base-codezero/src/core/thread_start.cc +++ b/base-codezero/src/core/thread_start.cc @@ -43,13 +43,13 @@ void Thread_base::_deinit_platform_thread() { } * \return new thread ID, or * negative error code */ -inline int create_thread(int space_no, +inline int create_thread(unsigned space_no, void *sp, void *ip, int pager_tid = 1) { using namespace Codezero; - struct task_ids ids = { 1, space_no, TASK_ID_INVALID }; + struct task_ids ids = { 1U, space_no, TASK_ID_INVALID }; /* allocate new thread at the kernel */ unsigned long flags = THREAD_CREATE | TC_SHARE_SPACE | TC_SHARE_GROUP;