Skip to content

Another round of warning cleanups on master #9903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ompi/attribute/attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,9 @@ static void attr_subsys_construct(attr_subsys_t *subsys)
opal_bitmap_set_max_size (subsys->key_bitmap,
OMPI_FORTRAN_HANDLE_MAX);
ret = opal_bitmap_init(subsys->key_bitmap, 32);
assert(OPAL_SUCCESS == ret);
if (OPAL_SUCCESS != ret) {
abort();
}

for (int i = 0; i < MPI_ATTR_PREDEFINED_KEY_MAX; i++) {
opal_bitmap_set_bit(subsys->key_bitmap, i);
Expand All @@ -615,9 +617,11 @@ static void attr_subsys_construct(attr_subsys_t *subsys)
}

ret = opal_hash_table_init(subsys->keyval_hash, ATTR_TABLE_SIZE);
assert (OPAL_SUCCESS == ret);
if (OPAL_SUCCESS != ret) {
abort();
}

attr_sequence = 0;
attr_sequence = 0;
}


Expand Down
5 changes: 3 additions & 2 deletions ompi/dpm/dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,9 @@ static int dpm_convert(opal_list_t *infos,
/**** Get here if the specified option is not found in the
**** current list - add it
****/

if (NULL == directive) {
if (NULL == directive && NULL == modifier) {
return OMPI_ERR_BAD_PARAM;
} else if (NULL == directive) {
opal_asprintf(&ptr, ":%s", modifier);
} else if (NULL == modifier) {
ptr = strdup(directive);
Expand Down
6 changes: 3 additions & 3 deletions ompi/mca/coll/ftagree/coll_ftagree_earlyreturning.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,11 +1623,12 @@ static void era_decide(era_value_t *decided_value, era_agreement_info_t *ci)
ompi_communicator_t *comm;
era_rank_item_t *rl;
int r, s, dead_size;
void *value;

assert( 0 != ci->agreement_id.ERAID_FIELDS.agreementid );

#if OPAL_ENABLE_DEBUG
void *value;

r = era_parent(ci);
if( opal_hash_table_get_value_uint64(&era_passed_agreements,
ci->agreement_id.ERAID_KEY, &value) == OMPI_SUCCESS ) {
Expand Down Expand Up @@ -2636,7 +2637,6 @@ static void era_cb_fn(struct mca_btl_base_module_t* btl,
const mca_btl_base_receive_descriptor_t* descriptor)
{
era_incomplete_msg_t *incomplete_msg = NULL;
mca_btl_base_tag_t tag = descriptor->tag;
era_msg_header_t *msg_header;
era_frag_t *frag;
uint64_t src_hash;
Expand All @@ -2646,7 +2646,7 @@ static void era_cb_fn(struct mca_btl_base_module_t* btl,
int *new_dead;
int *ack_failed;

assert(MCA_BTL_TAG_FT_AGREE == tag);
assert(MCA_BTL_TAG_FT_AGREE == descriptor->tag);
assert(1 == descriptor->des_segment_count);

frag = (era_frag_t*)descriptor->des_segments->seg_addr.pval;
Expand Down
8 changes: 6 additions & 2 deletions ompi/mca/hook/comm_method/hook_comm_method_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,17 @@ ompi_report_comm_methods(int called_from_location) // 1 = from init, 2 = from fi
fp = fopen(mca_hook_comm_method_fakefile, "r");
for (i=0; i<nleaderranks; ++i) {
for (k=0; k<nleaderranks; ++k) {
fscanf(fp, "%d", &setting);
if (fscanf(fp, "%d", &setting) != 1) {
break;
}
// let -1 mean "use existing (real) setting"
if (setting != -1) {
method[i * nleaderranks + k] = setting;
}
}
fscanf(fp, "\n");
if (fscanf(fp, "\n") != 0) {
break;
}
}
fclose(fp);
}
Expand Down
3 changes: 2 additions & 1 deletion ompi/mca/sharedfp/sm/sharedfp_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "ompi_config.h"
#include "mpi.h"
#include "opal/util/printf.h"
#include "ompi/mca/sharedfp/sharedfp.h"
#include "ompi/mca/sharedfp/base/base.h"
#include "ompi/mca/sharedfp/sm/sharedfp_sm.h"
Expand Down Expand Up @@ -105,7 +106,7 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_sm_component_file_query(o
int comm_cid = -1;
int pid = ompi_comm_rank (comm);

asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
opal_asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
filename_basename, comm_cid, pid);
free(filename_basename);

Expand Down
11 changes: 8 additions & 3 deletions ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "sharedfp_sm.h"

#include "mpi.h"
#include "opal/util/printf.h"
#include "opal/util/output.h"
#include "ompi/constants.h"
#include "ompi/group/group.h"
#include "ompi/proc/proc.h"
Expand Down Expand Up @@ -119,8 +121,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
return err;
}

asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
filename_basename, comm_cid, int_pid);
opal_asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
filename_basename, comm_cid, int_pid);
/* open shared memory file, initialize to 0, map into memory */
sm_fd = open(sm_filename, O_RDWR | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
Expand All @@ -139,7 +141,10 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
/* TODO: is it necessary to write to the file first? */
if( 0 == fh->f_rank ){
memset ( &sm_offset, 0, sizeof (struct mca_sharedfp_sm_offset ));
write ( sm_fd, &sm_offset, sizeof(struct mca_sharedfp_sm_offset));
err = opal_best_effort_write ( sm_fd, &sm_offset, sizeof(struct mca_sharedfp_sm_offset));
if (OPAL_SUCCESS != err) {
return err;
}
}
err = comm->c_coll->coll_barrier (comm, comm->c_coll->coll_barrier_module );
if ( OMPI_SUCCESS != err ) {
Expand Down
2 changes: 2 additions & 0 deletions ompi/runtime/ompi_mpi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
ompi_proc_t** procs;
size_t nprocs;
char *error = NULL;
#if OPAL_USING_INTERNAL_PMIX
char *evar;
#endif
volatile bool active;
bool background_fence = false;
pmix_info_t info[2];
Expand Down
12 changes: 8 additions & 4 deletions ompi/tools/mpirun/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
#include "opal/util/os_dirpath.h"
#include "opal/util/os_path.h"
#include "opal/util/path.h"
#include "opal/util/printf.h"

int main(int argc, char *argv[])
{
char *evar, *pvar;
char *evar;
#if OPAL_USING_INTERNAL_PMIX || OMPI_USING_INTERNAL_PRRTE
char *pvar;
#endif
char **pargs = NULL;
char *pfx = NULL;
int m, param_len;
Expand All @@ -35,12 +39,12 @@ int main(int argc, char *argv[])
if (NULL != (evar = getenv("OPAL_PREFIX"))) {

#if OMPI_USING_INTERNAL_PRRTE
(void)asprintf(&pvar, "PRTE_PREFIX=%s", evar);
opal_asprintf(&pvar, "PRTE_PREFIX=%s", evar);
putenv(pvar);
#endif

#if OPAL_USING_INTERNAL_PMIX
(void)asprintf(&pvar, "PMIX_PREFIX=%s", evar);
opal_asprintf(&pvar, "PMIX_PREFIX=%s", evar);
putenv(pvar);
#endif
}
Expand All @@ -51,7 +55,7 @@ int main(int argc, char *argv[])
opal_argv_append_nosize(&pargs, argv[m]);
/* Did the user specify a prefix, or want prefix by default? */
if (0 == strcmp(argv[m], "--prefix")) {
asprintf(&pfx, "%s%s", argv[m+1], "/bin");
opal_asprintf(&pfx, "%s%s", argv[m+1], "/bin");
}
}

Expand Down
4 changes: 1 addition & 3 deletions opal/datatype/opal_datatype_unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ int32_t opal_unpack_general_function(opal_convertor_t *pConvertor, struct iovec
dt_stack_t *pStack; /* pointer to the position on the stack */
uint32_t pos_desc; /* actual position in the description of the derived datatype */
size_t count_desc; /* the number of items already done in the actual pos_desc */
uint16_t type = OPAL_DATATYPE_MAX_PREDEFINED; /* type at current position */
size_t total_unpacked = 0; /* total size unpacked this time */
dt_elem_desc_t *description;
dt_elem_desc_t *pElem;
Expand Down Expand Up @@ -588,15 +587,14 @@ int32_t opal_unpack_general_function(opal_convertor_t *pConvertor, struct iovec
while (1) {
while (pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA) {
/* now here we have a basic datatype */
type = description[pos_desc].elem.common.type;
OPAL_DATATYPE_SAFEGUARD_POINTER(conv_ptr + pElem->elem.disp, pData->size,
pConvertor->pBaseBuf, pData, pConvertor->count);
DO_DEBUG(opal_output(0,
"unpack (%p, %ld) -> (%p:%ld, %" PRIsize_t ", %ld) type %s\n",
(void *) iov_ptr, iov_len_local, (void *) pConvertor->pBaseBuf,
conv_ptr + pElem->elem.disp - pConvertor->pBaseBuf, count_desc,
description[pos_desc].elem.extent,
opal_datatype_basicDatatypes[type]->name););
opal_datatype_basicDatatypes[description[pos_desc].elem.common.type]->name););
unpack_predefined_heterogeneous(pConvertor, pElem, &count_desc, &conv_ptr, &iov_ptr,
&iov_len_local);
if (0 == count_desc) { /* completed */
Expand Down
5 changes: 3 additions & 2 deletions opal/mca/backtrace/execinfo/backtrace_execinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#endif

#include "opal/constants.h"
#include "opal/util/output.h"
#include "opal/mca/backtrace/backtrace.h"

int opal_backtrace_print(FILE *file, char *prefix, int strip)
Expand All @@ -52,10 +53,10 @@ int opal_backtrace_print(FILE *file, char *prefix, int strip)

for (i = strip; i < trace_size; i++) {
if (NULL != prefix) {
write(fd, prefix, strlen(prefix));
opal_best_effort_write(fd, prefix, strlen(prefix));
}
len = snprintf(buf, sizeof(buf), "[%2d] ", i - strip);
write(fd, buf, len);
opal_best_effort_write(fd, buf, len);
backtrace_symbols_fd(&trace[i], 1, fd);
}

Expand Down
12 changes: 3 additions & 9 deletions opal/mca/btl/base/btl_base_am_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ struct mca_btl_base_rdma_hdr_t {
/* the following fields are not used on the target and are only relevant
* to the initiator */
uint64_t context;

/* registration handles (if required) */
uint8_t handle_data[];
};
typedef struct mca_btl_base_rdma_hdr_t mca_btl_base_rdma_hdr_t;

Expand Down Expand Up @@ -218,11 +215,6 @@ static inline size_t size_t_min(size_t a, size_t b)
return (a < b) ? a : b;
}

static inline size_t size_t_max(size_t a, size_t b)
{
return (a > b) ? a : b;
}

static mca_btl_base_am_rdma_module_t default_module;

static inline bool mca_btl_base_rdma_use_rdma_get(mca_btl_base_module_t *btl)
Expand Down Expand Up @@ -1009,8 +1001,10 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl,
&tmp, (int32_t) hdr->data.atomic.operand[1]);
atomic_response = tmp;
} else if (8 == hdr->data.atomic.size) {
int64_t tmp = (int64_t) atomic_response;
opal_atomic_compare_exchange_strong_64((opal_atomic_int64_t *) hdr->target_address,
&atomic_response, hdr->data.atomic.operand[1]);
&tmp, hdr->data.atomic.operand[1]);
atomic_response = tmp;
}
break;
default:
Expand Down
7 changes: 6 additions & 1 deletion opal/mca/mpool/base/mpool_base_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ static void *mca_mpool_default_alloc(mca_mpool_base_module_t *mpool, size_t size
if (align <= sizeof(void *)) {
addr = malloc(size);
} else {
(void) posix_memalign(&addr, align, size);
int ret = posix_memalign(&addr, align, size);
if (ret < 0) {
/* old systems may not guarantee that addr wasn't modified
on failure */
addr = NULL;
}
}
return addr;
#else
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/rcache/base/rcache_base_mem_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#endif

#include "opal/runtime/opal_params.h"
#include "opal/util/output.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"

Expand Down Expand Up @@ -72,7 +73,7 @@ void mca_rcache_base_mem_cb(void *base, size_t size, void *cbdata, bool from_all
"will now abort.\n",
opal_process_info.nodename, getpid(), base, (unsigned long) size);
msg[sizeof(msg) - 1] = '\0';
write(2, msg, len);
opal_best_effort_write(2, msg, len);
} else {
opal_show_help("help-rcache-base.txt", "cannot deregister in-use memory", true,
current->rcache_component->rcache_version.mca_component_name,
Expand Down
2 changes: 0 additions & 2 deletions opal/util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ headers = \
clock_gettime.h \
cmd_line.h \
crc.h \
daemon_init.h \
ethtool.h \
error.h \
event.h \
Expand Down Expand Up @@ -92,7 +91,6 @@ libopalutil_la_SOURCES = \
bipartite_graph.c \
cmd_line.c \
crc.c \
daemon_init.c \
ethtool.c \
error.c \
event.c \
Expand Down
Loading