Commit ad257998 authored by Junchao Zhang's avatar Junchao Zhang
Browse files

Fix mixed code warnings reported by --enable-strict=c89



The warning message is:
    warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

Fixes #2167
Signed-off-by: default avatarAntonio J. Pena <apenya@mcs.anl.gov>
parent 6b8c426d
......@@ -58,8 +58,9 @@ int MPIR_Comm_spawn_multiple_c(int count, char* array_of_commands_f,
for (i = 0; i < count; i++) {
/* Extract args of command i, and put them in buf */
char *arg;
offset = 0; /* offset in bytes in buf to put next arg */
char* arg = array_of_argv_f + argv_elem_len * i; /* Point to 1st arg of command i */
arg = array_of_argv_f + argv_elem_len * i; /* Point to 1st arg of command i */
do {
if (offset + argv_elem_len > len) { /* Make sure buf is big enough */
len = offset + argv_elem_len;
......
......@@ -42,10 +42,11 @@ extern int MPIR_T_cat_add_desc(const char *cat_name, const char *cat_desc);
static inline cvar_table_entry_t * LOOKUP_CVAR_BY_NAME(const char* cvar_name)
{
int cvar_idx;
name2index_hash_t *hash_entry;
HASH_FIND_STR(cvar_hash, cvar_name, hash_entry);
MPIU_Assert(hash_entry != NULL);
int cvar_idx = hash_entry->idx;
cvar_idx = hash_entry->idx;
return (cvar_table_entry_t *)utarray_eltptr(cvar_table, cvar_idx);
}
......
......@@ -388,6 +388,7 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_STATE_REGISTER_STATIC_impl(dtype_, name_, \
initval_, etype_, verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_INT); \
/* Double check if dtype_ and name_ match */ \
......@@ -396,7 +397,7 @@ extern void MPIR_T_PVAR_REGISTER_impl(
/* State pvars should be describled further by an enum */ \
MPIU_Assert((etype_) != MPI_T_ENUM_NULL); \
PVAR_STATE_##name_ = (initval_); \
void *addr_ = &PVAR_STATE_##name_; \
addr_ = &PVAR_STATE_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_STATE, dtype_, #name_, \
addr_, 1, etype_, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -469,6 +470,7 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_LEVEL_REGISTER_STATIC_impl(dtype_, name_, \
initval_, verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
......@@ -476,7 +478,7 @@ extern void MPIR_T_PVAR_REGISTER_impl(
MPIU_Assert(sizeof(PVAR_LEVEL_##name_) == MPID_Datatype_get_basic_size(dtype_)); \
MPIU_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
PVAR_LEVEL_##name_ = (initval_); \
void *addr_ = &PVAR_LEVEL_##name_; \
addr_ = &PVAR_LEVEL_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_LEVEL, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -542,6 +544,7 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_SIZE_REGISTER_STATIC_impl(dtype_, name_, \
initval_, verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
......@@ -549,7 +552,7 @@ extern void MPIR_T_PVAR_REGISTER_impl(
MPIU_Assert(sizeof(PVAR_SIZE_##name_) == MPID_Datatype_get_basic_size(dtype_)); \
MPIU_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
PVAR_SIZE_##name_ = (initval_); \
void *addr_ = &PVAR_SIZE_##name_; \
addr_ = &PVAR_SIZE_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_SIZE, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -600,12 +603,13 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_PERCENTAGE_REGISTER_STATIC_impl(dtype_, name_, \
initval_, verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_DOUBLE); \
/* Double check if dtype_ and name_ match */ \
MPIU_Assert(sizeof(PVAR_PERCENTAGE_##name_) == MPID_Datatype_get_basic_size(dtype_)); \
MPIU_Assert((flags_) & MPIR_T_PVAR_FLAG_CONTINUOUS); \
void *addr_ = &PVAR_PERCENTAGE_##name_; \
addr_ = &PVAR_PERCENTAGE_##name_; \
PVAR_PERCENTAGE_##name_ = (initval_); \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_PERCENTAGE, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
......@@ -672,13 +676,14 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_COUNTER_REGISTER_STATIC_impl(dtype_, name_, \
verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG); \
/* Double check if dtype_ and name_ match*/ \
MPIU_Assert(sizeof(PVAR_COUNTER_##name_) == MPID_Datatype_get_basic_size(dtype_)); \
PVAR_COUNTER_##name_ = 0; \
void *addr_ = &PVAR_COUNTER_##name_; \
addr_ = &PVAR_COUNTER_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_COUNTER, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -721,7 +726,8 @@ extern void MPIR_T_PVAR_REGISTER_impl(
/* Interfaces through pointer or name */
#define MPIR_T_PVAR_COUNTER_ARRAY_INIT_VAR_impl(ptr_, count_) \
do { \
int idx_ = 0; \
int idx_; \
idx_ = 0; \
for (; idx_ < (count_); idx_++) \
*((ptr_) + idx_) = 0; \
} while (0)
......@@ -732,7 +738,8 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_COUNTER_ARRAY_INIT_impl(name_) \
do { \
int count_ = sizeof(PVAR_COUNTER_##name_)/sizeof(PVAR_COUNTER_##name_[0]); \
int count_; \
count_ = sizeof(PVAR_COUNTER_##name_)/sizeof(PVAR_COUNTER_##name_[0]); \
MPIR_T_PVAR_COUNTER_ARRAY_INIT_VAR_impl(PVAR_COUNTER_##name_, count_); \
} while (0)
#define MPIR_T_PVAR_COUNTER_ARRAY_GET_impl(name_, idx_) \
......@@ -744,14 +751,16 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_COUNTER_ARRAY_REGISTER_STATIC_impl(dtype_, name_, \
verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
int count_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG); \
/* Double check if dtype_ and name_ match */ \
MPIU_Assert(sizeof(PVAR_COUNTER_##name_[0]) == MPID_Datatype_get_basic_size(dtype_)); \
void *addr_ = PVAR_COUNTER_##name_; \
addr_ = PVAR_COUNTER_##name_; \
MPIR_T_PVAR_COUNTER_ARRAY_INIT_impl(name_); \
int count_ = sizeof(PVAR_COUNTER_##name_)/sizeof(mpit_pvar_##name_[0]); \
count_ = sizeof(PVAR_COUNTER_##name_)/sizeof(mpit_pvar_##name_[0]); \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_COUNTER, dtype_, #name_, \
addr_, count_, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -809,13 +818,14 @@ extern void MPIR_T_PVAR_REGISTER_impl(
#define MPIR_T_PVAR_AGGREGATE_REGISTER_STATIC_impl(dtype_, name_, \
verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
/* Double check if dtype_ and name_ match*/ \
MPIU_Assert(sizeof(PVAR_AGGREGATE_##name_) == MPID_Datatype_get_basic_size(dtype_)); \
PVAR_AGGREGATE_##name_ = 0; \
void *addr_ = &PVAR_AGGREGATE_##name_; \
addr_ = &PVAR_AGGREGATE_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_AGGREGATE, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -894,11 +904,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_TIMER_REGISTER_STATIC_impl(dtype_, name_, \
verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
void *count_addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_DOUBLE); \
MPIR_T_PVAR_TIMER_INIT_impl(name_); \
void *addr_ = &PVAR_TIMER_##name_; \
void *count_addr_ = &(PVAR_TIMER_##name_.count); \
addr_ = &PVAR_TIMER_##name_; \
count_addr_ = &(PVAR_TIMER_##name_.count); \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_TIMER, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, \
(MPIR_T_pvar_get_value_cb *)&get_timer_time_in_double, NULL, cat_, desc_); \
......@@ -982,12 +994,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_UINT_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.u = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) > (ptr_)->watermark.u) \
(ptr_)->watermark.u = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.u) { \
head->watermark.u = (val_); \
......@@ -998,12 +1011,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_ULONG_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.ul = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) > (ptr_)->watermark.ul) \
(ptr_)->watermark.ul = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.ul) { \
head->watermark.ul = (val_); \
......@@ -1014,12 +1028,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_ULONG2_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.ull = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) > (ptr_)->watermark.ull) \
(ptr_)->watermark.ull = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.ull) { \
head->watermark.ull = (val_); \
......@@ -1030,12 +1045,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_DOUBLE_HIGHWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.f = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) > (ptr_)->watermark.f) \
(ptr_)->watermark.f = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) > head->watermark.f) { \
head->watermark.f = (val_); \
......@@ -1066,6 +1082,7 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_HIGHWATERMARK_REGISTER_STATIC_impl(dtype_, name_, \
initval_, verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
......@@ -1081,7 +1098,7 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
default: \
break; \
}; \
void *addr_ = &PVAR_HIGHWATERMARK_##name_; \
addr_ = &PVAR_HIGHWATERMARK_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_HIGHWATERMARK, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......@@ -1169,13 +1186,14 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_UINT_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.u = (val_); \
/* Update values in all handles */ \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) < (ptr_)->watermark.u) \
(ptr_)->watermark.u = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.u) { \
head->watermark.u = (val_); \
......@@ -1186,12 +1204,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_ULONG_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.ul = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) < (ptr_)->watermark.ul) \
(ptr_)->watermark.ul = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.ul) { \
head->watermark.ul = (val_); \
......@@ -1202,12 +1221,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_ULONG2_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.ull = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) < (ptr_)->watermark.ull) \
(ptr_)->watermark.ull = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.ull) { \
head->watermark.ull = (val_); \
......@@ -1218,12 +1238,13 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_DOUBLE_LOWWATERMARK_UPDATE_VAR_impl(ptr_, val_) \
do { \
MPIR_T_pvar_handle_t *head; \
(ptr_)->current.f = (val_); \
if ((ptr_)->first_used && (ptr_)->first_started) { \
if ((val_) < (ptr_)->watermark.f) \
(ptr_)->watermark.f = (val_); \
} \
MPIR_T_pvar_handle_t *head = (ptr_)->hlist; \
head = (ptr_)->hlist; \
while (head != NULL) { \
if (MPIR_T_pvar_is_started(head) && (val_) < head->watermark.f) { \
head->watermark.f = (val_); \
......@@ -1254,6 +1275,7 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
#define MPIR_T_PVAR_LOWWATERMARK_REGISTER_STATIC_impl(dtype_, name_, \
initval_, verb_, bind_, flags_, cat_, desc_) \
do { \
void *addr_; \
/* Allowable datatypes only */ \
MPIU_Assert((dtype_) == MPI_UNSIGNED || (dtype_) == MPI_UNSIGNED_LONG || \
(dtype_) == MPI_UNSIGNED_LONG_LONG || (dtype_) == MPI_DOUBLE); \
......@@ -1269,7 +1291,7 @@ void get_timer_time_in_double(MPIR_T_pvar_timer_t *timer, void *obj_handle,
default: \
break; \
}; \
void *addr_ = &PVAR_LOWWATERMARK_##name_; \
addr_ = &PVAR_LOWWATERMARK_##name_; \
MPIR_T_PVAR_REGISTER_impl(MPI_T_PVAR_CLASS_LOWWATERMARK, dtype_, #name_, \
addr_, 1, MPI_T_ENUM_NULL, verb_, bind_, flags_, NULL, NULL, cat_, desc_); \
} while (0)
......
......@@ -1084,9 +1084,10 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)
{
int mpi_errno = MPI_SUCCESS;
int i;
MPID_Comm *comm_ptr = NULL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE_SCATTER);
int i = 0;
i = 0;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE_SCATTER);
......
......@@ -614,6 +614,7 @@ void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype,
int myerrcode, file_system, min_code, max_code;
char *tmp;
static char myname[] = "ADIO_RESOLVEFILETYPE";
char * p;
file_system = -1;
if (filename == NULL) {
......@@ -696,7 +697,7 @@ void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype,
* Assumes all processes set the same environment varialble.
* Values: the same prefix you would stick on a file path. e.g. pvfs2: --
* including the colon! */
char * p = getenv("ROMIO_FSTYPE_FORCE");
p = getenv("ROMIO_FSTYPE_FORCE");
if (p != NULL) {
ADIO_FileSysType_prefix(p, &file_system, &myerrcode);
if (myerrcode != MPI_SUCCESS) {
......
......@@ -31,6 +31,8 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
static char myname[] = "ADIO_OPEN";
int max_error_code;
MPI_Info dupinfo;
int syshints_processed, can_skip;
char *p;
*error_code = MPI_SUCCESS;
......@@ -98,7 +100,6 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
*
* a code might do an "initialize from 0", so we can only skip hint
* processing once everyone has particpiated in hint processing */
int syshints_processed, can_skip;
if (ADIOI_syshints == MPI_INFO_NULL)
syshints_processed = 0;
else
......@@ -150,7 +151,7 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
goto fn_exit;
}
/* for debugging, it can be helpful to see the hints selected */
char *p = getenv("ROMIO_PRINT_HINTS");
p = getenv("ROMIO_PRINT_HINTS");
if (rank == 0 && p != NULL ) {
ADIOI_Info_print_keyvals(fd->info);
}
......
......@@ -68,6 +68,8 @@ int ADIOI_cb_bcast_rank_map(ADIO_File fd)
char *value;
int error_code = MPI_SUCCESS;
static char myname[] = "ADIOI_cb_bcast_rank_map";
char *p;
int i;
MPI_Bcast(&(fd->hints->cb_nodes), 1, MPI_INT, 0, fd->comm);
if (fd->hints->cb_nodes > 0) {
......@@ -92,8 +94,7 @@ int ADIOI_cb_bcast_rank_map(ADIO_File fd)
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", fd->hints->cb_nodes);
ADIOI_Info_set(fd->info, "cb_nodes", value);
char *p = value;
int i;
p = value;
/* the (by MPI rank) list of aggregators can be larger than
* MPI_MAX_INFO_VAL, so we will simply truncate when we reach capacity. I
* wasn't clever enough to figure out how to rewind and put '...' at the
......
......@@ -58,6 +58,7 @@ int MPI_T_category_get_info(int cat_index, char *name, int *name_len, char *desc
int *desc_len, int *num_cvars, int *num_pvars, int *num_categories)
{
int mpi_errno = MPI_SUCCESS;
cat_table_entry_t *cat;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CATEGORY_GET_INFO);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -80,7 +81,6 @@ int MPI_T_category_get_info(int cat_index, char *name, int *name_len, char *desc
/* ... body of routine ... */
cat_table_entry_t *cat;
cat = (cat_table_entry_t *)utarray_eltptr(cat_table, cat_index);
MPIR_T_strncpy(name, cat->name, name_len);
MPIR_T_strncpy(desc, cat->desc, desc_len);
......
......@@ -62,6 +62,7 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len,
char *desc, int *desc_len, int *binding, int *scope)
{
int mpi_errno = MPI_SUCCESS;
const cvar_table_entry_t *cvar;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CVAR_GET_INFO);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -84,7 +85,6 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len,
/* ... body of routine ... */
const cvar_table_entry_t *cvar;
cvar = (cvar_table_entry_t *)utarray_eltptr(cvar_table, cvar_index);
MPIR_T_strncpy(name, cvar->name, name_len);
......
......@@ -45,6 +45,7 @@ Input/Output Parameters:
int MPI_T_cvar_handle_free(MPI_T_cvar_handle *handle)
{
int mpi_errno = MPI_SUCCESS;
MPIR_T_cvar_handle_t *hnd;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_CVAR_HANDLE_FREE);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -64,7 +65,7 @@ int MPI_T_cvar_handle_free(MPI_T_cvar_handle *handle)
/* ... body of routine ... */
MPIR_T_cvar_handle_t *hnd = *handle;
hnd = *handle;
MPIU_Free(hnd);
*handle = MPI_T_CVAR_HANDLE_NULL;
......
......@@ -54,6 +54,7 @@ Output Parameters:
int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, int *name_len)
{
int mpi_errno = MPI_SUCCESS;
enum_item_t *item;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_ENUM_GET_ITEM);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -78,7 +79,7 @@ int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name,
/* ... body of routine ... */
enum_item_t *item = (enum_item_t *)utarray_eltptr(enumtype->items, index);
item = (enum_item_t *)utarray_eltptr(enumtype->items, index);
*value = item->value;
MPIR_T_strncpy(name, item->name, name_len);
......
......@@ -65,6 +65,8 @@ int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosit
int *desc_len, int *binding, int *readonly, int *continuous, int *atomic)
{
int mpi_errno = MPI_SUCCESS;
const pvar_table_entry_t *entry;
const pvar_table_entry_t *info;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_PVAR_GET_INFO);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -86,7 +88,6 @@ int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosit
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
const pvar_table_entry_t *entry;
entry = (pvar_table_entry_t *) utarray_eltptr(pvar_table, pvar_index);
if (!entry->active) {
......@@ -94,7 +95,6 @@ int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosit
goto fn_fail;
}
const pvar_table_entry_t *info;
info = (pvar_table_entry_t *) utarray_eltptr(pvar_table, pvar_index);
MPIR_T_strncpy(name, info->name, name_len);
......
......@@ -202,6 +202,7 @@ int MPI_T_pvar_handle_alloc(MPI_T_pvar_session session, int pvar_index,
void *obj_handle, MPI_T_pvar_handle *handle, int *count)
{
int mpi_errno = MPI_SUCCESS;
pvar_table_entry_t *entry;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_PVAR_HANDLE_ALLOC);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -225,7 +226,7 @@ int MPI_T_pvar_handle_alloc(MPI_T_pvar_session session, int pvar_index,
/* ... body of routine ... */
pvar_table_entry_t *entry = (pvar_table_entry_t *) utarray_eltptr(pvar_table, pvar_index);
entry = (pvar_table_entry_t *) utarray_eltptr(pvar_table, pvar_index);
if (!entry->active) {
mpi_errno = MPI_T_ERR_INVALID_INDEX;
goto fn_fail;
......
......@@ -108,6 +108,7 @@ variables are ignored when MPI_T_PVAR_ALL_HANDLES is specified.
int MPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle)
{
int mpi_errno = MPI_SUCCESS;
MPIR_T_pvar_handle_t *hnd;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_T_PVAR_RESET);
MPIR_ERRTEST_MPIT_INITIALIZED(mpi_errno);
......@@ -131,7 +132,6 @@ int MPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle)
/* If handle is MPI_T_PVAR_ALL_HANDLES, dispatch the call.
* Otherwise, do correctness check, then go to impl.
*/
MPIR_T_pvar_handle_t *hnd;
if (handle == MPI_T_PVAR_ALL_HANDLES) {
MPL_DL_FOREACH(session->hlist, hnd) {
if (!MPIR_T_pvar_is_readonly(hnd)) {
......
......@@ -54,6 +54,8 @@ static int MPIDI_CH3I_SHM_Wins_match(MPID_Win ** win_ptr, MPID_Win ** matched_wi
int mpi_errno = MPI_SUCCESS;
int i, comm_size;
int node_size, node_rank, shm_node_size;
int group_diff;
int base_diff;
MPID_Comm *node_comm_ptr = NULL, *shm_node_comm_ptr = NULL;
int *node_ranks = NULL, *node_ranks_in_shm_node = NULL;
......@@ -62,13 +64,13 @@ static int MPIDI_CH3I_SHM_Wins_match(MPID_Win ** win_ptr, MPID_Win ** matched_wi
MPI_Aint *base_shm_offs;
MPIDI_SHM_Win_t *elem = shm_wins_list;
*matched_win = NULL;
base_shm_offs = *base_shm_offs_ptr;
MPIU_CHKLMEM_DECL(2);
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SHM_WINS_MATCH);
MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SHM_WINS_MATCH);
*matched_win = NULL;
base_shm_offs = *base_shm_offs_ptr;
node_comm_ptr = (*win_ptr)->comm_ptr->node_comm;
MPIU_Assert(node_comm_ptr != NULL);
node_size = node_comm_ptr->local_size;
......@@ -116,7 +118,7 @@ static int MPIDI_CH3I_SHM_Wins_match(MPID_Win ** win_ptr, MPID_Win ** matched_wi
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
shm_node_group_ptr = NULL;
int group_diff = 0;
group_diff = 0;
for (i = 0; i < node_size; i++) {
/* not exist in shm_comm->node_comm */
if (node_ranks_in_shm_node[i] == MPI_UNDEFINED) {
......@@ -140,7 +142,7 @@ static int MPIDI_CH3I_SHM_Wins_match(MPID_Win ** win_ptr, MPID_Win ** matched_wi
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIU_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
int base_diff = 0;
base_diff = 0;
for (i = 0; i < comm_size; ++i) {
int i_node_rank = (*win_ptr)->comm_ptr->intranode_table[i];
if (i_node_rank >= 0) {
......@@ -499,6 +501,8 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPID_Info *
/* compute the base addresses of each process within the shared memory segment */
{
char *cur_base;
int cur_rank;
if ((*win_ptr)->create_flavor != MPI_WIN_FLAVOR_SHARED) {
/* If create flavor is not MPI_WIN_FLAVOR_SHARED, all processes on this
window may not be on the same node. Because we only need to calculate
......@@ -512,8 +516,8 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPID_Info *
node_shm_base_addrs = (*win_ptr)->shm_base_addrs;
}
char *cur_base = (*win_ptr)->shm_base_addr;
int cur_rank = 0;
cur_base = (*win_ptr)->shm_base_addr;
cur_rank = 0;
node_shm_base_addrs[0] = (*win_ptr)->shm_base_addr;
for (i = 1; i < node_size; ++i) {
if (node_sizes[i]) {
......
......@@ -5361,6 +5361,7 @@ int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
char *data_buf = NULL;
MPIDI_msg_sz_t data_len;
int mpi_errno = MPI_SUCCESS;
int (*fcn)( MPIDI_VC_t *, struct MPID_Request *, int * );
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKPUTUNLOCK);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKPUTUNLOCK);
......@@ -5450,7 +5451,6 @@ int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
req->dev.lock_queue_entry = new_ptr;
}
int (*fcn)( MPIDI_VC_t *, struct MPID_Request *, int * );
fcn = req->dev.OnDataAvail;
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
&complete);
......
......@@ -81,8 +81,8 @@ int MPID_Comm_failed_bitarray(MPID_Comm *comm_ptr, uint32_t **bitarray, int acke
uint32_t bit;
int *failed_procs, *group_procs;
MPID_Group *failed_group, *comm_group;
MPIDI_STATE_DECL(MPID_STATE_COMM_FAILED_BITARRAY);
MPIU_CHKLMEM_DECL(2);
MPIDI_STATE_DECL(MPID_STATE_COMM_FAILED_BITARRAY);
MPIDI_FUNC_ENTER(MPID_STATE_COMM_FAILED_BITARRAY);
......
......@@ -21,14 +21,14 @@
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPID_Comm_revoke(MPID_Comm *comm_ptr, int is_remote)
{
MPIDI_VC_t *vc;
MPID_IOV iov[MPID_IOV_LIMIT];
int mpi_errno = MPI_SUCCESS;
int i, size, my_rank, failed=0;
MPID_Request *request;
MPIDI_CH3_Pkt_t upkt;
MPIDI_CH3_Pkt_revoke_t *revoke_pkt = &upkt.revoke;
MPIDI_STATE_DECL(MPID_STATE_MPID_COMM_REVOKE);
MPIDI_VC_t *vc;
MPID_IOV iov[MPID_IOV_LIMIT];
int i, size, my_rank, failed = 0;
MPID_Request *request;
M