From e97c4e7b0ec8282920f0c6abeca75aa4b3a0b33b Mon Sep 17 00:00:00 2001 From: Jeff Squyres <jsquyres@cisco.com> Date: Wed, 28 Apr 2021 18:57:31 -0700 Subject: [PATCH] treematch: fix several compiler warnings Fix compiler warnings about having "shadow" variable declarations. Signed-off-by: Jeff Squyres <jsquyres@cisco.com> --- 3rd-party/treematch/fibo.h | 14 +++++++------- 3rd-party/treematch/tm_topology.c | 14 +++++++------- 3rd-party/treematch/tm_tree.c | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/3rd-party/treematch/fibo.h b/3rd-party/treematch/fibo.h index 32e0a7c082..f7239ce50b 100644 --- a/3rd-party/treematch/fibo.h +++ b/3rd-party/treematch/fibo.h @@ -101,13 +101,13 @@ typedef struct FiboTree_ { the algorithms have been de-recursived and written as macros. */ -#define fiboTreeLinkAfter(o,n) do { \ - FiboNode * nextptr; \ - nextptr = (o)->linkdat.nextptr; \ - (n)->linkdat.nextptr = nextptr; \ - (n)->linkdat.prevptr = (o); \ - nextptr->linkdat.prevptr = (n); \ - (o)->linkdat.nextptr = (n); \ +#define fiboTreeLinkAfter(o,n) do { \ + FiboNode * nextptr_loc; \ + nextptr_loc = (o)->linkdat.nextptr; \ + (n)->linkdat.nextptr = nextptr_loc; \ + (n)->linkdat.prevptr = (o); \ + nextptr_loc->linkdat.prevptr = (n); \ + (o)->linkdat.nextptr = (n); \ } while (0) #define fiboTreeUnlink(n) do { \ diff --git a/3rd-party/treematch/tm_topology.c b/3rd-party/treematch/tm_topology.c index 2c05c91dcc..dd55e02899 100644 --- a/3rd-party/treematch/tm_topology.c +++ b/3rd-party/treematch/tm_topology.c @@ -575,7 +575,7 @@ int tm_topology_add_binding_constraints(char *constraints_filename, tm_topology } -void topology_numbering_cpy(tm_topology_t *topology,int **numbering,int *nb_nodes) +void topology_numbering_cpy(tm_topology_t *topology,int **numbering_loc,int *nb_nodes) { int nb_levels; unsigned int vl = tm_get_verbose_level(); @@ -584,8 +584,8 @@ void topology_numbering_cpy(tm_topology_t *topology,int **numbering,int *nb_node *nb_nodes = topology->nb_nodes[nb_levels-1]; if(vl >= INFO) printf("nb_nodes=%d\n",*nb_nodes); - *numbering = (int*)MALLOC(sizeof(int)*(*nb_nodes)); - memcpy(*numbering,topology->node_id,sizeof(int)*(*nb_nodes)); + *numbering_loc = (int*)MALLOC(sizeof(int)*(*nb_nodes)); + memcpy(*numbering_loc,topology->node_id,sizeof(int)*(*nb_nodes)); } void topology_arity_cpy(tm_topology_t *topology,int **arity,int *nb_levels) @@ -699,7 +699,7 @@ void optimize_arity(int **arity, double **cost, int *nb_levels,int n) void tm_optimize_topology(tm_topology_t **topology){ int *arity = NULL,nb_levels; - int *numbering = NULL,nb_nodes; + int *numbering_loc = NULL,nb_nodes; tm_topology_t *new_topo; double *cost; unsigned int vl = tm_get_verbose_level(); @@ -710,13 +710,13 @@ void tm_optimize_topology(tm_topology_t **topology){ tm_display_arity(*topology); topology_arity_cpy(*topology,&arity,&nb_levels); - topology_numbering_cpy(*topology,&numbering,&nb_nodes); + topology_numbering_cpy(*topology,&numbering_loc,&nb_nodes); topology_constraints_cpy(*topology,&constraints,&nb_constraints); topology_cost_cpy(*topology,&cost); optimize_arity(&arity,&cost,&nb_levels,nb_levels-2); - new_topo = tm_build_synthetic_topology(arity, NULL, nb_levels,numbering,nb_nodes); + new_topo = tm_build_synthetic_topology(arity, NULL, nb_levels,numbering_loc,nb_nodes); new_topo->cost = cost; new_topo->constraints = constraints; new_topo->nb_constraints = nb_constraints; @@ -736,7 +736,7 @@ void tm_optimize_topology(tm_topology_t **topology){ tm_display_arity(new_topo); } FREE(arity); - FREE(numbering); + FREE(numbering_loc); tm_free_topology(*topology); *topology = new_topo; diff --git a/3rd-party/treematch/tm_tree.c b/3rd-party/treematch/tm_tree.c index 11d3e46a2d..f0c8d77656 100644 --- a/3rd-party/treematch/tm_tree.c +++ b/3rd-party/treematch/tm_tree.c @@ -1793,7 +1793,7 @@ void group_nodes(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new /* if(nb_groups>30000||depth>5){*/ if( nbg > 30000 ){ - double duration; + double duration_loc; TIC; if( arity <= 2 ){ @@ -1811,9 +1811,9 @@ void group_nodes(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new val = k_partition_grouping(cost_mat, tab_node, new_tab_node, arity, solution_size); } - duration = TOC; + duration_loc = TOC; if(verbose_level >= INFO) - printf("Fast grouping duration=%f\n", duration); + printf("Fast grouping duration=%f\n", duration_loc); if(verbose_level >= INFO) display_grouping(new_tab_node, solution_size, arity, val); -- GitLab