Procházet zdrojové kódy

src: limit variable scope

Nathalie Furmento před 8 roky
rodič
revize
2da5e38236

+ 2 - 2
src/core/workers.c

@@ -2068,7 +2068,6 @@ int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
 
 int starpu_worker_get_devids(enum starpu_worker_archtype type, int *devids, int num)
 {
-	int cnt = 0;
 	unsigned nworkers = starpu_worker_get_count();
 	int workerids[nworkers];
 
@@ -2079,10 +2078,11 @@ int starpu_worker_get_devids(enum starpu_worker_archtype type, int *devids, int
 	if(ndevice_workers > 0)
 	{
 		unsigned id, devid;
-		int curr_devid = -1;
+		int cnt = 0;
 		unsigned found = 0;
 		for(id = 0; id < ndevice_workers; id++)
 		{
+			int curr_devid;
 			curr_devid = _starpu_config.workers[workerids[id]].devid;
 			for(devid = 0; devid < ndevids; devid++)
 			{

+ 2 - 2
src/debug/traces/starpu_fxt.c

@@ -120,11 +120,11 @@ struct task_info *tasks_info;
 static struct task_info *get_task(unsigned long job_id, int mpi_rank)
 {
 	struct task_info *task;
-	unsigned i;
 
 	HASH_FIND(hh, tasks_info, &job_id, sizeof(job_id), task);
 	if (!task)
 	{
+		unsigned i;
 		_STARPU_MALLOC(task, sizeof(*task));
 		task->model_name = NULL;
 		task->name = NULL;
@@ -3032,10 +3032,10 @@ void _starpu_fxt_process_bandwidth(struct starpu_fxt_options *options)
 	char *prefix = options->file_prefix;
 
 	/* Loop through completed communications */
-	struct _starpu_communication*itor;
 	while (!_starpu_communication_list_empty(&communication_list)
 			&& _starpu_communication_list_begin(&communication_list)->peer)
 	{
+		struct _starpu_communication*itor;
 		/* This communication is complete */
 		itor = _starpu_communication_list_pop_front(&communication_list);
 

+ 1 - 2
src/drivers/cpu/driver_cpu.c

@@ -156,8 +156,6 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED
 	starpu_ssize_t limit = -1;
 
 #if defined(STARPU_HAVE_HWLOC)
-	char name[32];
-
 	struct _starpu_machine_topology *topology = &config->topology;
 
 	int nnumas = starpu_memory_nodes_get_numa_count();
@@ -171,6 +169,7 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid STARPU_ATTRIBUTE_UNUSED
 		}
 		else
 		{
+			char name[32];
 			hwloc_obj_t obj = hwloc_get_obj_by_depth(topology->hwtopology, depth_node, nodeid);
 			global_mem = obj->memory.local_memory;
 			snprintf(name, sizeof(name), "STARPU_LIMIT_CPU_NUMA_%d_MEM", obj->os_index);