Skip to content

Commit 053ce66

Browse files
authored
Merge pull request #9903 from bwbarrett/cleanup/warnings-suck
Another round of warning cleanups on master
2 parents 82746f2 + 03a2513 commit 053ce66

File tree

21 files changed

+121
-186
lines changed

21 files changed

+121
-186
lines changed

ompi/attribute/attribute.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ static void attr_subsys_construct(attr_subsys_t *subsys)
594594
opal_bitmap_set_max_size (subsys->key_bitmap,
595595
OMPI_FORTRAN_HANDLE_MAX);
596596
ret = opal_bitmap_init(subsys->key_bitmap, 32);
597-
assert(OPAL_SUCCESS == ret);
597+
if (OPAL_SUCCESS != ret) {
598+
abort();
599+
}
598600

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

617619
ret = opal_hash_table_init(subsys->keyval_hash, ATTR_TABLE_SIZE);
618-
assert (OPAL_SUCCESS == ret);
620+
if (OPAL_SUCCESS != ret) {
621+
abort();
622+
}
619623

620-
attr_sequence = 0;
624+
attr_sequence = 0;
621625
}
622626

623627

ompi/dpm/dpm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,9 @@ static int dpm_convert(opal_list_t *infos,
783783
/**** Get here if the specified option is not found in the
784784
**** current list - add it
785785
****/
786-
787-
if (NULL == directive) {
786+
if (NULL == directive && NULL == modifier) {
787+
return OMPI_ERR_BAD_PARAM;
788+
} else if (NULL == directive) {
788789
opal_asprintf(&ptr, ":%s", modifier);
789790
} else if (NULL == modifier) {
790791
ptr = strdup(directive);

ompi/mca/coll/ftagree/coll_ftagree_earlyreturning.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,11 +1623,12 @@ static void era_decide(era_value_t *decided_value, era_agreement_info_t *ci)
16231623
ompi_communicator_t *comm;
16241624
era_rank_item_t *rl;
16251625
int r, s, dead_size;
1626-
void *value;
16271626

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

16301629
#if OPAL_ENABLE_DEBUG
1630+
void *value;
1631+
16311632
r = era_parent(ci);
16321633
if( opal_hash_table_get_value_uint64(&era_passed_agreements,
16331634
ci->agreement_id.ERAID_KEY, &value) == OMPI_SUCCESS ) {
@@ -2636,7 +2637,6 @@ static void era_cb_fn(struct mca_btl_base_module_t* btl,
26362637
const mca_btl_base_receive_descriptor_t* descriptor)
26372638
{
26382639
era_incomplete_msg_t *incomplete_msg = NULL;
2639-
mca_btl_base_tag_t tag = descriptor->tag;
26402640
era_msg_header_t *msg_header;
26412641
era_frag_t *frag;
26422642
uint64_t src_hash;
@@ -2646,7 +2646,7 @@ static void era_cb_fn(struct mca_btl_base_module_t* btl,
26462646
int *new_dead;
26472647
int *ack_failed;
26482648

2649-
assert(MCA_BTL_TAG_FT_AGREE == tag);
2649+
assert(MCA_BTL_TAG_FT_AGREE == descriptor->tag);
26502650
assert(1 == descriptor->des_segment_count);
26512651

26522652
frag = (era_frag_t*)descriptor->des_segments->seg_addr.pval;

ompi/mca/hook/comm_method/hook_comm_method_fns.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,13 +545,17 @@ ompi_report_comm_methods(int called_from_location) // 1 = from init, 2 = from fi
545545
fp = fopen(mca_hook_comm_method_fakefile, "r");
546546
for (i=0; i<nleaderranks; ++i) {
547547
for (k=0; k<nleaderranks; ++k) {
548-
fscanf(fp, "%d", &setting);
548+
if (fscanf(fp, "%d", &setting) != 1) {
549+
break;
550+
}
549551
// let -1 mean "use existing (real) setting"
550552
if (setting != -1) {
551553
method[i * nleaderranks + k] = setting;
552554
}
553555
}
554-
fscanf(fp, "\n");
556+
if (fscanf(fp, "\n") != 0) {
557+
break;
558+
}
555559
}
556560
fclose(fp);
557561
}

ompi/mca/sharedfp/sm/sharedfp_sm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "ompi_config.h"
3030
#include "mpi.h"
31+
#include "opal/util/printf.h"
3132
#include "ompi/mca/sharedfp/sharedfp.h"
3233
#include "ompi/mca/sharedfp/base/base.h"
3334
#include "ompi/mca/sharedfp/sm/sharedfp_sm.h"
@@ -105,7 +106,7 @@ struct mca_sharedfp_base_module_1_0_0_t * mca_sharedfp_sm_component_file_query(o
105106
int comm_cid = -1;
106107
int pid = ompi_comm_rank (comm);
107108

108-
asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
109+
opal_asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
109110
filename_basename, comm_cid, pid);
110111
free(filename_basename);
111112

ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include "sharedfp_sm.h"
3636

3737
#include "mpi.h"
38+
#include "opal/util/printf.h"
39+
#include "opal/util/output.h"
3840
#include "ompi/constants.h"
3941
#include "ompi/group/group.h"
4042
#include "ompi/proc/proc.h"
@@ -119,8 +121,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
119121
return err;
120122
}
121123

122-
asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
123-
filename_basename, comm_cid, int_pid);
124+
opal_asprintf(&sm_filename, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir,
125+
filename_basename, comm_cid, int_pid);
124126
/* open shared memory file, initialize to 0, map into memory */
125127
sm_fd = open(sm_filename, O_RDWR | O_CREAT,
126128
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
@@ -139,7 +141,10 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
139141
/* TODO: is it necessary to write to the file first? */
140142
if( 0 == fh->f_rank ){
141143
memset ( &sm_offset, 0, sizeof (struct mca_sharedfp_sm_offset ));
142-
write ( sm_fd, &sm_offset, sizeof(struct mca_sharedfp_sm_offset));
144+
err = opal_best_effort_write ( sm_fd, &sm_offset, sizeof(struct mca_sharedfp_sm_offset));
145+
if (OPAL_SUCCESS != err) {
146+
return err;
147+
}
143148
}
144149
err = comm->c_coll->coll_barrier (comm, comm->c_coll->coll_barrier_module );
145150
if ( OMPI_SUCCESS != err ) {

ompi/runtime/ompi_mpi_init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
402402
ompi_proc_t** procs;
403403
size_t nprocs;
404404
char *error = NULL;
405+
#if OPAL_USING_INTERNAL_PMIX
405406
char *evar;
407+
#endif
406408
volatile bool active;
407409
bool background_fence = false;
408410
pmix_info_t info[2];

ompi/tools/mpirun/main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@
2323
#include "opal/util/os_dirpath.h"
2424
#include "opal/util/os_path.h"
2525
#include "opal/util/path.h"
26+
#include "opal/util/printf.h"
2627

2728
int main(int argc, char *argv[])
2829
{
29-
char *evar, *pvar;
30+
char *evar;
31+
#if OPAL_USING_INTERNAL_PMIX || OMPI_USING_INTERNAL_PRRTE
32+
char *pvar;
33+
#endif
3034
char **pargs = NULL;
3135
char *pfx = NULL;
3236
int m, param_len;
@@ -35,12 +39,12 @@ int main(int argc, char *argv[])
3539
if (NULL != (evar = getenv("OPAL_PREFIX"))) {
3640

3741
#if OMPI_USING_INTERNAL_PRRTE
38-
(void)asprintf(&pvar, "PRTE_PREFIX=%s", evar);
42+
opal_asprintf(&pvar, "PRTE_PREFIX=%s", evar);
3943
putenv(pvar);
4044
#endif
4145

4246
#if OPAL_USING_INTERNAL_PMIX
43-
(void)asprintf(&pvar, "PMIX_PREFIX=%s", evar);
47+
opal_asprintf(&pvar, "PMIX_PREFIX=%s", evar);
4448
putenv(pvar);
4549
#endif
4650
}
@@ -51,7 +55,7 @@ int main(int argc, char *argv[])
5155
opal_argv_append_nosize(&pargs, argv[m]);
5256
/* Did the user specify a prefix, or want prefix by default? */
5357
if (0 == strcmp(argv[m], "--prefix")) {
54-
asprintf(&pfx, "%s%s", argv[m+1], "/bin");
58+
opal_asprintf(&pfx, "%s%s", argv[m+1], "/bin");
5559
}
5660
}
5761

opal/datatype/opal_datatype_unpack.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ int32_t opal_unpack_general_function(opal_convertor_t *pConvertor, struct iovec
547547
dt_stack_t *pStack; /* pointer to the position on the stack */
548548
uint32_t pos_desc; /* actual position in the description of the derived datatype */
549549
size_t count_desc; /* the number of items already done in the actual pos_desc */
550-
uint16_t type = OPAL_DATATYPE_MAX_PREDEFINED; /* type at current position */
551550
size_t total_unpacked = 0; /* total size unpacked this time */
552551
dt_elem_desc_t *description;
553552
dt_elem_desc_t *pElem;
@@ -588,15 +587,14 @@ int32_t opal_unpack_general_function(opal_convertor_t *pConvertor, struct iovec
588587
while (1) {
589588
while (pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA) {
590589
/* now here we have a basic datatype */
591-
type = description[pos_desc].elem.common.type;
592590
OPAL_DATATYPE_SAFEGUARD_POINTER(conv_ptr + pElem->elem.disp, pData->size,
593591
pConvertor->pBaseBuf, pData, pConvertor->count);
594592
DO_DEBUG(opal_output(0,
595593
"unpack (%p, %ld) -> (%p:%ld, %" PRIsize_t ", %ld) type %s\n",
596594
(void *) iov_ptr, iov_len_local, (void *) pConvertor->pBaseBuf,
597595
conv_ptr + pElem->elem.disp - pConvertor->pBaseBuf, count_desc,
598596
description[pos_desc].elem.extent,
599-
opal_datatype_basicDatatypes[type]->name););
597+
opal_datatype_basicDatatypes[description[pos_desc].elem.common.type]->name););
600598
unpack_predefined_heterogeneous(pConvertor, pElem, &count_desc, &conv_ptr, &iov_ptr,
601599
&iov_len_local);
602600
if (0 == count_desc) { /* completed */

opal/mca/backtrace/execinfo/backtrace_execinfo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#endif
3131

3232
#include "opal/constants.h"
33+
#include "opal/util/output.h"
3334
#include "opal/mca/backtrace/backtrace.h"
3435

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

5354
for (i = strip; i < trace_size; i++) {
5455
if (NULL != prefix) {
55-
write(fd, prefix, strlen(prefix));
56+
opal_best_effort_write(fd, prefix, strlen(prefix));
5657
}
5758
len = snprintf(buf, sizeof(buf), "[%2d] ", i - strip);
58-
write(fd, buf, len);
59+
opal_best_effort_write(fd, buf, len);
5960
backtrace_symbols_fd(&trace[i], 1, fd);
6061
}
6162

0 commit comments

Comments
 (0)