Skip to content

Commit 0058f19

Browse files
committed
Fix shadowing warnings in ompi.
Signed-off-by: Austen Lauria <awlauria@us.ibm.com>
1 parent 6d366ba commit 0058f19

26 files changed

+120
-132
lines changed

ompi/communicator/ft/comm_ft_detector.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,7 @@ static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbea
418418
detector->hb_sstamp = 0.;
419419

420420
if( comm_detector_use_rdma_hb ) {
421-
ompi_communicator_t* comm = detector->comm;
422-
ompi_proc_t* proc = ompi_comm_peer_lookup(comm, msg->from);
421+
ompi_proc_t* proc = ompi_comm_peer_lookup(detector->comm, msg->from);
423422
assert( NULL != proc );
424423
mca_bml_base_endpoint_t* endpoint = mca_bml_base_get_endpoint(proc);
425424
assert( NULL != endpoint );
@@ -460,7 +459,7 @@ static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbea
460459

461460
static void fd_event_cb(int fd, short flags, void* pdetector)
462461
{
463-
comm_detector_t* detector = pdetector;;
462+
comm_detector_t* detector = pdetector;
464463
double stamp = PMPI_Wtime();
465464
double lastpeek = detector->hb_lastpeek;
466465
detector->hb_lastpeek = stamp;

ompi/datatype/ompi_datatype_args.c

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -71,57 +71,45 @@ typedef struct __dt_args {
7171
#define OMPI_DATATYPE_ALIGN_PTR(PTR, TYPE)
7272
#endif /* OPAL_ALIGN_WORD_SIZE_INTEGERS */
7373

74-
/**
75-
* Some architectures require 64 bits pointers (to pointers) to
76-
* be 64 bits aligned. As in the ompi_datatype_args_t structure we have
77-
* 2 such array of pointers and one to an array of ints, if we start by
78-
* setting the 64 bits aligned one we will not have any trouble. Problem
79-
* originally reported on SPARC 64.
80-
*/
81-
#define ALLOC_ARGS(PDATA, IC, AC, DC) \
82-
do { \
83-
int length = sizeof(ompi_datatype_args_t) + (IC) * sizeof(int) + \
84-
(AC) * sizeof(ptrdiff_t) + (DC) * sizeof(MPI_Datatype); \
85-
char* buf = (char*)malloc( length ); \
86-
ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)buf; \
87-
pArgs->ci = (IC); \
88-
pArgs->ca = (AC); \
89-
pArgs->cd = (DC); \
90-
buf += sizeof(ompi_datatype_args_t); \
91-
if( pArgs->ca == 0 ) pArgs->a = NULL; \
92-
else { \
93-
pArgs->a = (ptrdiff_t*)buf; \
94-
buf += pArgs->ca * sizeof(ptrdiff_t); \
95-
} \
96-
if( pArgs->cd == 0 ) pArgs->d = NULL; \
97-
else { \
98-
pArgs->d = (ompi_datatype_t**)buf; \
99-
buf += pArgs->cd * sizeof(MPI_Datatype); \
100-
} \
101-
if( pArgs->ci == 0 ) pArgs->i = NULL; \
102-
else pArgs->i = (int*)buf; \
103-
pArgs->ref_count = 1; \
104-
pArgs->total_pack_size = (4 + (IC) + (DC)) * sizeof(int) + \
105-
(AC) * sizeof(ptrdiff_t); \
106-
(PDATA)->args = (void*)pArgs; \
107-
(PDATA)->packed_description = 0; \
108-
} while(0)
109-
110-
11174
int32_t ompi_datatype_set_args( ompi_datatype_t* pData,
11275
int32_t ci, const int32_t** i,
11376
int32_t ca, const ptrdiff_t* a,
11477
int32_t cd, ompi_datatype_t* const * d, int32_t type)
11578
{
11679
int pos;
117-
ompi_datatype_args_t* pArgs;
11880

11981
assert( NULL == pData->args );
120-
ALLOC_ARGS( pData, ci, ca, cd );
121-
122-
pArgs = (ompi_datatype_args_t*)pData->args;
82+
int length = sizeof(ompi_datatype_args_t) + ci * sizeof(int) +
83+
ca * sizeof(ptrdiff_t) + cd * sizeof(MPI_Datatype);
84+
char* buf = (char*)malloc( length );
85+
ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)buf;
86+
pArgs->ci = ci; pArgs->i = NULL;
87+
pArgs->ca = ca; pArgs->a = NULL;
88+
pArgs->cd = cd; pArgs->d = NULL;
12389
pArgs->create_type = type;
12490

91+
/**
92+
* Some architectures require 64 bits pointers (to pointers) to
93+
* be 64 bits aligned. As in the ompi_datatype_args_t structure we have
94+
* 2 such array of pointers and one to an array of ints, if we start by
95+
* setting the 64 bits aligned one we will not have any trouble. Problem
96+
* originally reported on SPARC 64.
97+
*/
98+
buf += sizeof(ompi_datatype_args_t);
99+
if( 0 != pArgs->ca ) {
100+
pArgs->a = (ptrdiff_t*)buf;
101+
buf += pArgs->ca * sizeof(ptrdiff_t);
102+
}
103+
if( 0 != pArgs->cd ) {
104+
pArgs->d = (ompi_datatype_t**)buf;
105+
buf += pArgs->cd * sizeof(MPI_Datatype);
106+
}
107+
if( 0 != pArgs->ci ) pArgs->i = (int*)buf;
108+
109+
pArgs->ref_count = 1;
110+
pArgs->total_pack_size = (4 + ci) * sizeof(int) +
111+
cd * sizeof(MPI_Datatype) +
112+
ca * sizeof(ptrdiff_t);
125113
switch(type) {
126114

127115
case MPI_COMBINER_DUP:
@@ -229,7 +217,7 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData,
229217
pArgs->d[pos] = d[pos];
230218
if( !(ompi_datatype_is_predefined(d[pos])) ) {
231219
/* We handle a user defined datatype. We should make sure that the
232-
* user will not have the oportunity to destroy it before all derived
220+
* user will not have the opportunity to destroy it before all derived
233221
* datatypes are destroyed. As we keep pointers to every datatype
234222
* (for MPI_Type_get_content and MPI_Type_get_envelope) we have to make
235223
* sure that those datatype will be available if the user ask for them.
@@ -243,10 +231,12 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData,
243231
pArgs->total_pack_size += sizeof(int); /* each data has an ID */
244232
}
245233

234+
pData->args = (void*)pArgs;
235+
pData->packed_description = 0;
236+
246237
return OMPI_SUCCESS;
247238
}
248239

249-
250240
int32_t ompi_datatype_print_args( const ompi_datatype_t* pData )
251241
{
252242
int32_t i;

ompi/mca/coll/base/coll_base_alltoallv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
6363
if (i == rank) {
6464
continue;
6565
}
66-
size_t size = opal_datatype_span(&rdtype->super, rcounts[i], &gap);
67-
max_size = size > max_size ? size : max_size;
66+
size_t cur_size = opal_datatype_span(&rdtype->super, rcounts[i], &gap);
67+
max_size = cur_size > max_size ? cur_size : max_size;
6868
}
6969
/* The gap will always be the same as we are working on the same datatype */
7070

ompi/mca/coll/libnbc/nbc_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,13 @@ static inline int NBC_Unpack(void *src, int srccount, MPI_Datatype srctype, void
549549
return OMPI_SUCCESS;
550550
}
551551

552-
/* deletes elements from dict until low watermark is reached */
553-
static inline void NBC_SchedCache_dictwipe(hb_tree *dict, int *size) {
552+
/* deletes elements from dict_in until low watermark is reached */
553+
static inline void NBC_SchedCache_dictwipe(hb_tree *dict_in, int *size) {
554554
hb_itor *itor;
555555

556-
itor = hb_itor_new(dict);
556+
itor = hb_itor_new(dict_in);
557557
for (; hb_itor_valid(itor) && (*size>NBC_SCHED_DICT_LOWER); hb_itor_next(itor)) {
558-
hb_tree_remove(dict, hb_itor_key(itor), 0);
558+
hb_tree_remove(dict_in, hb_itor_key(itor), 0);
559559
*size = *size-1;
560560
}
561561
hb_itor_destroy(itor);

ompi/mca/coll/sm/coll_sm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ BEGIN_C_DECLS
3838
great while. Use a "goto" label for expdiency to exit loops. */
3939
#define SPIN_CONDITION_MAX 100000
4040
#define SPIN_CONDITION(cond, exit_label) \
41-
do { int i; \
41+
do { \
4242
if (cond) goto exit_label; \
43-
for (i = 0; i < SPIN_CONDITION_MAX; ++i) { \
43+
for (int spin_cond_i = 0; spin_cond_i < SPIN_CONDITION_MAX; ++spin_cond_i) { \
4444
if (cond) { goto exit_label; } \
4545
} \
4646
opal_progress(); \

ompi/mca/coll/sm/coll_sm_module.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
492492
static int bootstrap_comm(ompi_communicator_t *comm,
493493
mca_coll_sm_module_t *module)
494494
{
495-
int i;
496495
char *shortpath, *fullpath;
497496
mca_coll_sm_component_t *c = &mca_coll_sm_component;
498497
mca_coll_sm_comm_t *data = module->sm_comm_data;
@@ -511,7 +510,7 @@ static int bootstrap_comm(ompi_communicator_t *comm,
511510
with the lowest ORTE name to form a unique filename. */
512511
proc = ompi_group_peer_lookup(comm->c_local_group, 0);
513512
lowest_name = OMPI_CAST_RTE_NAME(&proc->super.proc_name);
514-
for (i = 1; i < comm_size; ++i) {
513+
for (int i = 1; i < comm_size; ++i) {
515514
proc = ompi_group_peer_lookup(comm->c_local_group, i);
516515
if (ompi_rte_compare_name_fields(OMPI_RTE_CMP_ALL,
517516
OMPI_CAST_RTE_NAME(&proc->super.proc_name),

ompi/mca/pml/ob1/pml_ob1_rdma.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ size_t mca_pml_ob1_rdma_pipeline_btls_count (mca_bml_base_endpoint_t* bml_endpoi
124124
/* NTH: go ahead and use an rdma btl if is the only one */
125125
bool ignore = !mca_pml_ob1.use_all_rdma;
126126

127-
for (int i = 0 ; i < num_eager_btls && ignore ; ++i) {
128-
mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, i);
127+
for (int j = 0 ; j < num_eager_btls && ignore ; ++j) {
128+
mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, j);
129129
if (eager_btl->btl_endpoint == bml_btl->btl_endpoint) {
130130
ignore = false;
131131
break;
@@ -154,8 +154,8 @@ size_t mca_pml_ob1_rdma_pipeline_btls( mca_bml_base_endpoint_t* bml_endpoint,
154154
/* NTH: go ahead and use an rdma btl if is the only one */
155155
bool ignore = !mca_pml_ob1.use_all_rdma;
156156

157-
for (int i = 0 ; i < num_eager_btls && ignore ; ++i) {
158-
mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, i);
157+
for (int j = 0 ; j < num_eager_btls && ignore ; ++j) {
158+
mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, j);
159159
if (eager_btl->btl_endpoint == bml_btl->btl_endpoint) {
160160
ignore = false;
161161
break;

ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct mca_sharedfp_lockedfile_data
115115
char* filename;
116116
};
117117

118-
typedef struct mca_sharedfp_lockedfile_data lockedfile_data;
118+
typedef struct mca_sharedfp_lockedfile_data lockedfile_data_global;
119119

120120

121121
int mca_sharedfp_lockedfile_request_position (struct mca_sharedfp_base_data_t * sh,

ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int mca_sharedfp_lockedfile_file_close (ompio_file_t *fh)
172172
}
173173
sh = fh->f_sharedfp_data;
174174

175-
module_data = (lockedfile_data*)(sh->selected_module_data);
175+
module_data = (lockedfile_data_global*)(sh->selected_module_data);
176176
if ( module_data) {
177177
/*Close lockedfile handle*/
178178
if ( module_data->handle) {

ompi/mca/sharedfp/sm/sharedfp_sm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct mca_sharedfp_sm_data
124124
char *sem_name; /* Name of the semaphore */
125125
};
126126

127-
typedef struct mca_sharedfp_sm_data sm_data;
127+
typedef struct mca_sharedfp_sm_data sm_data_global;
128128

129129

130130
int mca_sharedfp_sm_request_position (ompio_file_t *fh,

0 commit comments

Comments
 (0)