1
1

Mark all instances where atomic operations are used but their return value is unnecessary

Этот коммит содержится в:
George Bosilca 2014-10-15 21:47:32 -04:00
родитель dc66e197cc
Коммит 7541c03b4c
14 изменённых файлов: 65 добавлений и 47 удалений

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -356,7 +356,7 @@ extern uint32_t mca_coll_sm_one;
* Macro to release an in-use flag from this process
*/
#define FLAG_RELEASE(flag) \
opal_atomic_add(&(flag)->mcsiuf_num_procs_using, -1)
(void)opal_atomic_add(&(flag)->mcsiuf_num_procs_using, -1)
/**
* Macro to copy a single segment in from a user buffer to a shared

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -101,7 +101,7 @@ int mca_coll_sm_barrier_intra(struct ompi_communicator_t *comm,
if (0 != rank) {
/* Get parent *in* buffer */
parent = &data->mcb_barrier_control_parent[buffer_set];
opal_atomic_add(parent, 1);
(void)opal_atomic_add(parent, 1);
SPIN_CONDITION(0 != *me_out, exit_label2);
*me_out = 0;

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -463,7 +463,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
OBJ_RETAIN(sm_module->previous_reduce_module);
/* Indicate that we have successfully attached and setup */
opal_atomic_add(&(data->sm_bootstrap_meta->module_seg->seg_inited), 1);
(void)opal_atomic_add(&(data->sm_bootstrap_meta->module_seg->seg_inited), 1);
/* Wait for everyone in this communicator to attach and setup */
opal_output_verbose(10, ompi_coll_base_framework.framework_output,

Просмотреть файл

@ -1,5 +1,8 @@
/*
* Copyright (c) 2011-2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -217,7 +220,7 @@ ompi_osc_portals4_rput(void *origin_addr,
"MPI_Rput: transfer of non-contiguous memory is not currently supported.\n");
return OMPI_ERR_NOT_SUPPORTED;
} else {
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
request->ops_expected = 1;
ret = ompi_datatype_type_size(origin_dt, &length);
if (OMPI_SUCCESS != ret) {
@ -287,7 +290,7 @@ ompi_osc_portals4_rget(void *origin_addr,
"MPI_Rget: transfer of non-contiguous memory is not currently supported.\n");
return OMPI_ERR_NOT_SUPPORTED;
} else {
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
request->ops_expected = 1;
ret = ompi_datatype_type_size(origin_dt, &length);
if (OMPI_SUCCESS != ret) {
@ -374,7 +377,7 @@ ompi_osc_portals4_raccumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
request->ops_expected++;
if (MPI_REPLACE == op) {
@ -491,7 +494,7 @@ ompi_osc_portals4_rget_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->fetch_atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
request->ops_expected++;
ret = PtlSwap(result_md_h,
@ -528,7 +531,7 @@ ompi_osc_portals4_rget_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->fetch_atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
request->ops_expected++;
ret = PtlGet(md_h,
@ -567,7 +570,7 @@ ompi_osc_portals4_rget_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->fetch_atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
request->ops_expected++;
ret = PtlFetchAtomic(result_md_h,
@ -630,7 +633,7 @@ ompi_osc_portals4_put(void *origin_addr,
"MPI_Put: transfer of non-contiguous memory is not currently supported.\n");
return OMPI_ERR_NOT_SUPPORTED;
} else {
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ret = ompi_datatype_type_size(origin_dt, &length);
if (OMPI_SUCCESS != ret) {
return ret;
@ -690,7 +693,7 @@ ompi_osc_portals4_get(void *origin_addr,
"MPI_Get: transfer of non-contiguous memory is not currently supported.\n");
return OMPI_ERR_NOT_SUPPORTED;
} else {
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ret = ompi_datatype_type_size(origin_dt, &length);
if (OMPI_SUCCESS != ret) {
return ret;
@ -766,7 +769,7 @@ ompi_osc_portals4_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
if (MPI_REPLACE == op) {
ret = PtlPut(md_h,
@ -873,7 +876,7 @@ ompi_osc_portals4_get_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->fetch_atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ret = PtlSwap(result_md_h,
result_md_offset + sent,
@ -908,7 +911,7 @@ ompi_osc_portals4_get_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->fetch_atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ret = PtlGet(md_h,
md_offset + sent,
@ -946,7 +949,7 @@ ompi_osc_portals4_get_accumulate(void *origin_addr,
do {
size_t msg_length = MIN(module->fetch_atomic_max, length - sent);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ret = PtlFetchAtomic(result_md_h,
result_md_offset + sent,
@ -1016,7 +1019,7 @@ ompi_osc_portals4_compare_and_swap(void *origin_addr,
ompi_osc_portals4_get_md(origin_addr, module->md_h, &origin_md_h, &origin_md_base);
origin_md_offset = ((char*) origin_addr - (char*) origin_md_base);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ret = PtlSwap(result_md_h,
result_md_offset,
@ -1076,7 +1079,7 @@ ompi_osc_portals4_fetch_and_op(void *origin_addr,
assert(length < module->fetch_atomic_max);
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
if (MPI_REPLACE == op) {
ptl_handle_md_t result_md_h, origin_md_h;

Просмотреть файл

@ -1,5 +1,8 @@
/*
* Copyright (c) 2011-2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -44,7 +47,7 @@ lk_cas64(ompi_osc_portals4_module_t *module,
ptl_handle_md_t result_md_h, write_md_h;
void *result_base, *write_base;
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ompi_osc_portals4_get_md(result_val, module->md_h, &result_md_h, &result_base);
ompi_osc_portals4_get_md(&write_val, module->md_h, &write_md_h, &write_base);
@ -82,7 +85,7 @@ lk_write64(ompi_osc_portals4_module_t *module,
ptl_handle_md_t md_h;
void *base;
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ompi_osc_portals4_get_md(&write_val, module->md_h, &md_h, &base);
@ -116,7 +119,7 @@ lk_add64(ompi_osc_portals4_module_t *module,
ptl_handle_md_t result_md_h, write_md_h;
void *result_base, *write_base;
opal_atomic_add_64(&module->opcount, 1);
(void)opal_atomic_add_64(&module->opcount, 1);
ompi_osc_portals4_get_md(result_val, module->md_h, &result_md_h, &result_base);
ompi_osc_portals4_get_md(&write_val, module->md_h, &write_md_h, &write_base);

Просмотреть файл

@ -3,6 +3,9 @@
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -100,7 +103,7 @@ ompi_osc_sm_complete(struct ompi_win_t *win)
for (int j = 0 ; j < csize ; ++j) {
if (ompi_group_peer_lookup(module->start_group, i) ==
ompi_comm_peer_lookup(module->comm, j)) {
opal_atomic_add_32(&module->node_states[j].complete_count, 1);
(void)opal_atomic_add_32(&module->node_states[j].complete_count, 1);
}
}
}
@ -136,7 +139,7 @@ ompi_osc_sm_post(struct ompi_group_t *group,
for (int j = 0 ; j < csize ; ++j) {
if (ompi_group_peer_lookup(module->post_group, i) ==
ompi_comm_peer_lookup(module->comm, j)) {
opal_atomic_add_32(&module->node_states[j].post_count, 1);
(void)opal_atomic_add_32(&module->node_states[j].post_count, 1);
}
}
}

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
@ -144,13 +144,13 @@ bool opal_list_insert(opal_list_t *list, opal_list_item_t *item, long long idx)
/* Spot check: ensure this item is only on the list that we
just insertted it into */
opal_atomic_add( &(item->opal_list_item_refcount), 1 );
(void)opal_atomic_add( &(item->opal_list_item_refcount), 1 );
assert(1 == item->opal_list_item_refcount);
item->opal_list_item_belong_to = list;
#endif
}
list->opal_list_length++;
list->opal_list_length++;
return true;
}

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -994,8 +994,8 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
endpoint->eager_rdma_local.rd_win?endpoint->eager_rdma_local.rd_win:1;
/* set local rdma pointer to real value */
opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval, (void*)1,
buf);
(void)opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval,
(void*)1, buf);
if(mca_btl_openib_endpoint_send_eager_rdma(endpoint) == OPAL_SUCCESS) {
mca_btl_openib_device_t *device = endpoint->endpoint_btl->device;
@ -1018,8 +1018,8 @@ free_headers_buf:
free(headers_buf);
unlock_rdma_local:
/* set local rdma pointer back to zero. Will retry later */
opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval,
endpoint->eager_rdma_local.base.pval, NULL);
(void)opal_atomic_cmpset_ptr(&endpoint->eager_rdma_local.base.pval,
endpoint->eager_rdma_local.base.pval, NULL);
endpoint->eager_rdma_local.frags = NULL;
}

Просмотреть файл

@ -7,6 +7,9 @@
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
*
* $COPYRIGHT$
*
@ -1193,7 +1196,7 @@ static void *call_disconnect_callback(void *v)
OBJ_RELEASE(context);
/* Tell the main thread that we're done */
opal_atomic_add(&disconnect_callbacks, 1);
(void)opal_atomic_add(&disconnect_callbacks, 1);
OPAL_OUTPUT((-1, "SERVICE Service thread disconnect on ID %p done; count=%d",
(void*) tmp, disconnect_callbacks));
return NULL;

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
@ -569,7 +569,7 @@ int mca_btl_sm_add_procs(
/* Sync with other local procs. Force the FIFO initialization to always
* happens before the readers access it.
*/
opal_atomic_add_32(&mca_btl_sm_component.sm_seg->module_seg->seg_inited, 1);
(void)opal_atomic_add_32(&mca_btl_sm_component.sm_seg->module_seg->seg_inited, 1);
while( n_local_procs >
mca_btl_sm_component.sm_seg->module_seg->seg_inited) {
opal_progress();

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
@ -589,7 +589,7 @@ int mca_btl_smcuda_add_procs(
/* Sync with other local procs. Force the FIFO initialization to always
* happens before the readers access it.
*/
opal_atomic_add_32(&mca_btl_smcuda_component.sm_seg->module_seg->seg_inited, 1);
(void)opal_atomic_add_32(&mca_btl_smcuda_component.sm_seg->module_seg->seg_inited, 1);
while( n_local_procs >
mca_btl_smcuda_component.sm_seg->module_seg->seg_inited) {
opal_progress();

Просмотреть файл

@ -2,6 +2,9 @@
/*
* Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -45,7 +48,7 @@ mca_mpool_base_registration_t *vader_get_registation (struct mca_btl_base_endpoi
rc = rcache->rcache_find_all (rcache, (void *) base, bound - base, regs, 10);
for (i = 0 ; i < rc ; ++i) {
if (bound <= (uintptr_t)regs[i]->bound && base >= (uintptr_t)regs[i]->base) {
opal_atomic_add (&regs[i]->ref_count, 1);
(void)opal_atomic_add (&regs[i]->ref_count, 1);
reg = regs[i];
goto reg_found;
}
@ -65,7 +68,7 @@ mca_mpool_base_registration_t *vader_get_registation (struct mca_btl_base_endpoi
/* start the new segment from the lower of the two bases */
base = (uintptr_t) regs[i]->base < base ? (uintptr_t) regs[i]->base : base;
opal_atomic_add (&regs[i]->ref_count, -1);
(void)opal_atomic_add (&regs[i]->ref_count, -1);
if (OPAL_LIKELY(0 == regs[i]->ref_count)) {
/* this pointer is not in use */

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* Copyright (c) 2004-2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@ -42,11 +42,11 @@ static void* atomic_math_test(void* arg)
int i;
for (i = 0 ; i < count ; ++i) {
opal_atomic_add_32(&val32, 5);
(void)opal_atomic_add_32(&val32, 5);
#if OPAL_HAVE_ATOMIC_MATH_64
opal_atomic_add_64(&val64, 6);
(void)opal_atomic_add_64(&val64, 6);
#endif
opal_atomic_add(&valint, 4);
(void)opal_atomic_add(&valint, 4);
}
return NULL;

Просмотреть файл

@ -1,5 +1,8 @@
/*
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*/
@ -33,13 +36,13 @@ static volatile int count = 0;
static void* thr1_run(opal_object_t* obj)
{
opal_atomic_add(&count, 1);
(void)opal_atomic_add(&count, 1);
return NULL;
}
static void* thr2_run(opal_object_t* obj)
{
opal_atomic_add(&count, 2);
(void)opal_atomic_add(&count, 2);
return NULL;
}