diff --git a/config/opal_setup_cc.m4 b/config/opal_setup_cc.m4 index a4eb3582734..cbcb2f305d4 100644 --- a/config/opal_setup_cc.m4 +++ b/config/opal_setup_cc.m4 @@ -296,6 +296,7 @@ AC_DEFUN([OPAL_SETUP_CC],[ _OPAL_CHECK_SPECIFIC_CFLAGS(-Wmissing-prototypes, Wmissing_prototypes) _OPAL_CHECK_SPECIFIC_CFLAGS(-Wstrict-prototypes, Wstrict_prototypes) _OPAL_CHECK_SPECIFIC_CFLAGS(-Wcomment, Wcomment) + _OPAL_CHECK_SPECIFIC_CFLAGS(-Wshadow, Wshadow) _OPAL_CHECK_SPECIFIC_CFLAGS(-Werror-implicit-function-declaration, Werror_implicit_function_declaration) _OPAL_CHECK_SPECIFIC_CFLAGS(-Wno-long-double, Wno_long_double, int main() { long double x; }) _OPAL_CHECK_SPECIFIC_CFLAGS(-fno-strict-aliasing, fno_strict_aliasing, int main() { long double x; }) diff --git a/ompi/communicator/ft/comm_ft_detector.c b/ompi/communicator/ft/comm_ft_detector.c index 9fccfaa4d6f..03eccda908b 100644 --- a/ompi/communicator/ft/comm_ft_detector.c +++ b/ompi/communicator/ft/comm_ft_detector.c @@ -418,8 +418,7 @@ static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbea detector->hb_sstamp = 0.; if( comm_detector_use_rdma_hb ) { - ompi_communicator_t* comm = detector->comm; - ompi_proc_t* proc = ompi_comm_peer_lookup(comm, msg->from); + ompi_proc_t* proc = ompi_comm_peer_lookup(detector->comm, msg->from); assert( NULL != proc ); mca_bml_base_endpoint_t* endpoint = mca_bml_base_get_endpoint(proc); assert( NULL != endpoint ); @@ -460,7 +459,7 @@ static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbea static void fd_event_cb(int fd, short flags, void* pdetector) { - comm_detector_t* detector = pdetector;; + comm_detector_t* detector = pdetector; double stamp = PMPI_Wtime(); double lastpeek = detector->hb_lastpeek; detector->hb_lastpeek = stamp; diff --git a/ompi/datatype/ompi_datatype_args.c b/ompi/datatype/ompi_datatype_args.c index 2063839ef33..328693db40a 100644 --- a/ompi/datatype/ompi_datatype_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -71,57 +71,45 @@ typedef struct __dt_args { #define OMPI_DATATYPE_ALIGN_PTR(PTR, TYPE) #endif /* OPAL_ALIGN_WORD_SIZE_INTEGERS */ -/** - * Some architectures require 64 bits pointers (to pointers) to - * be 64 bits aligned. As in the ompi_datatype_args_t structure we have - * 2 such array of pointers and one to an array of ints, if we start by - * setting the 64 bits aligned one we will not have any trouble. Problem - * originally reported on SPARC 64. - */ -#define ALLOC_ARGS(PDATA, IC, AC, DC) \ - do { \ - int length = sizeof(ompi_datatype_args_t) + (IC) * sizeof(int) + \ - (AC) * sizeof(ptrdiff_t) + (DC) * sizeof(MPI_Datatype); \ - char* buf = (char*)malloc( length ); \ - ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)buf; \ - pArgs->ci = (IC); \ - pArgs->ca = (AC); \ - pArgs->cd = (DC); \ - buf += sizeof(ompi_datatype_args_t); \ - if( pArgs->ca == 0 ) pArgs->a = NULL; \ - else { \ - pArgs->a = (ptrdiff_t*)buf; \ - buf += pArgs->ca * sizeof(ptrdiff_t); \ - } \ - if( pArgs->cd == 0 ) pArgs->d = NULL; \ - else { \ - pArgs->d = (ompi_datatype_t**)buf; \ - buf += pArgs->cd * sizeof(MPI_Datatype); \ - } \ - if( pArgs->ci == 0 ) pArgs->i = NULL; \ - else pArgs->i = (int*)buf; \ - pArgs->ref_count = 1; \ - pArgs->total_pack_size = (4 + (IC) + (DC)) * sizeof(int) + \ - (AC) * sizeof(ptrdiff_t); \ - (PDATA)->args = (void*)pArgs; \ - (PDATA)->packed_description = 0; \ - } while(0) - - int32_t ompi_datatype_set_args( ompi_datatype_t* pData, int32_t ci, const int32_t** i, int32_t ca, const ptrdiff_t* a, int32_t cd, ompi_datatype_t* const * d, int32_t type) { int pos; - ompi_datatype_args_t* pArgs; assert( NULL == pData->args ); - ALLOC_ARGS( pData, ci, ca, cd ); - - pArgs = (ompi_datatype_args_t*)pData->args; + int length = sizeof(ompi_datatype_args_t) + ci * sizeof(int) + + ca * sizeof(ptrdiff_t) + cd * sizeof(MPI_Datatype); + char* buf = (char*)malloc( length ); + ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)buf; + pArgs->ci = ci; pArgs->i = NULL; + pArgs->ca = ca; pArgs->a = NULL; + pArgs->cd = cd; pArgs->d = NULL; pArgs->create_type = type; + /** + * Some architectures require 64 bits pointers (to pointers) to + * be 64 bits aligned. As in the ompi_datatype_args_t structure we have + * 2 such array of pointers and one to an array of ints, if we start by + * setting the 64 bits aligned one we will not have any trouble. Problem + * originally reported on SPARC 64. + */ + buf += sizeof(ompi_datatype_args_t); + if( 0 != pArgs->ca ) { + pArgs->a = (ptrdiff_t*)buf; + buf += pArgs->ca * sizeof(ptrdiff_t); + } + if( 0 != pArgs->cd ) { + pArgs->d = (ompi_datatype_t**)buf; + buf += pArgs->cd * sizeof(MPI_Datatype); + } + if( 0 != pArgs->ci ) pArgs->i = (int*)buf; + + pArgs->ref_count = 1; + pArgs->total_pack_size = (4 + ci) * sizeof(int) + + cd * sizeof(MPI_Datatype) + + ca * sizeof(ptrdiff_t); switch(type) { case MPI_COMBINER_DUP: @@ -229,7 +217,7 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData, pArgs->d[pos] = d[pos]; if( !(ompi_datatype_is_predefined(d[pos])) ) { /* We handle a user defined datatype. We should make sure that the - * user will not have the oportunity to destroy it before all derived + * user will not have the opportunity to destroy it before all derived * datatypes are destroyed. As we keep pointers to every datatype * (for MPI_Type_get_content and MPI_Type_get_envelope) we have to make * 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, pArgs->total_pack_size += sizeof(int); /* each data has an ID */ } + pData->args = (void*)pArgs; + pData->packed_description = 0; + return OMPI_SUCCESS; } - int32_t ompi_datatype_print_args( const ompi_datatype_t* pData ) { int32_t i; diff --git a/ompi/datatype/ompi_datatype_module.c b/ompi/datatype/ompi_datatype_module.c index 4330308cc2c..232f0d90507 100644 --- a/ompi/datatype/ompi_datatype_module.c +++ b/ompi/datatype/ompi_datatype_module.c @@ -544,6 +544,9 @@ int32_t ompi_datatype_init( void ) #define MOOG(name, index) \ do { \ int rc; \ + /* Silence 'unused' compiler warning in optimized builds, \ + where assert() is removed. */ \ + (void) rc; \ ompi_mpi_##name.dt.d_f_to_c_index = index; \ rc = opal_pointer_array_set_item(&ompi_datatype_f_to_c_table, \ index, &ompi_mpi_##name); \ diff --git a/ompi/mca/coll/base/coll_base_alltoallv.c b/ompi/mca/coll/base/coll_base_alltoallv.c index dbe33e8eee4..3fabad91f2d 100644 --- a/ompi/mca/coll/base/coll_base_alltoallv.c +++ b/ompi/mca/coll/base/coll_base_alltoallv.c @@ -63,8 +63,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts if (i == rank) { continue; } - size_t size = opal_datatype_span(&rdtype->super, rcounts[i], &gap); - max_size = size > max_size ? size : max_size; + size_t cur_size = opal_datatype_span(&rdtype->super, rcounts[i], &gap); + max_size = cur_size > max_size ? cur_size : max_size; } /* The gap will always be the same as we are working on the same datatype */ diff --git a/ompi/mca/coll/libnbc/nbc_internal.h b/ompi/mca/coll/libnbc/nbc_internal.h index 4d5f42bc060..ce181b22343 100644 --- a/ompi/mca/coll/libnbc/nbc_internal.h +++ b/ompi/mca/coll/libnbc/nbc_internal.h @@ -549,13 +549,13 @@ static inline int NBC_Unpack(void *src, int srccount, MPI_Datatype srctype, void return OMPI_SUCCESS; } -/* deletes elements from dict until low watermark is reached */ -static inline void NBC_SchedCache_dictwipe(hb_tree *dict, int *size) { +/* deletes elements from dict_in until low watermark is reached */ +static inline void NBC_SchedCache_dictwipe(hb_tree *dict_in, int *size) { hb_itor *itor; - itor = hb_itor_new(dict); + itor = hb_itor_new(dict_in); for (; hb_itor_valid(itor) && (*size>NBC_SCHED_DICT_LOWER); hb_itor_next(itor)) { - hb_tree_remove(dict, hb_itor_key(itor), 0); + hb_tree_remove(dict_in, hb_itor_key(itor), 0); *size = *size-1; } hb_itor_destroy(itor); diff --git a/ompi/mca/coll/sm/coll_sm.h b/ompi/mca/coll/sm/coll_sm.h index b5e2a3f1c22..75db631fac2 100644 --- a/ompi/mca/coll/sm/coll_sm.h +++ b/ompi/mca/coll/sm/coll_sm.h @@ -38,9 +38,9 @@ BEGIN_C_DECLS great while. Use a "goto" label for expdiency to exit loops. */ #define SPIN_CONDITION_MAX 100000 #define SPIN_CONDITION(cond, exit_label) \ - do { int i; \ + do { \ if (cond) goto exit_label; \ - for (i = 0; i < SPIN_CONDITION_MAX; ++i) { \ + for (int spin_cond_i = 0; spin_cond_i < SPIN_CONDITION_MAX; ++spin_cond_i) { \ if (cond) { goto exit_label; } \ } \ opal_progress(); \ diff --git a/ompi/mca/coll/sm/coll_sm_module.c b/ompi/mca/coll/sm/coll_sm_module.c index 005cd431d7b..e386ed543c7 100644 --- a/ompi/mca/coll/sm/coll_sm_module.c +++ b/ompi/mca/coll/sm/coll_sm_module.c @@ -492,7 +492,6 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, static int bootstrap_comm(ompi_communicator_t *comm, mca_coll_sm_module_t *module) { - int i; char *shortpath, *fullpath; mca_coll_sm_component_t *c = &mca_coll_sm_component; mca_coll_sm_comm_t *data = module->sm_comm_data; @@ -511,7 +510,7 @@ static int bootstrap_comm(ompi_communicator_t *comm, with the lowest ORTE name to form a unique filename. */ proc = ompi_group_peer_lookup(comm->c_local_group, 0); lowest_name = OMPI_CAST_RTE_NAME(&proc->super.proc_name); - for (i = 1; i < comm_size; ++i) { + for (int i = 1; i < comm_size; ++i) { proc = ompi_group_peer_lookup(comm->c_local_group, i); if (ompi_rte_compare_name_fields(OMPI_RTE_CMP_ALL, OMPI_CAST_RTE_NAME(&proc->super.proc_name), diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index cfc32e49715..74398060081 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -916,7 +916,6 @@ static int ompi_osc_rdma_query_alternate_btls (ompi_communicator_t *comm, ompi_o mca_btl_base_selected_module_t *item; char **btls_to_use = opal_argv_split (ompi_osc_rdma_btl_alternate_names, ','); int btls_found = 0; - void *tmp; btls_to_use = opal_argv_split (ompi_osc_rdma_btl_alternate_names, ','); if (NULL == btls_to_use) { diff --git a/ompi/mca/osc/rdma/osc_rdma_peer.c b/ompi/mca/osc/rdma/osc_rdma_peer.c index ebfe1e8aadc..c6689d78812 100644 --- a/ompi/mca/osc/rdma/osc_rdma_peer.c +++ b/ompi/mca/osc/rdma/osc_rdma_peer.c @@ -79,7 +79,6 @@ int ompi_osc_rdma_new_peer (struct ompi_osc_rdma_module_t *module, int peer_id, struct mca_btl_base_endpoint_t *endpoint; ompi_osc_rdma_peer_t *peer; uint8_t module_btl_index = UINT8_MAX; - mca_btl_base_module_t *btl = NULL; *peer_out = NULL; @@ -90,10 +89,6 @@ int ompi_osc_rdma_new_peer (struct ompi_osc_rdma_module_t *module, int peer_id, return ret; } - if (endpoint) { - btl = ompi_osc_rdma_selected_btl (module, module_btl_index); - } - if (MPI_WIN_FLAVOR_DYNAMIC == module->flavor) { peer = (ompi_osc_rdma_peer_t *) OBJ_NEW(ompi_osc_rdma_peer_dynamic_t); } else if (module->same_size && module->same_disp_unit) { @@ -127,7 +122,6 @@ static int ompi_osc_rdma_peer_setup (ompi_osc_rdma_module_t *module, ompi_osc_rd ompi_osc_rdma_peer_extended_t *ex_peer = (ompi_osc_rdma_peer_extended_t *) peer; uint64_t peer_data_size; uint64_t peer_data_offset, array_pointer; - mca_btl_base_module_t *array_btl; struct mca_btl_base_endpoint_t *array_endpoint; ompi_osc_rdma_region_t *array_peer_data, *node_peer_data; ompi_osc_rdma_rank_data_t rank_data; diff --git a/ompi/mca/pml/ob1/pml_ob1_rdma.c b/ompi/mca/pml/ob1/pml_ob1_rdma.c index 8cae10b0322..f27b281959a 100644 --- a/ompi/mca/pml/ob1/pml_ob1_rdma.c +++ b/ompi/mca/pml/ob1/pml_ob1_rdma.c @@ -124,8 +124,8 @@ size_t mca_pml_ob1_rdma_pipeline_btls_count (mca_bml_base_endpoint_t* bml_endpoi /* NTH: go ahead and use an rdma btl if is the only one */ bool ignore = !mca_pml_ob1.use_all_rdma; - for (int i = 0 ; i < num_eager_btls && ignore ; ++i) { - mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, i); + for (int j = 0 ; j < num_eager_btls && ignore ; ++j) { + mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, j); if (eager_btl->btl_endpoint == bml_btl->btl_endpoint) { ignore = false; break; @@ -154,8 +154,8 @@ size_t mca_pml_ob1_rdma_pipeline_btls( mca_bml_base_endpoint_t* bml_endpoint, /* NTH: go ahead and use an rdma btl if is the only one */ bool ignore = !mca_pml_ob1.use_all_rdma; - for (int i = 0 ; i < num_eager_btls && ignore ; ++i) { - mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, i); + for (int j = 0 ; j < num_eager_btls && ignore ; ++j) { + mca_bml_base_btl_t *eager_btl = mca_bml_base_btl_array_get_index (&bml_endpoint->btl_eager, j); if (eager_btl->btl_endpoint == bml_btl->btl_endpoint) { ignore = false; break; diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h index ba1d68fcf6c..a697067f18d 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile.h @@ -115,7 +115,7 @@ struct mca_sharedfp_lockedfile_data char* filename; }; -typedef struct mca_sharedfp_lockedfile_data lockedfile_data; +typedef struct mca_sharedfp_lockedfile_data lockedfile_data_global; int mca_sharedfp_lockedfile_request_position (struct mca_sharedfp_base_data_t * sh, diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index b82be1f8932..f8b074537db 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c @@ -172,7 +172,7 @@ int mca_sharedfp_lockedfile_file_close (ompio_file_t *fh) } sh = fh->f_sharedfp_data; - module_data = (lockedfile_data*)(sh->selected_module_data); + module_data = (lockedfile_data_global*)(sh->selected_module_data); if ( module_data) { /*Close lockedfile handle*/ if ( module_data->handle) { diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm.h b/ompi/mca/sharedfp/sm/sharedfp_sm.h index 69b463803b1..4bf449892f9 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm.h +++ b/ompi/mca/sharedfp/sm/sharedfp_sm.h @@ -124,7 +124,7 @@ struct mca_sharedfp_sm_data char *sem_name; /* Name of the semaphore */ }; -typedef struct mca_sharedfp_sm_data sm_data; +typedef struct mca_sharedfp_sm_data sm_data_global; int mca_sharedfp_sm_request_position (ompio_file_t *fh, diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index 6526ee52480..42cc532b4e7 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -253,7 +253,7 @@ int mca_sharedfp_sm_file_close (ompio_file_t *fh) */ fh->f_comm->c_coll->coll_barrier (fh->f_comm, fh->f_comm->c_coll->coll_barrier_module ); - file_data = (sm_data*)(sh->selected_module_data); + file_data = (sm_data_global*)(sh->selected_module_data); if (file_data) { /*Close sm handle*/ if (file_data->sm_offset_ptr) { diff --git a/ompi/mca/topo/base/topo_base_cart_create.c b/ompi/mca/topo/base/topo_base_cart_create.c index 2e7257d5443..e751a909f3f 100644 --- a/ompi/mca/topo/base/topo_base_cart_create.c +++ b/ompi/mca/topo/base/topo_base_cart_create.c @@ -118,12 +118,12 @@ int mca_topo_base_cart_create(mca_topo_base_module_t *topo, return OMPI_ERR_OUT_OF_RESOURCE; } { /* setup the cartesian topology */ - int nprocs = num_procs, rank = new_rank; + int n_procs = num_procs, rank = new_rank; for (i = 0; i < ndims; ++i) { - nprocs /= cart->dims[i]; - cart->coords[i] = rank / nprocs; - rank %= nprocs; + n_procs /= cart->dims[i]; + cart->coords[i] = rank / n_procs; + rank %= n_procs; } } } diff --git a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c index e4887eea213..f96def2ddf6 100644 --- a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c +++ b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c @@ -382,7 +382,6 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, /* Centralized Reordering */ if (0 == mca_topo_treematch_component.reorder_mode) { - int *k = NULL; int *obj_mapping = NULL; int num_objs_total = 0; @@ -693,12 +692,14 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, &newrank, 1, MPI_INT, 0, comm_old, comm_old->c_coll->coll_scatter_module))) { - if (NULL != k) free(k); + if (NULL != k) { free(k); k = NULL; } goto release_and_return; } - if ( 0 == rank ) + if ( 0 == rank ) { free(k); + k = NULL; + } /* this needs to be optimized but will do for now */ if (OMPI_SUCCESS != (err = ompi_comm_split(comm_old, 0, newrank, newcomm, false))) { @@ -903,7 +904,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, &newrank, 1, MPI_INT, 0, localcomm, localcomm->c_coll->coll_scatter_module))) { - if (NULL != k) free(k); + if (NULL != k) { free(k); k = NULL; }; ompi_comm_free(&localcomm); free(lrank_to_grank); free(grank_to_lrank); @@ -932,8 +933,10 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, newrank += offset; free(marked); - if (rank == lindex_to_grank[0]) + if (rank == lindex_to_grank[0]) { free(k); + k = NULL; + } /* this needs to be optimized but will do for now */ if (OMPI_SUCCESS != (err = ompi_comm_split(comm_old, 0, newrank, newcomm, false))) { diff --git a/ompi/mca/vprotocol/pessimist/vprotocol_pessimist_wait.c b/ompi/mca/vprotocol/pessimist/vprotocol_pessimist_wait.c index 7dce3f92375..af7feebb575 100644 --- a/ompi/mca/vprotocol/pessimist/vprotocol_pessimist_wait.c +++ b/ompi/mca/vprotocol/pessimist/vprotocol_pessimist_wait.c @@ -19,8 +19,7 @@ static int vprotocol_pessimist_request_no_free(ompi_request_t **req) { } #define PREPARE_REQUESTS_WITH_NO_FREE(count, requests) do { \ - size_t i; \ - for(i = 0; i < count; i++) \ + for(int i = 0; i < count; i++) \ { \ if(requests[i] == MPI_REQUEST_NULL) continue; \ requests[i]->req_free = vprotocol_pessimist_request_no_free; \ @@ -74,7 +73,6 @@ int mca_vprotocol_pessimist_test_any(size_t count, ompi_request_t ** requests, ompi_status_public_t * status) { int ret; - size_t i; VPROTOCOL_PESSIMIST_DELIVERY_REPLAY(count, requests, completed, index, status); @@ -86,7 +84,7 @@ int mca_vprotocol_pessimist_test_any(size_t count, ompi_request_t ** requests, if(completed) { /* Parse the result */ - for(i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { ompi_request_t *req = requests[i]; if(req == MPI_REQUEST_NULL) continue; @@ -116,7 +114,6 @@ int mca_vprotocol_pessimist_wait_any(size_t count, ompi_request_t ** requests, int *index, ompi_status_public_t * status) { int ret; - size_t i; int dummy; VPROTOCOL_PESSIMIST_DELIVERY_REPLAY(count, requests, &dummy, index, status); @@ -127,7 +124,7 @@ int mca_vprotocol_pessimist_wait_any(size_t count, ompi_request_t ** requests, ret = mca_pml_v.host_request_fns.req_wait_any(count, requests, index, status); /* Parse the result */ - for(i = 0; i < count; i++) + for(size_t i = 0; i < count; i++) { ompi_request_t *req = requests[i]; if(req == MPI_REQUEST_NULL) continue; diff --git a/ompi/mpi/c/alltoall.c b/ompi/mpi/c/alltoall.c index 069538a53c5..41bf608c890 100644 --- a/ompi/mpi/c/alltoall.c +++ b/ompi/mpi/c/alltoall.c @@ -89,10 +89,10 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, } if (MPI_IN_PLACE != sendbuf && !OMPI_COMM_IS_INTER(comm)) { - size_t sendtype_size, recvtype_size; + size_t sendtype_size, recvtype_size_tmp; ompi_datatype_type_size(sendtype, &sendtype_size); - ompi_datatype_type_size(recvtype, &recvtype_size); - if ((sendtype_size*sendcount) != (recvtype_size*recvcount)) { + ompi_datatype_type_size(recvtype, &recvtype_size_tmp); + if ((sendtype_size*sendcount) != (recvtype_size_tmp*recvcount)) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_TRUNCATE, FUNC_NAME); } } diff --git a/ompi/mpi/c/bindings.h b/ompi/mpi/c/bindings.h index c00e6b0331c..f57bd0e31f4 100644 --- a/ompi/mpi/c/bindings.h +++ b/ompi/mpi/c/bindings.h @@ -89,12 +89,15 @@ BEGIN_C_DECLS if ( (DDT)->super.flags & OPAL_DATATYPE_FLAG_PREDEFINED ) { \ (RC) = MPI_ERR_BUFFER; \ } else { \ - size_t size = 0; \ - ptrdiff_t true_lb = 0; \ - ptrdiff_t true_extended = 0; \ - ompi_datatype_type_size((DDT), &size); \ - ompi_datatype_get_true_extent((DDT), &true_lb, &true_extended); \ - if ( 0 < size && 0 == true_lb ) { \ + size_t ompi_chk_usr_buf_size = 0; \ + ptrdiff_t ompi_chk_usr_buf_true_lb = 0; \ + ptrdiff_t ompi_chk_usr_buf_true_extended = 0; \ + ompi_datatype_type_size((DDT), &ompi_chk_usr_buf_size); \ + ompi_datatype_get_true_extent((DDT), \ + &ompi_chk_usr_buf_true_lb, \ + &ompi_chk_usr_buf_true_extended);\ + if ( 0 < ompi_chk_usr_buf_size && \ + 0 == ompi_chk_usr_buf_true_extended ) { \ (RC) = MPI_ERR_BUFFER; \ } \ } \ diff --git a/ompi/mpiext/affinity/c/mpiext_affinity_str.c b/ompi/mpiext/affinity/c/mpiext_affinity_str.c index ac3fb9efc2b..e0949b0a340 100644 --- a/ompi/mpiext/affinity/c/mpiext_affinity_str.c +++ b/ompi/mpiext/affinity/c/mpiext_affinity_str.c @@ -256,15 +256,15 @@ static int get_rsrc_exists(char str[OMPI_AFFINITY_STRING_MAX]) /* No, they have differing numbers of PUs */ else { - bool first = true; + bool first_iter = true; strncat(str, "with (", OMPI_AFFINITY_STRING_MAX - strlen(str)); for (c2 = core; NULL != c2; c2 = c2->next_cousin) { - if (!first) { + if (!first_iter) { strncat(str, ", ", OMPI_AFFINITY_STRING_MAX - strlen(str)); } - first = false; + first_iter = false; i = hwloc_get_nbobjs_inside_cpuset_by_type(opal_hwloc_topology, core->cpuset, diff --git a/ompi/patterns/net/netpatterns.h b/ompi/patterns/net/netpatterns.h index 9307e247e0c..09e02c7f3a3 100644 --- a/ompi/patterns/net/netpatterns.h +++ b/ompi/patterns/net/netpatterns.h @@ -43,22 +43,26 @@ OMPI_DECLSPEC extern int ompi_netpatterns_base_err(const char*, ...) __opal_attr #define NETPATTERNS_VERBOSE(args) #endif -#define FIND_BASE(base,myid,level,k) \ - do { \ - int temp = 1; \ - int jj; \ - int knt2; \ - \ - base = 0; \ - for( jj = 0; jj < level; jj++) {\ - temp *= k; \ - } \ - knt2 = 1; \ - while(myid >= knt2*temp){ \ - knt2++; \ - } \ - base = knt2*temp - temp; \ - } while(0) \ +#define FIND_BASE(base,myid,level,k) \ + do { \ + int find_base_tmp = 1 ; \ + int find_base_knt2; \ + \ + base = 0; \ + for( int find_base_i = 0; \ + find_base_i < level; \ + find_base_i++) \ + { \ + find_base_tmp *= k; \ + } \ + find_base_knt2 = 1; \ + while(myid >= \ + (find_base_knt2*find_base_tmp)){ \ + find_base_knt2++; \ + } \ + base = (find_base_knt2 * \ + find_base_tmp)-find_base_tmp; \ + } while(0) \ diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 45673c10e6f..be32b2f6a85 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -852,7 +852,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided, /* initialize the fault tolerant infrastructure (revoke, detector, * propagator) */ if( ompi_ftmpi_enabled ) { - int rc; const char *evmethod; rc = ompi_comm_rbcast_init(); if( OMPI_SUCCESS != rc ) return rc; @@ -1001,7 +1000,6 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided, #if OPAL_ENABLE_FT_MPI /* start the failure detector */ if( ompi_ftmpi_enabled ) { - int rc; rc = ompi_comm_failure_detector_start(); if( OMPI_SUCCESS != rc ) return rc; } diff --git a/opal/mca/base/mca_base_var.c b/opal/mca/base/mca_base_var.c index 28a6a5541ba..d0d8a07b8be 100644 --- a/opal/mca/base/mca_base_var.c +++ b/opal/mca/base/mca_base_var.c @@ -1542,10 +1542,10 @@ int mca_base_var_register(const char *project_name, const char *framework_name, return ret; } - OPAL_LIST_FOREACH_DECL (alias_item, &alias->component_aliases, mca_base_alias_item_t) { - mca_base_var_syn_flag_t flags = 0; + OPAL_LIST_FOREACH_DECL(alias_item, &alias->component_aliases, mca_base_alias_item_t) { + mca_base_var_syn_flag_t flags_tmp = 0; if (alias_item->alias_flags & MCA_BASE_ALIAS_FLAG_DEPRECATED) { - flags = MCA_BASE_VAR_SYN_FLAG_DEPRECATED; + flags_tmp = MCA_BASE_VAR_SYN_FLAG_DEPRECATED; } (void) mca_base_var_register_synonym(ret, project_name, framework_name, alias_item->component_alias, variable_name, flags); diff --git a/opal/mca/btl/base/btl_base_am_rdma.c b/opal/mca/btl/base/btl_base_am_rdma.c index b1195b467ec..06438e980a4 100644 --- a/opal/mca/btl/base/btl_base_am_rdma.c +++ b/opal/mca/btl/base/btl_base_am_rdma.c @@ -421,8 +421,6 @@ static void mca_btl_base_am_descriptor_complete(mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, mca_btl_base_descriptor_t *descriptor, int status) { - mca_btl_base_rdma_context_t *context = (mca_btl_base_rdma_context_t *) descriptor->des_context; - (void) mca_btl_base_am_rdma_advance(btl, endpoint, (mca_btl_base_rdma_context_t *) descriptor->des_context, /*send_descriptor=*/false); @@ -454,39 +452,37 @@ mca_btl_base_rdma_start(mca_btl_base_module_t *btl, struct mca_btl_base_endpoint context->local_handle = local_handle; context->total_size = size; - size_t send_size = 0; - size_t recv_size = 0; bool use_rdma = false; if (MCA_BTL_BASE_AM_PUT == type) { if (sizeof(*hdr) + size <= btl->btl_eager_limit) { /* just go ahead and send the data */ - send_size = size; + packet_size += size; } else if (!mca_btl_base_rdma_use_rdma_get(btl)) { - send_size = size_t_min(size, btl->btl_max_send_size - sizeof(*hdr)); + packet_size += size; + } else if (!mca_btl_base_rdma_use_rdma_get (btl)) { + packet_size += size_t_min (size, btl->btl_max_send_size - sizeof (*hdr)); } else { use_rdma = true; } } else if (MCA_BTL_BASE_AM_GET == type) { if (sizeof(mca_btl_base_rdma_response_hdr_t) + size <= btl->btl_eager_limit) { - recv_size = size; + packet_size += size; } else if (!mca_btl_base_rdma_use_rdma_put(btl)) { - recv_size = size_t_min(size, btl->btl_max_send_size + packet_size += size_t_min(size, btl->btl_max_send_size - sizeof(mca_btl_base_rdma_response_hdr_t)); } else { use_rdma = true; } } else { /* fetching atomic. always recv result via active message */ - recv_size = size; + packet_size += size; } if (use_rdma && btl->btl_register_mem) { packet_size += 2 * btl->btl_registration_handle_size; } - packet_size += send_size; - BTL_VERBOSE(("Initiating RDMA operation. context=%p, size=%" PRIsize_t ", packet_size=%" PRIsize_t, context, size, packet_size)); @@ -727,9 +723,8 @@ static int mca_btl_base_am_rdma_target_put(mca_btl_base_module_t *btl, static void mca_btl_base_rdma_retry_operation(mca_btl_base_rdma_operation_t *operation) { - mca_btl_base_module_t *btl = operation->btl; void *target_address = (void *) (intptr_t) operation->hdr.target_address; - int ret; + int ret = OPAL_SUCCESS; if (!operation->descriptor && !operation->is_completed) { switch (operation->hdr.type) { @@ -797,6 +792,8 @@ static int mca_btl_base_am_rdma_progress(void) } } })); + + return 0; } static int mca_btl_base_am_atomic_64(int64_t *operand, opal_atomic_int64_t *addr, @@ -958,7 +955,6 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl, const mca_btl_base_rdma_hdr_t *hdr = (mca_btl_base_rdma_hdr_t *) desc->des_segments[0] .seg_addr.pval; - void *target_address = (void *) (intptr_t) hdr->target_address; uint64_t atomic_response = hdr->data.atomic.operand[0]; if (4 != hdr->data.atomic.size && 8 != hdr->data.atomic.size) { @@ -969,7 +965,7 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl, BTL_VERBOSE(("got active-message atomic request. hdr->context=0x%" PRIx64 ", target_address=%p, " "segment 0 size=%" PRIu64, - hdr->context, target_address, desc->des_segments[0].seg_len)); + hdr->context, (void *)(intptr_t)hdr->target_address, desc->des_segments[0].seg_len)); switch (hdr->type) { case MCA_BTL_BASE_AM_ATOMIC: diff --git a/opal/mca/btl/base/btl_base_error.h b/opal/mca/btl/base/btl_base_error.h index dac88471f03..e589092dc53 100644 --- a/opal/mca/btl/base/btl_base_error.h +++ b/opal/mca/btl/base/btl_base_error.h @@ -58,14 +58,14 @@ OPAL_DECLSPEC extern int mca_btl_base_out(const char *, ...) # define BTL_PEER_ERROR(proc, args) \ do { \ if (mca_btl_base_warn_peer_error || mca_btl_base_verbose > 0) { /* warn if verbose */ \ - char *errhost; \ + char *btl_peer_errhost; \ mca_btl_base_err("[%s]%s[%s:%d:%s] ", opal_process_info.nodename, \ OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), __FILE__, __LINE__, \ __func__); \ if (proc) { \ - errhost = opal_get_proc_hostname(proc); \ - mca_btl_base_err("peer: %s ", errhost); \ - free(errhost); \ + btl_peer_errhost= opal_get_proc_hostname(proc); \ + mca_btl_base_err("peer: %s ", btl_peer_errhost); \ + free(btl_peer_errhost); \ } \ mca_btl_base_err args; \ mca_btl_base_err("\n"); \ @@ -86,7 +86,6 @@ OPAL_DECLSPEC extern int mca_btl_base_out(const char *, ...) # else # define BTL_VERBOSE(args) # endif - #endif BEGIN_C_DECLS diff --git a/opal/mca/btl/sm/btl_sm_fbox.h b/opal/mca/btl/sm/btl_sm_fbox.h index dc3dc68eb31..d05806f1046 100644 --- a/opal/mca/btl/sm/btl_sm_fbox.h +++ b/opal/mca/btl/sm/btl_sm_fbox.h @@ -279,8 +279,8 @@ static inline bool mca_btl_sm_check_fboxes(void) } else if (OPAL_LIKELY(0xfe == hdr.data.tag)) { /* process fragment header */ fifo_value_t *value = (fifo_value_t *) (ep->fbox_in.buffer + start + sizeof(hdr)); - mca_btl_sm_hdr_t *hdr = relative2virtual(*value); - mca_btl_sm_poll_handle_frag(hdr, ep); + mca_btl_sm_hdr_t *sm_hdr = relative2virtual(*value); + mca_btl_sm_poll_handle_frag(sm_hdr, ep); } start = (start + hdr.data.size + sizeof(hdr) + MCA_BTL_SM_FBOX_ALIGNMENT_MASK) diff --git a/opal/mca/btl/tcp/btl_tcp_component.c b/opal/mca/btl/tcp/btl_tcp_component.c index 55a0bb471fc..2c5318302d4 100644 --- a/opal/mca/btl/tcp/btl_tcp_component.c +++ b/opal/mca/btl/tcp/btl_tcp_component.c @@ -808,14 +808,14 @@ static int mca_btl_tcp_component_create_instances(void) argv = include = split_and_resolve(&mca_btl_tcp_component.tcp_if_include, "include", true); while (argv && *argv) { char *if_name = *argv; - int if_index = opal_ifnametokindex(if_name); - if (if_index < 0) { + int idx = opal_ifnametokindex(if_name); + if (idx < 0) { opal_show_help("help-mpi-btl-tcp.txt", "invalid if_inexclude", true, "include", opal_process_info.nodename, if_name, "Unknown interface name"); ret = OPAL_ERR_NOT_FOUND; goto cleanup; } - mca_btl_tcp_create(if_index, if_name); + mca_btl_tcp_create(idx, if_name); argv++; } diff --git a/opal/mca/common/sm/common_sm.c b/opal/mca/common/sm/common_sm.c index ce329f60ace..75ea02030b8 100644 --- a/opal/mca/common/sm/common_sm.c +++ b/opal/mca/common/sm/common_sm.c @@ -264,12 +264,12 @@ void *mca_common_sm_seg_alloc(void *ctx, size_t *size) } /* ////////////////////////////////////////////////////////////////////////// */ -int mca_common_sm_fini(mca_common_sm_module_t *mca_common_sm_module) +int mca_common_sm_fini(mca_common_sm_module_t *module) { int rc = OPAL_SUCCESS; - if (NULL != mca_common_sm_module->module_seg) { - if (OPAL_SUCCESS != opal_shmem_segment_detach(&mca_common_sm_module->shmem_ds)) { + if (NULL != module->module_seg) { + if (OPAL_SUCCESS != opal_shmem_segment_detach(&module->shmem_ds)) { rc = OPAL_ERROR; } } diff --git a/opal/tools/wrappers/opal_wrapper.c b/opal/tools/wrappers/opal_wrapper.c index 0140a82d112..d2a31a2fff4 100644 --- a/opal/tools/wrappers/opal_wrapper.c +++ b/opal/tools/wrappers/opal_wrapper.c @@ -964,17 +964,17 @@ int main(int argc, char *argv[]) ? WTERMSIG(status) : (WIFSTOPPED(status) ? WSTOPSIG(status) : 255)); if ((OPAL_SUCCESS != ret) || ((0 != exit_status) && (flags & COMP_SHOW_ERROR))) { - char *exec_command = opal_argv_join(exec_argv, ' '); + char* exec_cmd = opal_argv_join(exec_argv, ' '); if (OPAL_SUCCESS != ret) { opal_show_help("help-opal-wrapper.txt", "spawn-failed", true, exec_argv[0], strerror(status), exec_command, NULL); } else { #if 0 opal_show_help("help-opal-wrapper.txt", "compiler-failed", true, - exec_argv[0], exit_status, exec_command, NULL); + exec_argv[0], exit_status, exec_cmd, NULL); #endif } - free(exec_command); + free(exec_cmd); } } } diff --git a/opal/util/output.c b/opal/util/output.c index 378649a7b9b..b9ae8ae6bca 100644 --- a/opal/util/output.c +++ b/opal/util/output.c @@ -970,7 +970,6 @@ static int output(int output_id, const char *format, va_list arglist) ++ldi->ldi_file_num_lines_lost; } else if (ldi->ldi_file_num_lines_lost > 0) { char buffer[BUFSIZ]; - char *out = buffer; memset(buffer, 0, BUFSIZ); snprintf(buffer, BUFSIZ - 1, "[WARNING: %d lines lost because the Open MPI process session " @@ -978,9 +977,6 @@ static int output(int output_id, const char *format, va_list arglist) ldi->ldi_file_num_lines_lost); write(ldi->ldi_fd, buffer, (int) strlen(buffer)); ldi->ldi_file_num_lines_lost = 0; - if (out != buffer) { - free(out); - } } } if (ldi->ldi_fd != -1) {