Skip to content

Commit 8462e7c

Browse files
authored
Merge pull request #9460 from jsquyres/pr/warnings-stomps
Fix a bunch of compiler warnings
2 parents 1614cb4 + 141d6fc commit 8462e7c

File tree

7 files changed

+55
-47
lines changed

7 files changed

+55
-47
lines changed

config/opal_setup_cc.m4

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ AC_DEFUN([OPAL_SETUP_CC],[
303303
_OPAL_CHECK_SPECIFIC_CFLAGS(-fno-strict-aliasing, fno_strict_aliasing, int main() { long double x; })
304304
_OPAL_CHECK_SPECIFIC_CFLAGS(-pedantic, pedantic)
305305
_OPAL_CHECK_SPECIFIC_CFLAGS(-Wall, Wall)
306+
307+
# There are some warnings that we specifically do not care
308+
# about / do not agree that gcc emits warnings about them. So
309+
# we turn them off.
310+
_OPAL_CHECK_SPECIFIC_CFLAGS(-Wformat-truncation=0, format_truncation)
306311
fi
307312

308313
# Note: Some versions of clang (at least >= 3.5 -- perhaps

ompi/mca/pml/ob1/pml_ob1_isend.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1414
* reserved.
15-
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
15+
* Copyright (c) 2014-2021 Cisco Systems, Inc. All rights reserved
1616
* Copyright (c) 2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
@@ -225,7 +225,11 @@ int mca_pml_ob1_isend(const void *buf,
225225
* in error for collection in future wait */
226226
sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR = ompi_comm_is_revoked(comm)? MPI_ERR_REVOKED: MPI_ERR_PROC_FAILED;
227227
MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, false);
228-
OPAL_OUTPUT_VERBOSE((2, "Allocating request in error %s (peer %d, seq %d) with error code %d", sendreq, dst, sendreq->req_send.req_base.req_sequence, sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR));
228+
OPAL_OUTPUT_VERBOSE((2, ompi_ftmpi_output_handle, "Allocating request in error %p (peer %d, seq %" PRIu64 ") with error code %d",
229+
(void*) sendreq,
230+
dst,
231+
sendreq->req_send.req_base.req_sequence,
232+
sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR));
229233
*request = (ompi_request_t *) sendreq;
230234
return OMPI_SUCCESS;
231235
#endif /* OPAL_ENABLE_FT_MPI */

ompi/mca/pml/ob1/pml_ob1_recvfrag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Copyright (c) 2018 Sandia National Laboratories
2121
* All rights reserved.
2222
* Copyright (c) 2020 Google, LLC. All rights reserved.
23+
* Copyright (c) 2021 Cisco Systems, Inc. All rights reserved
2324
* $COPYRIGHT$
2425
*
2526
* Additional copyrights may follow
@@ -681,7 +682,7 @@ void mca_pml_ob1_recv_frag_callback_ack (mca_btl_base_module_t *btl,
681682
#if OPAL_ENABLE_FT_MPI
682683
/* if the req_recv is NULL, the comm has been revoked at the receiver */
683684
if( OPAL_UNLIKELY(NULL == sendreq->req_recv.pval) ) {
684-
OPAL_OUTPUT_VERBOSE((2, ompi_ftmpi_output_handle, "Recvfrag: Received a NACK to the RDV/RGET match to %d for seq %d on comm %d\n", sendreq->req_send.req_base.req_peer, sendreq->req_send.req_base.req_sequence, sendreq->req_send.req_base.req_comm->c_contextid));
685+
OPAL_OUTPUT_VERBOSE((2, ompi_ftmpi_output_handle, "Recvfrag: Received a NACK to the RDV/RGET match to %d for seq %" PRIu64 " on comm %d\n", sendreq->req_send.req_base.req_peer, sendreq->req_send.req_base.req_sequence, sendreq->req_send.req_base.req_comm->c_contextid));
685686
if (NULL != sendreq->rdma_frag) {
686687
MCA_PML_OB1_RDMA_FRAG_RETURN(sendreq->rdma_frag);
687688
sendreq->rdma_frag = NULL;

ompi/mpi/c/type_create_f90_complex.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved.
14-
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved
14+
* Copyright (c) 2008-2021 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2015 Research Organization for Information Science
@@ -112,12 +112,8 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
112112
*/
113113
datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
114114
/* Mark the datatype as a special F90 convenience type */
115-
// Specifically using opal_snprintf() here (instead of
116-
// snprintf()) so that over-eager compilers do not warn us
117-
// that we may be truncating the output. We *know* that the
118-
// output may be truncated, and that's ok.
119-
opal_snprintf(datatype->name, sizeof(datatype->name),
120-
"COMBINER %s", (*newtype)->name);
115+
snprintf(datatype->name, sizeof(datatype->name),
116+
"COMBINER %s", (*newtype)->name);
121117

122118
a_i[0] = &p;
123119
a_i[1] = &r;

ompi/mpi/c/type_create_f90_integer.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved.
14-
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved
14+
* Copyright (c) 2008-2021 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2015 Research Organization for Information Science
@@ -104,12 +104,8 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype)
104104
*/
105105
datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
106106
/* Mark the datatype as a special F90 convenience type */
107-
// Specifically using opal_snprintf() here (instead of
108-
// snprintf()) so that over-eager compilers do not warn us
109-
// that we may be truncating the output. We *know* that the
110-
// output may be truncated, and that's ok.
111-
opal_snprintf(datatype->name, sizeof(datatype->name),
112-
"COMBINER %s", (*newtype)->name);
107+
snprintf(datatype->name, sizeof(datatype->name),
108+
"COMBINER %s", (*newtype)->name);
113109

114110
a_i[0] = &r;
115111
ompi_datatype_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_INTEGER );

ompi/mpi/c/type_create_f90_real.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved.
14-
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved
14+
* Copyright (c) 2008-2021 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* Copyright (c) 2015 Research Organization for Information Science
@@ -112,12 +112,8 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
112112
*/
113113
datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
114114
/* Mark the datatype as a special F90 convenience type */
115-
// Specifically using opal_snprintf() here (instead of
116-
// snprintf()) so that over-eager compilers do not warn us
117-
// that we may be truncating the output. We *know* that the
118-
// output may be truncated, and it's ok.
119-
opal_snprintf(datatype->name, sizeof(datatype->name),
120-
"COMBINER %s", (*newtype)->name);
115+
snprintf(datatype->name, sizeof(datatype->name),
116+
"COMBINER %s", (*newtype)->name);
121117

122118
ompi_datatype_set_args( datatype, 2, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_REAL );
123119

opal/mca/btl/base/btl_base_am_rdma.c

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -765,29 +765,39 @@ static int mca_btl_base_am_rdma_progress(void)
765765
return 0;
766766
}
767767

768-
OPAL_THREAD_SCOPED_LOCK(&default_module.mutex, ({
769-
mca_btl_base_rdma_operation_t *operation, *next;
770-
OPAL_LIST_FOREACH_SAFE (operation, next, &default_module.queued_responses,
771-
mca_btl_base_rdma_operation_t) {
772-
mca_btl_base_rdma_retry_operation(operation);
773-
}
774-
}));
775-
776-
OPAL_THREAD_SCOPED_LOCK(&default_module.mutex, ({
777-
mca_btl_base_am_rdma_queued_descriptor_t *descriptor, *next;
778-
OPAL_LIST_FOREACH_SAFE (descriptor, next, &default_module.queued_initiator_descriptors,
779-
mca_btl_base_am_rdma_queued_descriptor_t) {
780-
mca_btl_base_rdma_context_t *context = (mca_btl_base_rdma_context_t *)
781-
descriptor->descriptor->des_context;
782-
int ret = descriptor->btl->btl_send(descriptor->btl, descriptor->endpoint,
783-
descriptor->descriptor,
784-
mca_btl_base_rdma_tag(context->type));
785-
if (OPAL_SUCCESS == ret) {
786-
opal_list_remove_item(&default_module.queued_initiator_descriptors,
787-
&descriptor->super);
788-
}
789-
}
790-
}));
768+
// It's a little cleaner, stylistically, to make the multi-line
769+
// ACTION argument to OPAL_THREAD_SCOPED_LOCK be a macro itself
770+
// (vs. using continuation characters in the use of
771+
// OPAL_THREAD_SCOPED_LOCK).
772+
#define ACTION1 \
773+
mca_btl_base_rdma_operation_t *operation, *next; \
774+
OPAL_LIST_FOREACH_SAFE (operation, next, \
775+
&default_module.queued_responses, \
776+
mca_btl_base_rdma_operation_t) { \
777+
mca_btl_base_rdma_retry_operation(operation); \
778+
}
779+
780+
OPAL_THREAD_SCOPED_LOCK(&default_module.mutex, ACTION1);
781+
782+
#define ACTION2 \
783+
mca_btl_base_am_rdma_queued_descriptor_t *descriptor, *next; \
784+
OPAL_LIST_FOREACH_SAFE (descriptor, next, \
785+
&default_module.queued_initiator_descriptors, \
786+
mca_btl_base_am_rdma_queued_descriptor_t) { \
787+
mca_btl_base_rdma_context_t *context = \
788+
(mca_btl_base_rdma_context_t *) \
789+
descriptor->descriptor->des_context; \
790+
int ret = descriptor->btl->btl_send(descriptor->btl, \
791+
descriptor->endpoint, \
792+
descriptor->descriptor, \
793+
mca_btl_base_rdma_tag(context->type)); \
794+
if (OPAL_SUCCESS == ret) { \
795+
opal_list_remove_item(&default_module.queued_initiator_descriptors, \
796+
&descriptor->super); \
797+
} \
798+
}
799+
800+
OPAL_THREAD_SCOPED_LOCK(&default_module.mutex, ACTION2);
791801

792802
return 0;
793803
}

0 commit comments

Comments
 (0)