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

Fix compiler warnings related to MPI_T code



Fixed a set of compiler warnings related to MPI_T code when compiled
with -Wall, including "assignment discards 'const' qualifier from pointer
target type", "unused variable", "shadows a global declaration" etc.
Signed-off-by: default avatarAntonio J. Pena <apenya@mcs.anl.gov>
parent 6a9def62
......@@ -238,7 +238,7 @@ foreach my $p (@{$cvars->{cvars}}) {
$mpi_dtype = "MPI_CHAR";
$count = "MPIR_CVAR_MAX_STRLEN";
my $str_val = fmt_default($p->{name}, $p->{default}, $p->{defaultliteral}, $p->{type});
printf CVAR_C qq( defaultval.str = %s;\n), $str_val;
printf CVAR_C qq( defaultval.str = (char *)%s;\n), $str_val;
}
elsif ($p->{type} eq 'int' or $p->{type} eq 'boolean') {
$mpi_dtype = "MPI_INT";
......
......@@ -104,7 +104,6 @@ static inline cvar_table_entry_t * LOOKUP_CVAR_BY_NAME(const char* cvar_name)
#define MPIR_T_CVAR_REGISTER_STATIC(dtype_, name_, addr_, count_, verb_, \
scope_, default_, cat_, desc_) \
do { \
MPIU_Assert(addr_ != NULL); \
MPIU_Assert(count_ > 0); \
MPIR_T_CVAR_REGISTER_impl(dtype_, #name_, addr_, count_, MPI_T_ENUM_NULL, \
verb_, MPI_T_BIND_NO_OBJECT, scope_, NULL, NULL, default_, cat_, desc_); \
......
......@@ -1390,8 +1390,8 @@ extern MPIU_Thread_mutex_t mpi_t_mutex;
#endif
/* Init and finalize routines */
extern void MPIR_T_env_init();
extern void MPIR_T_env_finalize();
extern void MPIR_T_env_init(void);
extern void MPIR_T_env_finalize(void);
#define MPIR_T_FAIL_IF_UNINITIALIZED() \
do { \
......
......@@ -54,7 +54,7 @@ Output Parameters:
@*/
int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len,
int *verbosity, MPI_Datatype *datatype, MPI_T_enum *enumtype,
char *desc, int *desc_len, int *bind, int *scope)
char *desc, int *desc_len, int *binding, int *scope)
{
int mpi_errno = MPI_SUCCESS;
......@@ -97,8 +97,8 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len,
if (enumtype != NULL)
*enumtype = cvar->enumtype;
if (bind != NULL)
*bind = cvar->bind;
if (binding != NULL)
*binding = cvar->bind;
if (scope != NULL)
*scope = cvar->scope;
......@@ -116,7 +116,7 @@ fn_fail:
mpi_errno = MPIR_Err_create_code(
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_t_cvar_get_info", "**mpi_t_cvar_get_info %d %p %p %p %p %p %p %p %p %p",
cvar_index, name, name_len, verbosity, datatype, enumtype, desc, desc_len, bind, scope);
cvar_index, name, name_len, verbosity, datatype, enumtype, desc, desc_len, binding, scope);
}
#endif
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
......
......@@ -278,7 +278,7 @@ fn_fail:
* IN: count, # of elements of this cvar if known at registeration, otherwise 0.
* IN: etype, MPI_T_enum or MPI_T_ENUM_NULL
* IN: verb, MPI_T_PVAR_VERBOSITY_*
* IN: bind, MPI_T_BIND_*
* IN: binding, MPI_T_BIND_*
* IN: Scope, MPI_T_SCOPE_*
* IN: get_addr, If not NULL, it is a callback to get address of the cvar.
* IN: get_count, If not NULL, it is a callback to read count of the cvar.
......@@ -287,7 +287,7 @@ fn_fail:
*/
void MPIR_T_CVAR_REGISTER_impl(
MPI_Datatype dtype, const char* name, const void *addr, int count,
MPIR_T_enum_t *etype, MPIR_T_verbosity_t verb, MPIR_T_bind_t bind,
MPIR_T_enum_t *etype, MPIR_T_verbosity_t verb, MPIR_T_bind_t binding,
MPIR_T_scope_t scope, MPIR_T_cvar_get_addr_cb get_addr,
MPIR_T_cvar_get_count_cb get_count, MPIR_T_cvar_value_t defaultval,
const char *cat, const char * desc)
......@@ -318,7 +318,7 @@ void MPIR_T_CVAR_REGISTER_impl(
cvar->addr = (void *)addr;
cvar->count = count;
cvar->verbosity = verb;
cvar->bind = bind;
cvar->bind = binding;
cvar->scope = scope;
cvar->get_addr = get_addr;
cvar->get_count = get_count;
......@@ -352,7 +352,7 @@ void MPIR_T_CVAR_REGISTER_impl(
* IN: count, # of elements of this pvar if known at registeration, otherwise 0.
* IN: etype, MPI_T_enum or MPI_T_ENUM_NULL
* IN: verb, MPI_T_PVAR_VERBOSITY_*
* IN: bind, MPI_T_BIND_*
* IN: binding, MPI_T_BIND_*
* IN: flags, Bitwise OR of MPIR_T_R_PVAR_FLAGS_{}
* IN: get_value, If not NULL, it is a callback to read the pvar.
* IN: get_count, If not NULL, it is a callback to read count of the pvar.
......@@ -361,7 +361,7 @@ void MPIR_T_CVAR_REGISTER_impl(
*/
void MPIR_T_PVAR_REGISTER_impl(
int varclass, MPI_Datatype dtype, const char* name, void *addr, int count,
MPIR_T_enum_t *etype, int verb, int bind, int flags,
MPIR_T_enum_t *etype, int verb, int binding, int flags,
MPIR_T_pvar_get_value_cb get_value, MPIR_T_pvar_get_count_cb get_count,
const char * cat, const char * desc)
{
......@@ -394,7 +394,7 @@ void MPIR_T_PVAR_REGISTER_impl(
pvar->count = count;
pvar->enumtype = etype;
pvar->verbosity = verb;
pvar->bind = bind;
pvar->bind = binding;
pvar->flags = flags;
pvar->get_value = get_value;
pvar->get_count = get_count;
......
......@@ -57,7 +57,7 @@ Output Parameters:
@*/
int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosity,
int *var_class, MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc,
int *desc_len, int *bind, int *readonly, int *continuous, int *atomic)
int *desc_len, int *binding, int *readonly, int *continuous, int *atomic)
{
int mpi_errno = MPI_SUCCESS;
......@@ -111,8 +111,8 @@ int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosit
if (enumtype != NULL)
*enumtype = info->enumtype;
if (bind != NULL)
*bind = info->bind;
if (binding != NULL)
*binding = info->bind;
if (readonly != NULL)
*readonly = info->flags & MPIR_T_PVAR_FLAG_READONLY;
......@@ -138,7 +138,7 @@ fn_fail:
mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
"**mpi_t_pvar_get_info", "**mpi_t_pvar_get_info %d %p %p %p %p %p %p %p %p %p %p %p %p",
pvar_index, name, name_len, verbosity, var_class, datatype, enumtype, desc, desc_len,
bind, readonly, continuous, atomic);
binding, readonly, continuous, atomic);
}
# endif
mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
......
......@@ -31,7 +31,6 @@
int MPIR_T_pvar_read_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *restrict buf)
{
int i, mpi_errno = MPI_SUCCESS;
void *tmp;
/* Reading a never started pvar, or a stopped and then reset wartermark,
* will run into this nasty situation. Wait for an error code to be defined
......
......@@ -116,7 +116,7 @@ int MPIDI_CH3U_Recvq_init(void)
0, /* init value */
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3", /* category name */
"length of the posted message receive queue");
......@@ -127,7 +127,7 @@ int MPIDI_CH3U_Recvq_init(void)
0, /* init value */
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3", /* category name */
"length of the unexpected message receive queue");
......@@ -137,7 +137,7 @@ int MPIDI_CH3U_Recvq_init(void)
posted_recvq_match_attempts,
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3", /* category name */
"number of search passes on the message receive queue");
......@@ -147,7 +147,7 @@ int MPIDI_CH3U_Recvq_init(void)
unexpected_recvq_match_attempts,
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3",
"number of search passes on the message receive queue");
......@@ -157,7 +157,7 @@ int MPIDI_CH3U_Recvq_init(void)
time_failed_matching_postedq,
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3", /* category name */
"total time spent on unsuccessful search passes on the posted receives queue");
......@@ -167,7 +167,7 @@ int MPIDI_CH3U_Recvq_init(void)
time_matching_unexpectedq,
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3", /* category name */
"total time spent on search passes on the unexpected receive queue");
......@@ -178,7 +178,7 @@ int MPIDI_CH3U_Recvq_init(void)
0, /* init value */
MPI_T_VERBOSITY_USER_DETAIL,
MPI_T_BIND_NO_OBJECT,
MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS,
(MPIR_T_PVAR_FLAG_READONLY | MPIR_T_PVAR_FLAG_CONTINUOUS),
"CH3", /* category name */
"total buffer size allocated in the unexpected receive queue");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment