瀏覽代碼

SOCL: fix warnings

Sylvain Henry 12 年之前
父節點
當前提交
003007bb8f
共有 4 個文件被更改,包括 20 次插入8 次删除
  1. 5 5
      socl/src/cl_createcontext.c
  2. 3 0
      socl/src/cl_waitforevents.c
  3. 5 0
      socl/src/debug.h
  4. 7 3
      socl/src/gc.c

+ 5 - 5
socl/src/cl_createcontext.c

@@ -23,7 +23,7 @@ static void release_callback_context(void * e) {
   if (context->properties != NULL)
     free(context->properties);
 
-#warning TODO: to be fixed
+  //FIXME: should we free StarPU contexts?
   //starpu_sched_ctx_finished_submit(context->sched_ctx);
 
   free(context->devices);
@@ -64,7 +64,7 @@ soclCreateContext(const cl_context_properties * properties,
             case CL_CONTEXT_SCHEDULER_SOCL:
             case CL_CONTEXT_NAME_SOCL:
                i++;
-               if (p[i] == NULL) {
+               if (p[i] == 0) {
                   if (errcode_ret != NULL)
                      *errcode_ret = CL_INVALID_PROPERTY;
                   return NULL;
@@ -105,15 +105,15 @@ soclCreateContext(const cl_context_properties * properties,
       memcpy(ctx->properties, properties, sizeof(cl_context_properties) * ctx->num_properties);
 
       //Selected scheduler
-      int i = 0;
+      cl_uint i = 0;
       for (i=0; i<ctx->num_properties; i++) {
          if (p[i] == CL_CONTEXT_SCHEDULER_SOCL) {
             i++;
-            scheduler = p[i];
+            scheduler = (char*)p[i];
          }
          if (p[i] == CL_CONTEXT_NAME_SOCL) {
             i++;
-            name = p[i];
+            name = (char*)p[i];
          }
       }
 

+ 3 - 0
socl/src/cl_waitforevents.c

@@ -21,12 +21,15 @@ soclWaitForEvents(cl_uint           num_events,
                 const cl_event *    event_list) CL_API_SUFFIX__VERSION_1_0
 {
    unsigned int i;
+
+   #ifdef DEBUG
    DEBUG_MSG("Waiting for events: ");
    for (i=0; i<num_events; i++) {
       char * sep = i == (num_events-1) ? "" : ", ";
       DEBUG_MSG_NOHEAD("%d%s", event_list[i]->id, sep);
    }
    DEBUG_MSG_NOHEAD("\n");
+   #endif
 
    for (i=0; i<num_events; i++)
       starpu_tag_wait(event_list[i]->id);

+ 5 - 0
socl/src/debug.h

@@ -44,6 +44,11 @@ void ERROR_CL(char *s, cl_int err);
    #define DEBUG_CL(...) while(0);
 #endif
 
+#ifdef DEBUG
+#define DEBUG_PARAM(p) p
+#else
+#define DEBUG_PARAM(p) UNUSED(p)
+#endif
 
 
 #endif /* SOCL_DEBUG_H */

+ 7 - 3
socl/src/gc.c

@@ -106,7 +106,7 @@ void gc_stop(void) {
   pthread_join(gc_thread, NULL);
 }
 
-int gc_entity_release_ex(entity e, const char * caller) {
+int gc_entity_release_ex(entity e, const char * DEBUG_PARAM(caller)) {
 
   /* Decrement reference count */
   int refs = __sync_sub_and_fetch(&e->refs, 1);
@@ -176,10 +176,14 @@ void * gc_entity_alloc(unsigned int size, void (*release_callback)(void*), char
 }
 
 /** Retain entity */
-void gc_entity_retain_ex(void *arg, const char * caller) {
+void gc_entity_retain_ex(void *arg, const char * DEBUG_PARAM(caller)) {
 	struct entity * e = (entity)arg;
 
-	int refs = __sync_add_and_fetch(&e->refs, 1);
+   #ifdef DEBUG
+	int refs =
+   #endif
+      __sync_add_and_fetch(&e->refs, 1);
+
 
    DEBUG_MSG("[%s] Incrementing refcount of %s %p to %d\n", caller, e->name, e, refs);
 }