diff --git a/ompi/datatype/ompi_datatype.h b/ompi/datatype/ompi_datatype.h index f589c874b6..b73cc213ff 100644 --- a/ompi/datatype/ompi_datatype.h +++ b/ompi/datatype/ompi_datatype.h @@ -7,7 +7,7 @@ * Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2018 Research Organization for Information Science + * Copyright (c) 2015-2020 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -407,5 +407,15 @@ OMPI_DECLSPEC int ompi_datatype_pack_external_size( const char datarep[], int in } \ } +#define OMPI_DATATYPE_RELEASE_NO_NULLIFY(ddt) \ + { \ + if( !ompi_datatype_is_predefined((ddt)) ) { \ + OPAL_OUTPUT_VERBOSE((0, 100, "Datatype %p [%s] refcount %d in file %s:%d\n", \ + (void*)(ddt), (ddt)->name, (ddt)->super.super.obj_reference_count, \ + __func__, __LINE__)); \ + OBJ_RELEASE_NO_NULLIFY((ddt)); \ + } \ + } + END_C_DECLS #endif /* OMPI_DATATYPE_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index 6ffa1f165d..4423114bfa 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -624,7 +624,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: distance %d, inbuf %p, inbuf->buff %p, inbuf->buff-lb %p, to_inbuf %p, inbuf_list %p\n", rank, con->distance, (void *) temp_inbuf, (void *) temp_inbuf->buff, - (char *) temp_inbuf->buff - lower_bound, + (void *) ((char *) temp_inbuf->buff - lower_bound), (void *) to_inbuf((char *) temp_inbuf->buff - lower_bound, con->distance), (void *) &con->inbuf_list)); opal_free_list_return_st(&con->inbuf_list, (opal_free_list_item_t *) temp_inbuf); diff --git a/ompi/mca/coll/base/coll_base_allgatherv.c b/ompi/mca/coll/base/coll_base_allgatherv.c index c3ced000a0..3f09d91d6c 100644 --- a/ompi/mca/coll/base/coll_base_allgatherv.c +++ b/ompi/mca/coll/base/coll_base_allgatherv.c @@ -100,7 +100,7 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount, { int line = -1, err = 0, rank, size, sendto, recvfrom, distance, blockcount, i; int *new_rcounts = NULL, *new_rdispls = NULL, *new_scounts = NULL, *new_sdispls = NULL; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; struct ompi_datatype_t *new_rdtype, *new_sdtype; @@ -226,7 +226,7 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount, mca_coll_base_module_t *module) { int line = -1, rank, size, sendto, recvfrom, i, recvdatafrom, senddatafrom, err = 0; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; size = ompi_comm_size(comm); @@ -355,7 +355,7 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, int line = -1, rank, size, i, even_rank, err = 0; int neighbor[2], offset_at_step[2], recv_data_from[2], send_data_from; int new_scounts[2], new_sdispls[2], new_rcounts[2], new_rdispls[2]; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; struct ompi_datatype_t *new_rdtype, *new_sdtype; @@ -500,7 +500,7 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount, { int line = -1, err = 0, rank, remote; char *tmpsend = NULL, *tmprecv = NULL; - ptrdiff_t sext, rext, lb; + ptrdiff_t rext, lb; rank = ompi_comm_rank(comm); diff --git a/ompi/mca/coll/base/coll_base_util.c b/ompi/mca/coll/base/coll_base_util.c index 0a71e3c9df..552cd3fb6a 100644 --- a/ompi/mca/coll/base/coll_base_util.c +++ b/ompi/mca/coll/base/coll_base_util.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2019 Research Organization for Information Science + * Copyright (c) 2014-2020 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -220,7 +220,7 @@ static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) { if (NULL != request->data.vecs.stypes) { for (int i=0; idata.vecs.stypes[i]) { - OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]); + OMPI_DATATYPE_RELEASE_NO_NULLIFY(request->data.vecs.stypes[i]); } } request->data.vecs.stypes = NULL; @@ -228,7 +228,7 @@ static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) { if (NULL != request->data.vecs.rtypes) { for (int i=0; idata.vecs.rtypes[i]) { - OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]); + OMPI_DATATYPE_RELEASE_NO_NULLIFY(request->data.vecs.rtypes[i]); } } request->data.vecs.rtypes = NULL; diff --git a/ompi/mca/coll/base/coll_base_util.h b/ompi/mca/coll/base/coll_base_util.h index 2bbefc9e36..c793a1f7a4 100644 --- a/ompi/mca/coll/base/coll_base_util.h +++ b/ompi/mca/coll/base/coll_base_util.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2019 Research Organization for Information Science + * Copyright (c) 2014-2020 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -58,8 +58,8 @@ struct ompi_coll_base_nbc_request_t { opal_object_t *objs[2]; } objs; struct { - ompi_datatype_t **stypes; - ompi_datatype_t **rtypes; + ompi_datatype_t * const *stypes; + ompi_datatype_t * const *rtypes; } vecs; } data; }; diff --git a/ompi/mca/common/monitoring/Makefile.am b/ompi/mca/common/monitoring/Makefile.am index 1812245cde..60201f6dab 100644 --- a/ompi/mca/common/monitoring/Makefile.am +++ b/ompi/mca/common/monitoring/Makefile.am @@ -28,6 +28,9 @@ lib_LTLIBRARIES += $(component_install) lib_LTLIBRARIES += ompi_monitoring_prof.la ompi_monitoring_prof_la_SOURCES = monitoring_prof.c +if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS +ompi_monitoring_prof_la_SOURCES += monitoring_prof_f.c +endif ompi_monitoring_prof_la_LDFLAGS= \ -module -avoid-version -shared $(WRAPPER_EXTRA_LDFLAGS) ompi_monitoring_prof_la_LIBADD = \ diff --git a/ompi/mca/common/monitoring/monitoring_prof.c b/ompi/mca/common/monitoring/monitoring_prof.c index 3585c4927c..3d5bd442ec 100644 --- a/ompi/mca/common/monitoring/monitoring_prof.c +++ b/ompi/mca/common/monitoring/monitoring_prof.c @@ -378,67 +378,3 @@ int write_mat(char * filename, size_t * mat, unsigned int dim) return 0; } - -/** - * MPI binding for fortran - */ - -#include -#include "ompi_config.h" -#include "opal/threads/thread_usage.h" -#include "ompi/mpi/fortran/base/constants.h" -#include "ompi/mpi/fortran/base/fint_2_int.h" - -void monitoring_prof_mpi_init_f2c( MPI_Fint * ); -void monitoring_prof_mpi_finalize_f2c( MPI_Fint * ); - -void monitoring_prof_mpi_init_f2c( MPI_Fint *ierr ) { - int c_ierr; - int argc = 0; - char ** argv = NULL; - - c_ierr = MPI_Init(&argc, &argv); - if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); -} - -void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) { - int c_ierr; - - c_ierr = MPI_Finalize(); - if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); -} - -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_INIT = monitoring_prof_mpi_init_f2c -#pragma weak mpi_init = monitoring_prof_mpi_init_f2c -#pragma weak mpi_init_ = monitoring_prof_mpi_init_f2c -#pragma weak mpi_init__ = monitoring_prof_mpi_init_f2c -#pragma weak MPI_Init_f = monitoring_prof_mpi_init_f2c -#pragma weak MPI_Init_f08 = monitoring_prof_mpi_init_f2c - -#pragma weak MPI_FINALIZE = monitoring_prof_mpi_finalize_f2c -#pragma weak mpi_finalize = monitoring_prof_mpi_finalize_f2c -#pragma weak mpi_finalize_ = monitoring_prof_mpi_finalize_f2c -#pragma weak mpi_finalize__ = monitoring_prof_mpi_finalize_f2c -#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c -#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c -#elif OMPI_BUILD_FORTRAN_BINDINGS -#define OMPI_F77_PROTOTYPES_MPI_H -#include "ompi/mpi/fortran/mpif-h/bindings.h" - -OMPI_GENERATE_F77_BINDINGS (MPI_INIT, - mpi_init, - mpi_init_, - mpi_init__, - monitoring_prof_mpi_init_f2c, - (MPI_Fint *ierr), - (ierr) ) - -OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZE, - mpi_finalize, - mpi_finalize_, - mpi_finalize__, - monitoring_prof_mpi_finalize_f2c, - (MPI_Fint *ierr), - (ierr) ) -#endif diff --git a/ompi/mca/common/monitoring/monitoring_prof_f.c b/ompi/mca/common/monitoring/monitoring_prof_f.c new file mode 100644 index 0000000000..4e193a9b51 --- /dev/null +++ b/ompi/mca/common/monitoring/monitoring_prof_f.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013-2017 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2013-2017 Inria. All rights reserved. + * Copyright (c) 2013-2015 Bull SAS. All rights reserved. + * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/* + * MPI binding for fortran + */ + +#define OMPI_BUILD_MPI_PROFILING 0 +#define OMPI_COMPILING_FORTRAN_WRAPPERS 1 + +#include + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" +#include "ompi/mpi/fortran/base/constants.h" + + +void monitoring_prof_mpi_init_f2c( MPI_Fint * ); +void monitoring_prof_mpi_finalize_f2c( MPI_Fint * ); + +void monitoring_prof_mpi_init_f2c( MPI_Fint *ierr ) { + int c_ierr; + int argc = 0; + char ** argv = NULL; + + c_ierr = PMPI_Init(&argc, &argv); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); +} + +void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) { + int c_ierr; + + c_ierr = PMPI_Finalize(); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); +} + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_INIT = monitoring_prof_mpi_init_f2c +#pragma weak mpi_init = monitoring_prof_mpi_init_f2c +#pragma weak mpi_init_ = monitoring_prof_mpi_init_f2c +#pragma weak mpi_init__ = monitoring_prof_mpi_init_f2c +#pragma weak MPI_Init_f = monitoring_prof_mpi_init_f2c +#pragma weak MPI_Init_f08 = monitoring_prof_mpi_init_f2c + +#pragma weak MPI_FINALIZE = monitoring_prof_mpi_finalize_f2c +#pragma weak mpi_finalize = monitoring_prof_mpi_finalize_f2c +#pragma weak mpi_finalize_ = monitoring_prof_mpi_finalize_f2c +#pragma weak mpi_finalize__ = monitoring_prof_mpi_finalize_f2c +#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c +#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c +#else + +OMPI_GENERATE_F77_BINDINGS (MPI_INIT, + mpi_init, + mpi_init_, + mpi_init__, + monitoring_prof_mpi_init_f2c, + (MPI_Fint *ierr), + (ierr) ) + +OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZE, + mpi_finalize, + mpi_finalize_, + mpi_finalize__, + monitoring_prof_mpi_finalize_f2c, + (MPI_Fint *ierr), + (ierr) ) +#endif diff --git a/ompi/mca/osc/rdma/osc_rdma_dynamic.c b/ompi/mca/osc/rdma/osc_rdma_dynamic.c index a8c8116c64..b5cde23d21 100644 --- a/ompi/mca/osc/rdma/osc_rdma_dynamic.c +++ b/ompi/mca/osc/rdma/osc_rdma_dynamic.c @@ -113,8 +113,8 @@ static bool ompi_osc_rdma_find_conflicting_attachment (ompi_osc_rdma_handle_t *h OPAL_LIST_FOREACH(attachment, &handle->attachments, ompi_osc_rdma_attachment_t) { intptr_t region_bound = attachment->base + attachment->len; - if (base >= attachment->base && base < region_bound || - bound > attachment->base && bound <= region_bound) { + if ((base >= attachment->base && base < region_bound) || + (bound > attachment->base && bound <= region_bound)) { OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "existing region {%p, %p} overlaps region {%p, %p}", (void *) attachment->base, (void *) region_bound, (void *) base, (void *) bound); return true; @@ -295,8 +295,7 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base) ompi_osc_rdma_handle_t *rdma_region_handle; osc_rdma_counter_t region_count, region_id; ompi_osc_rdma_region_t *region; - void *bound; - int start_index = INT_MAX, region_index; + int region_index; if (module->flavor != MPI_WIN_FLAVOR_DYNAMIC) { return OMPI_ERR_WIN; @@ -313,9 +312,10 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base) rdma_region_handle = module->dynamic_handles[region_index]; region = (ompi_osc_rdma_region_t *) ((intptr_t) module->state->regions + region_index * module->region_size); OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "checking attachments at index %d {.base=%p, len=%lu} for attachment %p" - ", region handle=%p", region_index, (void *) region->base, region->len, base, rdma_region_handle); + ", region handle=%p", region_index, (void *) region->base, + (unsigned long) region->len, base, (void *) rdma_region_handle); - if (region->base > (uintptr_t) base || (region->base + region->len) < (uintptr_t) base) { + if (region->base > (intptr_t) base || (region->base + region->len) < (uintptr_t) base) { continue; } diff --git a/ompi/mca/osc/rdma/osc_rdma_types.h b/ompi/mca/osc/rdma/osc_rdma_types.h index f4f96b8ff3..bb3f500b99 100644 --- a/ompi/mca/osc/rdma/osc_rdma_types.h +++ b/ompi/mca/osc/rdma/osc_rdma_types.h @@ -23,7 +23,7 @@ struct ompi_osc_rdma_peer_t; #if OPAL_HAVE_ATOMIC_MATH_64 typedef int64_t osc_rdma_base_t; -typedef int64_t osc_rdma_size_t; +typedef uint64_t osc_rdma_size_t; typedef int64_t osc_rdma_counter_t; #define ompi_osc_rdma_counter_add opal_atomic_add_fetch_64 @@ -31,7 +31,7 @@ typedef int64_t osc_rdma_counter_t; #else typedef int32_t osc_rdma_base_t; -typedef int32_t osc_rdma_size_t; +typedef uint32_t osc_rdma_size_t; typedef int32_t osc_rdma_counter_t; #define ompi_osc_rdma_counter_add opal_atomic_add_fetch_32 diff --git a/ompi/tools/ompi_info/Makefile.am b/ompi/tools/ompi_info/Makefile.am index 9875701a6e..d009ec8e7e 100644 --- a/ompi/tools/ompi_info/Makefile.am +++ b/ompi/tools/ompi_info/Makefile.am @@ -28,7 +28,7 @@ AM_CFLAGS = \ -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ - -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \ + -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \ -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ diff --git a/opal/class/opal_object.h b/opal/class/opal_object.h index 4e2da95c20..45cb4ac060 100644 --- a/opal/class/opal_object.h +++ b/opal/class/opal_object.h @@ -11,8 +11,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ @@ -345,6 +345,27 @@ static inline opal_object_t *opal_obj_new_debug(opal_class_t* type, const char* } while (0) #endif +#if OPAL_ENABLE_DEBUG +#define OBJ_RELEASE_NO_NULLIFY(object) \ + do { \ + assert(OPAL_OBJ_MAGIC_ID == ((opal_object_t *) (object))->obj_magic_id); \ + assert(NULL != ((opal_object_t *) (object))->obj_class); \ + if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \ + OBJ_SET_MAGIC_ID((object), 0); \ + opal_obj_run_destructors((opal_object_t *) (object)); \ + OBJ_REMEMBER_FILE_AND_LINENO( object, __FILE__, __LINE__ ); \ + free((void *) object); \ + } \ + } while (0) +#else +#define OBJ_RELEASE_NO_NULLIFY(object) \ + do { \ + if (0 == opal_obj_update((opal_object_t *) (object), -1)) { \ + opal_obj_run_destructors((opal_object_t *) (object)); \ + free((void *) object); \ + } \ + } while (0) +#endif /** * Construct (initialize) objects that are not dynamically allocated. diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index c00bf5ff4d..9787df0666 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -41,7 +41,7 @@ opal_convertor_merge_iov( struct iovec* iov, uint32_t* iov_count, uint32_t* idx ) { if( 0 != iov[*idx].iov_len ) { - if( (base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len)) ) { + if (base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len)) { iov[*idx].iov_len += len; /* merge with previous iovec */ return 0; } /* cannot merge, move to the next position */ diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index cbe488b7b7..2a2e79180d 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -68,7 +68,7 @@ pack_partial_blocklen( opal_convertor_t* CONVERTOR, OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack memcpy( %p, %p, %lu ) => space %lu [partial]\n", - _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + (void*) _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); *(memory) += (ptrdiff_t)do_now_bytes; if( do_now == left_in_block ) /* compensate if completed a blocklen */ diff --git a/opal/mca/btl/usnic/btl_usnic_cagent.c b/opal/mca/btl/usnic/btl_usnic_cagent.c index 386aec0a26..c1f8382af7 100644 --- a/opal/mca/btl/usnic/btl_usnic_cagent.c +++ b/opal/mca/btl/usnic/btl_usnic_cagent.c @@ -44,7 +44,7 @@ static opal_event_t ipc_event; static struct timeval ack_timeout; static opal_list_t udp_port_listeners; static opal_list_t ipc_listeners; -static volatile int ipc_accepts = 0; +static volatile uint32_t ipc_accepts = 0; /* JMS The pings_pending and ping_results should probably both be hash tables for more efficient lookups */ static opal_list_t pings_pending; diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index bb77b4175b..f6405e9159 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -55,6 +55,11 @@ #include "memory_patcher.h" #undef opal_memory_changed +#define HAS_SHMDT (defined(SYS_shmdt) || \ + (defined(IPCOP_shmdt) && defined(SYS_ipc))) +#define HAS_SHMAT (defined(SYS_shmat) || \ + (defined(IPCOP_shmat) && defined(SYS_ipc))) + static int patcher_open(void); static int patcher_close(void); static int patcher_register(void); @@ -113,15 +118,25 @@ opal_memory_patcher_component_t mca_memory_patcher_component = { */ static void *_intercept_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) __opal_attribute_noinline__; static int _intercept_munmap(void *start, size_t length) __opal_attribute_noinline__; +#if defined (SYS_mremap) #if defined(__linux__) static void *_intercept_mremap (void *start, size_t oldlen, size_t newlen, int flags, void *new_address) __opal_attribute_noinline__; #else static void *_intercept_mremap (void *start, size_t oldlen, void *new_address, size_t newlen, int flags) __opal_attribute_noinline__; -#endif +#endif // defined(__linux__) +#endif // defined(SYS_mremap) static int _intercept_madvise (void *start, size_t length, int advice) __opal_attribute_noinline__; +#if defined SYS_brk static int _intercept_brk (void *addr) __opal_attribute_noinline__; +#endif +#if defined(__linux__) +#if HAS_SHMAT static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg) __opal_attribute_noinline__; +#endif // HAS_SHMAT +#if HAS_SHMDT static int _intercept_shmdt (const void *shmaddr) __opal_attribute_noinline__; +#endif // HAS_SHMDT +#endif // defined(__linux__) #if defined (SYS_mmap) @@ -362,12 +377,8 @@ static int intercept_brk (void *addr) #define IPCOP_shmdt 22 #endif -#define HAS_SHMDT (defined(SYS_shmdt) || \ - (defined(IPCOP_shmdt) && defined(SYS_ipc))) -#define HAS_SHMAT (defined(SYS_shmat) || \ - (defined(IPCOP_shmat) && defined(SYS_ipc))) - -#if (HAS_SHMDT || HAS_SHMAT) && defined(__linux__) +#if defined(__linux__) +#if (HAS_SHMDT || HAS_SHMAT) #include #include @@ -443,8 +454,10 @@ static size_t get_shm_size(int shmid) return ds.shm_segsz; } #endif +#endif // defined(__linux__) -#if HAS_SHMAT && defined(__linux__) +#if defined(__linux__) +#if HAS_SHMAT static void *(*original_shmat)(int shmid, const void *shmaddr, int shmflg); static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg) @@ -490,8 +503,10 @@ static void* intercept_shmat (int shmid, const void * shmaddr, int shmflg) return result; } #endif +#endif // defined(__linux__) -#if HAS_SHMDT && defined(__linux__) +#if defined(__linux__) +#if HAS_SHMDT static int (*original_shmdt) (const void *); static int _intercept_shmdt (const void *shmaddr) @@ -523,6 +538,7 @@ static int intercept_shmdt (const void *shmaddr) return result; } #endif +#endif // defined(__linux__) static int patcher_register (void) { @@ -598,19 +614,21 @@ static int patcher_open (void) } #endif -#if HAS_SHMAT && defined(__linux__) +#if defined(__linux__) +#if HAS_SHMAT rc = opal_patcher->patch_symbol ("shmat", (uintptr_t) intercept_shmat, (uintptr_t *) &original_shmat); if (OPAL_SUCCESS != rc) { return rc; } -#endif +#endif // HAS_SHMAT -#if HAS_SHMDT && defined(__linux__) +#if HAS_SHMDT rc = opal_patcher->patch_symbol ("shmdt", (uintptr_t) intercept_shmdt, (uintptr_t *) &original_shmdt); if (OPAL_SUCCESS != rc) { return rc; } -#endif +#endif // HAS_SHMDT +#endif // defined(__linux__) #if defined (SYS_brk) rc = opal_patcher->patch_symbol ("brk", (uintptr_t)intercept_brk, (uintptr_t *) &original_brk); diff --git a/opal/mca/patcher/base/patcher_base_patch.c b/opal/mca/patcher/base/patcher_base_patch.c index 07e2c1ea34..9e949763f8 100644 --- a/opal/mca/patcher/base/patcher_base_patch.c +++ b/opal/mca/patcher/base/patcher_base_patch.c @@ -77,6 +77,7 @@ static int PatchLoadImm (uintptr_t addr, unsigned int reg, size_t value) #endif +#if !HAVE___CLEAR_CACHE static void flush_and_invalidate_cache (unsigned long a) { #if OPAL_ASSEMBLY_ARCH == OPAL_IA32 @@ -114,6 +115,7 @@ static void flush_and_invalidate_cache (unsigned long a) "isb":: "r" (a)); #endif } +#endif // !HAVE___CLEAR_CACHE // modify protection of memory range static void ModifyMemoryProtection (uintptr_t addr, size_t length, int prot) diff --git a/opal/mca/pmix/pmix3x/pmix3x.c b/opal/mca/pmix/pmix3x/pmix3x.c index 5e0e91342b..90670f6adb 100644 --- a/opal/mca/pmix/pmix3x/pmix3x.c +++ b/opal/mca/pmix/pmix3x/pmix3x.c @@ -1191,9 +1191,7 @@ int pmix3x_value_unload(opal_value_t *kv, /* handle the various types */ if (PMIX_INFO == v->data.darray->type) { pmix_info_t *iptr = (pmix_info_t*)v->data.darray->array; - if (NULL != iptr[n].key) { - ival->key = strdup(iptr[n].key); - } + ival->key = strdup(iptr[n].key); rc = pmix3x_value_unload(ival, &iptr[n].value); if (OPAL_SUCCESS != rc) { OPAL_LIST_RELEASE(lt); diff --git a/opal/util/os_path.c b/opal/util/os_path.c index 251a6107fc..e84ae87a46 100644 --- a/opal/util/os_path.c +++ b/opal/util/os_path.c @@ -32,7 +32,7 @@ static const char *path_sep = OPAL_PATH_SEP; -char *opal_os_path(bool relative, ...) +char *opal_os_path(int relative, ...) { va_list ap; char *element, *path; diff --git a/opal/util/os_path.h b/opal/util/os_path.h index 4c2db908f4..d13cdd8411 100644 --- a/opal/util/os_path.h +++ b/opal/util/os_path.h @@ -62,8 +62,12 @@ BEGIN_C_DECLS * provided path elements, separated by the path separator character * appropriate to the local operating system. The path_name string has been malloc'd * and therefore the user is responsible for free'ing the field. -*/ -OPAL_DECLSPEC char *opal_os_path(bool relative, ...) __opal_attribute_malloc__ __opal_attribute_sentinel__ __opal_attribute_warn_unused_result__; + * + * NOTE: Since this is a varargs function, the last known parameter + * can't undergo a default promotion (e.g., from bool to int), because + * that is undefined behavior. Hence, the type of "relative" is int. + */ +OPAL_DECLSPEC char *opal_os_path(int relative, ...) __opal_attribute_malloc__ __opal_attribute_sentinel__ __opal_attribute_warn_unused_result__; /** * Convert the path to be OS friendly. On UNIX this function will diff --git a/opal/util/show_help.c b/opal/util/show_help.c index 18c82ccbff..8d39e91de5 100644 --- a/opal/util/show_help.c +++ b/opal/util/show_help.c @@ -50,7 +50,7 @@ static char **search_dirs = NULL; static int opal_show_vhelp_internal(const char *filename, const char *topic, bool want_error_header, va_list arglist); static int opal_show_help_internal(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); opal_show_help_fn_t opal_show_help = opal_show_help_internal; opal_show_vhelp_fn_t opal_show_vhelp = opal_show_vhelp_internal; @@ -317,7 +317,7 @@ char *opal_show_help_vstring(const char *filename, const char *topic, } char *opal_show_help_string(const char *filename, const char *topic, - bool want_error_handler, ...) + int want_error_handler, ...) { char *output; va_list arglist; @@ -349,7 +349,7 @@ static int opal_show_vhelp_internal(const char *filename, const char *topic, } static int opal_show_help_internal(const char *filename, const char *topic, - bool want_error_header, ...) + int want_error_header, ...) { va_list arglist; int rc; diff --git a/opal/util/show_help.h b/opal/util/show_help.h index 8806f05906..8d1967df9c 100644 --- a/opal/util/show_help.h +++ b/opal/util/show_help.h @@ -127,9 +127,14 @@ OPAL_DECLSPEC int opal_show_help_finalize(void); * (typically $prefix/share/openmpi), and looks up the message * based on the topic, and displays it. If want_error_header is * true, a header and footer of asterisks are also displayed. + * + * NOTE: Since this is a varargs function, the last known parameter + * can't undergo a default promotion (e.g., from bool to int), because + * that is undefined behavior. Hence, the type of "want_error_header" + * is int. */ typedef int (*opal_show_help_fn_t)(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); OPAL_DECLSPEC extern opal_show_help_fn_t opal_show_help; /** @@ -143,10 +148,15 @@ OPAL_DECLSPEC extern opal_show_vhelp_fn_t opal_show_vhelp; /** * This function does the same thing as opal_show_help(), but returns * its output in a string (that must be freed by the caller). + * + * NOTE: Since this is a varargs function, the last known parameter + * can't undergo a default promotion (e.g., from bool to int), because + * that is undefined behavior. Hence, the type of "want_error_header" + * is int. */ OPAL_DECLSPEC char* opal_show_help_string(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); /** * This function does the same thing as opal_show_help_string(), but diff --git a/orte/mca/schizo/slurm/schizo_slurm.c b/orte/mca/schizo/slurm/schizo_slurm.c index c91e53b2e2..69b8710d4a 100644 --- a/orte/mca/schizo/slurm/schizo_slurm.c +++ b/orte/mca/schizo/slurm/schizo_slurm.c @@ -45,7 +45,6 @@ static bool myenvdefined = false; static orte_schizo_launch_environ_t check_launch_environment(void) { - char *bind, *list, *ptr; int i; if (myenvdefined) { diff --git a/orte/util/show_help.c b/orte/util/show_help.c index 1b68c94580..8490f2b3d7 100644 --- a/orte/util/show_help.c +++ b/orte/util/show_help.c @@ -591,7 +591,7 @@ void orte_show_help_finalize(void) } int orte_show_help(const char *filename, const char *topic, - bool want_error_header, ...) + int want_error_header, ...) { int rc = ORTE_SUCCESS; va_list arglist; diff --git a/orte/util/show_help.h b/orte/util/show_help.h index cb572e4634..f2645d6c29 100644 --- a/orte/util/show_help.h +++ b/orte/util/show_help.h @@ -78,7 +78,7 @@ ORTE_DECLSPEC void orte_show_help_finalize(void); * (e.g., cray). */ ORTE_DECLSPEC int orte_show_help(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); /** * Exactly the same as orte_show_help, but pass in a rendered string, diff --git a/oshmem/tools/oshmem_info/Makefile.am b/oshmem/tools/oshmem_info/Makefile.am index 4f30236dd2..03df12e126 100644 --- a/oshmem/tools/oshmem_info/Makefile.am +++ b/oshmem/tools/oshmem_info/Makefile.am @@ -17,7 +17,7 @@ AM_CPPFLAGS = \ -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ - -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \ + -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \ -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \