Browse Source

minor fixes to handle compiler warnings

Nathalie Furmento 13 years ago
parent
commit
8381f79759

+ 2 - 2
include/starpu_util.h

@@ -35,8 +35,8 @@ extern "C"
 #define STARPU_MAX(a,b)	((a)<(b)?(b):(a))
 
 #ifdef STARPU_NO_ASSERT
-#define STARPU_ASSERT(x)		do {} while(0)
-#define STARPU_ASSERT_MSG(x, msg)	do {} while(0)
+#define STARPU_ASSERT(x)		do { (void) (x);} while(0)
+#define STARPU_ASSERT_MSG(x, msg)	do { (void) (x);} while(0)
 #else
 #  if defined(__CUDACC__) && defined(STARPU_HAVE_WINDOWS)
 #    define STARPU_ASSERT(x)		do { if (!(x)) *(int*)NULL = 0; } while(0)

+ 3 - 1
src/core/perfmodel/perfmodel.c

@@ -277,8 +277,10 @@ double starpu_task_expected_conversion_time(struct starpu_task *task,
 		else if (arch >= STARPU_OPENCL_DEFAULT && arch < STARPU_GORDON_DEFAULT)
 			node = opencl_node;
 #endif
-		else
+		else {
+			node = -EINVAL;
 			STARPU_ASSERT(0);
+		}
 
 		if (!_starpu_handle_needs_conversion_task(handle, node))
 			continue;

+ 2 - 0
src/core/task.c

@@ -721,6 +721,8 @@ _starpu_handle_needs_conversion_task(starpu_data_handle_t handle,
 		default:
 			STARPU_ASSERT(0);
 	}
+	/* that instruction should never be reached */
+	return -EINVAL;
 }
 
 starpu_cpu_func_t _starpu_task_get_cpu_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)

+ 3 - 3
src/datawizard/interfaces/bcsr_interface.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -261,8 +261,8 @@ static size_t bcsr_interface_get_size(starpu_data_handle_t handle)
 /* returns the size of the allocated area */
 static ssize_t allocate_bcsr_buffer_on_node(void *data_interface_, uint32_t dst_node)
 {
-	uintptr_t addr_nzval;
-	uint32_t *addr_colind, *addr_rowptr;
+	uintptr_t addr_nzval = 0;
+	uint32_t *addr_colind = NULL, *addr_rowptr = NULL;
 	ssize_t allocated_memory;
 
 	/* we need the 3 arrays to be allocated */

+ 2 - 2
src/datawizard/interfaces/csr_interface.c

@@ -238,8 +238,8 @@ static size_t csr_interface_get_size(starpu_data_handle_t handle)
 /* returns the size of the allocated area */
 static ssize_t allocate_csr_buffer_on_node(void *data_interface_, uint32_t dst_node)
 {
-	uintptr_t addr_nzval;
-	uint32_t *addr_colind, *addr_rowptr;
+	uintptr_t addr_nzval = 0;
+	uint32_t *addr_colind = NULL, *addr_rowptr = NULL;
 	ssize_t allocated_memory;
 
 	/* we need the 3 arrays to be allocated */

+ 2 - 1
src/datawizard/interfaces/multiformat_interface.c

@@ -129,6 +129,7 @@ static void *multiformat_handle_to_pointer(starpu_data_handle_t handle, uint32_t
 		default:
 			STARPU_ASSERT(0);
 	}
+	return NULL;
 }
 
 static void register_multiformat_handle(starpu_data_handle_t handle, uint32_t home_node, void *data_interface)
@@ -288,7 +289,7 @@ static ssize_t allocate_multiformat_buffer_on_node(void *data_interface_, uint32
 	multiformat_interface = (struct starpu_multiformat_interface *) data_interface_;
 	unsigned fail = 0;
 	uintptr_t addr = 0;
-	ssize_t allocated_memory;
+	ssize_t allocated_memory = 0;
 
 	enum starpu_node_kind kind = starpu_node_get_kind(dst_node);
 	switch(kind)

+ 1 - 0
src/top/starpu_top_connection.c

@@ -96,6 +96,7 @@ void * message_to_ui(void * p)
 			}
 		}
 	}
+	return NULL;
 }
 
 void _starpu_top_communications_threads_launcher()

+ 5 - 7
tests/datawizard/interfaces/multiformat/advanced/multiformat_cuda_opencl.c

@@ -18,6 +18,8 @@
 #include "generic.h"
 #include "../../../../helper.h"
 
+#if defined(STARPU_USE_CUDA) && defined(STARPU_USE_OPENCL)
+
 extern struct stats global_stats;
 static int vector[NX];
 static starpu_data_handle_t handle;
@@ -36,7 +38,6 @@ static starpu_data_handle_t handle;
  * StarPU assumes that the data structures used on CUDA and OpenCL devices are
  * the same.
  */
-#if defined(STARPU_USE_CUDA) && defined(STARPU_USE_OPENCL)
 static int
 test(void)
 {
@@ -56,7 +57,7 @@ test(void)
 	task_cuda->handles[0] = handle;
 	ret = starpu_task_submit(task_cuda);
 	if (ret != 0)
-		return 1; 
+		return 1;
 
 	static struct starpu_codelet cl_opencl =
 	{
@@ -82,7 +83,6 @@ test(void)
 
 	return 0;
 }
-#endif /* !(STARPU_USE_CUDA && STARPU_USE_OPENCL) */
 
 static void
 register_handle(void)
@@ -98,6 +98,7 @@ unregister_handle(void)
 {
 	starpu_data_unregister(handle);
 }
+#endif /* !(STARPU_USE_CUDA && STARPU_USE_OPENCL) */
 
 int
 main(void)
@@ -126,9 +127,6 @@ main(void)
 
 	struct stats expected_stats =
 	{
-#ifdef STARPU_USE_CPU
-		.cpu           = 0,
-#endif
 #ifdef STARPU_USE_CUDA
 		.cuda          = 2,
 		.cpu_to_cuda   = 1,
@@ -140,7 +138,7 @@ main(void)
 		.opencl_to_cpu = 0
 #endif
 	};
-	
+
 	ret = compare_stats(&global_stats, &expected_stats);
 	if (ret != 0)
 	{

+ 2 - 0
tests/datawizard/interfaces/test_interfaces.c

@@ -194,6 +194,8 @@ get_field(struct data_interface_test_summary *s, int async, enum operation op)
 		default:
 			STARPU_ASSERT(0);
 	}
+	/* that instruction should never be reached */
+	return NULL;
 }
 
 static void

+ 1 - 0
tests/errorcheck/invalid_tasks.c

@@ -17,6 +17,7 @@
 
 #include <starpu.h>
 #include "../helper.h"
+#include <common/config.h>
 
 #if !defined(STARPU_HAVE_UNSETENV) || !defined(STARPU_USE_CPU)
 #warning unsetenv is not defined or no cpu are available. Skipping test

+ 2 - 2
tests/errorcheck/starpu_init_noworker.c

@@ -20,10 +20,10 @@
 #include <errno.h>
 #include <starpu.h>
 #include <stdlib.h>
+#include "../helper.h"
 
 #if !defined(STARPU_HAVE_UNSETENV)
 #warning unsetenv is not defined. Skipping test
-#include "../helper.h"
 int main(int argc, char **argv)
 {
 	return STARPU_TEST_SKIPPED;
@@ -38,7 +38,7 @@ static void unset_env_variables(void)
 
 int main(int argc, char **argv)
 {
-	int ret;	
+	int ret;
 
 	unset_env_variables();
 

+ 1 - 1
tests/helper.h

@@ -40,7 +40,7 @@
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 #ifdef STARPU_HAVE_VALGRIND_H
-static int _starpu_valgrind_print_once = 0;
+static int _starpu_valgrind_print_once STARPU_ATTRIBUTE_UNUSED = 0;
 
 #  define STARPU_SKIP_IF_VALGRIND \
 	do \