[Cbe-oss-dev] [patch 3/4] MARS: Fix build warnings

Geoff Levand geoffrey.levand at am.sony.com
Sun Aug 24 12:52:11 EST 2008


Fix various build warnings.

Fix these build warnings:
mars.c: In function 'create_mpu_contexts':
mars.c:88: warning: comparison between signed and unsigned
mars.c: In function 'mars_initialize':
mars.c:137: warning: comparison between signed and unsigned
mars_task.c: In function 'mars_task_initialize':
mars_task.c:97: warning: cast to pointer from integer of different size
mars_task.c: In function 'mars_task_finalize':
mars_task.c:118: warning: cast to pointer from integer of different size
mars_task.c:130: warning: cast to pointer from integer of different size
mars_task.c: In function 'mars_task_schedule':
mars_task.c:148: warning: cast to pointer from integer of different size
mars_task.c: In function 'mars_task_wait':
mars_task.c:182: warning: cast to pointer from integer of different size
mars_task.c: In function 'mars_task_try_wait':
mars_task.c:197: warning: cast to pointer from integer of different size
mars_task_barrier.c: In function 'mars_task_barrier_initialize':
mars_task_barrier.c:53: warning: unused variable 'i'
mars_task_event_flag.c: In function 'mars_task_event_flag_set':
mars_task_event_flag.c:108: warning: cast to pointer from integer of different size
mars_task_event_flag.c:144: warning: implicit declaration of function 'memmove'
mars_task_event_flag.c:144: warning: incompatible implicit declaration of built-in function 'memmove'
mars_task_queue.c: In function 'mars_task_queue_clear':
mars_task_queue.c:113: warning: cast to pointer from integer of different size
mars_task_queue.c: In function 'push_update':
mars_task_queue.c:138: warning: cast to pointer from integer of different size
mars_task_queue.c:158: warning: implicit declaration of function 'memmove'
mars_task_queue.c:158: warning: incompatible implicit declaration of built-in function 'memmove'
mars_task_queue.c: In function 'push':
mars_task_queue.c:188: warning: implicit declaration of function 'memcpy'
mars_task_queue.c:188: warning: incompatible implicit declaration of built-in function 'memcpy'
mars_task_queue.c:188: warning: cast to pointer from integer of different size
mars_task_queue.c: In function 'pop_update':
mars_task_queue.c:211: warning: cast to pointer from integer of different size
mars_task_queue.c:231: warning: incompatible implicit declaration of built-in function 'memmove'
mars_task_queue.c: In function 'pop':
mars_task_queue.c:261: warning: incompatible implicit declaration of built-in function 'memcpy'
mars_task_queue.c:261: warning: cast to pointer from integer of different size
mars_task_signal.c: In function 'mars_task_signal_send':
mars_task_signal.c:49: warning: cast to pointer from integer of different size
mars_task_signal.c:51: warning: implicit declaration of function 'workload_queue_signal_send'

Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
 src/host/lib/mars.c                 |    4 ++--
 src/host/lib/mars_task.c            |   12 ++++++------
 src/host/lib/mars_task_barrier.c    |    2 --
 src/host/lib/mars_task_event_flag.c |    3 ++-
 src/host/lib/mars_task_queue.c      |   12 ++++++------
 src/host/lib/mars_task_signal.c     |    3 ++-
 6 files changed, 18 insertions(+), 18 deletions(-)

--- a/src/host/lib/mars.c
+++ b/src/host/lib/mars.c
@@ -48,7 +48,7 @@
 
 extern struct spe_program_handle mars_kernel_entry;
 
-static int num_mpus_max(void)
+static unsigned int num_mpus_max(void)
 {
 	return spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
 }
@@ -82,7 +82,7 @@ static int create_mpu_contexts(struct ma
 	MARS_ASSERT(mars);
 
 	int ret;
-	unsigned int i;
+	int i;
 
 	/* create threads for each mpu context */
 	for (i = 0; i < num_mpu_contexts; i++) {
--- a/src/host/lib/mars_task.c
+++ b/src/host/lib/mars_task.c
@@ -95,7 +95,7 @@ int mars_task_initialize(struct mars_con
 				(struct mars_workload_context *)&task,
 				MARS_WORKLOAD_TYPE_TASK);
 	MARS_CHECK_CLEANUP_RET(ret == MARS_SUCCESS,
-				free((void *)task.context_save_area), ret);
+			free((void *)(uintptr_t)task.context_save_area), ret);
 	MARS_PRINT_TASK_CONTEXT(&task);
 
 	/* copy the task id into return id */
@@ -115,7 +115,7 @@ int mars_task_finalize(struct mars_task_
 	MARS_CHECK_RET(id->workload_id < MARS_WORKLOAD_MAX, MARS_ERROR_PARAMS);
 
 	int ret;
-	struct mars_context *mars = (struct mars_context *)id->mars_context_ea;
+	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 	struct mars_task_context task;
 
 	mars_mutex_lock(mars->mutex);
@@ -127,7 +127,7 @@ int mars_task_finalize(struct mars_task_
 
 	/* free the allocated task context area if it has one */
 	if (task.context_save_size)
-		free((void *)task.context_save_area);
+		free((void *)(uintptr_t)task.context_save_area);
 
 	mars_mutex_unlock(mars->mutex);
 
@@ -145,7 +145,7 @@ int mars_task_schedule(struct mars_task_
 	MARS_CHECK_RET(id->workload_id < MARS_WORKLOAD_MAX, MARS_ERROR_PARAMS);
 
 	int ret;
-	struct mars_context *mars = (struct mars_context *)id->mars_context_ea;
+	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 	struct mars_task_context *task = NULL;
 
 	mars_mutex_lock(mars->mutex);
@@ -179,7 +179,7 @@ int mars_task_wait(struct mars_task_id *
 	MARS_CHECK_RET(id->workload_id < MARS_WORKLOAD_MAX, MARS_ERROR_PARAMS);
 
 	int ret;
-	struct mars_context *mars = (struct mars_context *)id->mars_context_ea;
+	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	ret = workload_queue_wait(mars->workload_queue, id->workload_id);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
@@ -194,7 +194,7 @@ int mars_task_try_wait(struct mars_task_
 	MARS_CHECK_RET(id->workload_id < MARS_WORKLOAD_MAX, MARS_ERROR_PARAMS);
 
 	int ret;
-	struct mars_context *mars = (struct mars_context *)id->mars_context_ea;
+	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	ret = workload_queue_try_wait(mars->workload_queue, id->workload_id);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);
--- a/src/host/lib/mars_task_barrier.c
+++ b/src/host/lib/mars_task_barrier.c
@@ -50,8 +50,6 @@ int mars_task_barrier_initialize(struct 
 			== 0, MARS_ERROR_ALIGN);
 	MARS_CHECK_RET(total <= MARS_TASK_BARRIER_WAIT_MAX, MARS_ERROR_PARAMS);
 
-	int i;
-
 	mars_mutex_initialize((struct mars_mutex *)barrier);
 	mars_mutex_lock((struct mars_mutex *)barrier);
 
--- a/src/host/lib/mars_task_event_flag.c
+++ b/src/host/lib/mars_task_event_flag.c
@@ -36,6 +36,7 @@
  */
 
 #include <sched.h>
+#include <string.h>
 
 #include "mars_task_event_flag.h"
 #include "mars_workload_queue.h"
@@ -105,7 +106,7 @@ int mars_task_event_flag_set(struct mars
 	int ret;
 	int i;
 	struct mars_context *mars =
-			(struct mars_context *)event_flag->mars_context_ea;
+		(void *)(uintptr_t)event_flag->mars_context_ea;
 
 	mars_mutex_lock((struct mars_mutex *)event_flag);
 
--- a/src/host/lib/mars_task_queue.c
+++ b/src/host/lib/mars_task_queue.c
@@ -36,6 +36,7 @@
  */
 
 #include <sched.h>
+#include <string.h>
 
 #include "mars_task_queue.h"
 #include "mars_workload_queue.h"
@@ -110,7 +111,7 @@ int mars_task_queue_clear(struct mars_ta
 
 	int i;
 	struct mars_context *mars =
-			(struct mars_context *)queue->mars_context_ea;
+			(void *)(uintptr_t)queue->mars_context_ea;
 
 	mars_mutex_lock((struct mars_mutex *)queue);
 
@@ -135,7 +136,7 @@ int mars_task_queue_clear(struct mars_ta
 static void push_update(struct mars_task_queue *queue)
 {
 	struct mars_context *mars =
-			(struct mars_context *)queue->mars_context_ea;
+			(void *)(uintptr_t)queue->mars_context_ea;
 
 	/* increment queue count */
 	queue->count++;
@@ -185,7 +186,7 @@ static int push(struct mars_task_queue *
 	}
 
 	/* copy data into queue */
-	memcpy((void *)queue->push_ea, data, queue->size);
+	memcpy((void *)(uintptr_t)queue->push_ea, data, queue->size);
 
 	/* update queue data */
 	push_update(queue);
@@ -207,8 +208,7 @@ int mars_task_queue_try_push(struct mars
 
 static void pop_update(struct mars_task_queue *queue)
 {
-	struct mars_context *mars =
-			(struct mars_context *)queue->mars_context_ea;
+	struct mars_context *mars = (void *)(uintptr_t)queue->mars_context_ea;
 
 	/* decrement queue count */
 	queue->count--;
@@ -258,7 +258,7 @@ static int pop(struct mars_task_queue *q
 	}
 
 	/* copy data from queue */
-	memcpy(data, (void *)queue->pop_ea, queue->size);
+	memcpy(data, (void *)(uintptr_t)queue->pop_ea, queue->size);
 
 	/* update queue data only if this is not a peek operation */
 	if (!peek)
--- a/src/host/lib/mars_task_signal.c
+++ b/src/host/lib/mars_task_signal.c
@@ -39,6 +39,7 @@
 #include "mars.h"
 #include "mars_error.h"
 #include "mars_debug.h"
+#include "mars_workload_queue.h"
 
 int mars_task_signal_send(struct mars_task_id *id)
 {
@@ -46,7 +47,7 @@ int mars_task_signal_send(struct mars_ta
 	MARS_CHECK_RET(id->mars_context_ea, MARS_ERROR_PARAMS);
 
 	int ret;
-	struct mars_context *mars = (struct mars_context *)id->mars_context_ea;
+	struct mars_context *mars = (void *)(uintptr_t)id->mars_context_ea;
 
 	ret = workload_queue_signal_send(mars->workload_queue, id->workload_id);
 	MARS_CHECK_RET(ret == MARS_SUCCESS, ret);





More information about the cbe-oss-dev mailing list