1
1

Merge pull request #5669 from jsquyres/pr/minor-compiler-warning-fixes

misc: compiler warning fixes
Этот коммит содержится в:
bosilca 2018-09-15 12:01:02 -04:00 коммит произвёл GitHub
родитель 6363889cd0 5be0ba0247
Коммит 37b7a48dca
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 73 добавлений и 50 удалений

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

@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2010 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
@ -1157,8 +1157,18 @@ static int fetch_request( mqs_process *proc, mpi_process_info *p_info,
mqs_fetch_data( proc, ompi_datatype + i_info->ompi_datatype_t.offset.name,
64, data_name );
if( '\0' != data_name[0] ) {
snprintf( (char*)res->extra_text[1], 64, "Data: %d * %s",
(int)res->desired_length, data_name );
// res->extra_text[x] is only 64 chars long -- same as
// data_name. If you try to snprintf it into
// res->extra_text with additional text, some compilers
// will warn that we might truncate the string (because it
// can see the static char array lengths). So just put
// data_name in res->extra_text[2] (vs. extra_text[1]),
// where it is guaranteed to fit.
data_name[4] = '\0';
snprintf( (char*)res->extra_text[1], 64, "Data: %d",
(int)res->desired_length);
snprintf( (char*)res->extra_text[2], 64, "%s",
data_name );
}
/* And now compute the real length as specified by the user */
res->desired_length *=

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

@ -62,7 +62,6 @@ struct dict {
int (*_insert) __P((void *obj, void *k, void *d, int ow));
int (*_probe) __P((void *obj, void *key, void **dat));
void *(*_search) __P((void *obj, const void *k));
const void *(*_csearch) __P((const void *obj, const void *k));
int (*_remove) __P((void *obj, const void *key, int del));
void (*_walk) __P((void *obj, dict_vis_func func));
unsigned (*_count) __P((const void *obj));
@ -75,7 +74,6 @@ struct dict {
#define dict_insert(dct,k,d,o) (dct)->_insert((dct)->_object, (k), (d), (o))
#define dict_probe(dct,k,d) (dct)->_probe((dct)->_object, (k), (d))
#define dict_search(dct,k) (dct)->_search((dct)->_object, (k))
#define dict_csearch(dct,k) (dct)->_csearch((dct)->_object, (k))
#define dict_remove(dct,k,del) (dct)->_remove((dct)->_object, (k), (del))
#define dict_walk(dct,f) (dct)->_walk((dct)->_object, (f))
#define dict_count(dct) (dct)->_count((dct)->_object)

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

@ -15,7 +15,6 @@
typedef int (*insert_func) __P((void *, void *k, void *d, int o));
typedef int (*probe_func) __P((void *, void *k, void **d));
typedef void *(*search_func) __P((void *, const void *k));
typedef const void *(*csearch_func) __P((const void *, const void *k));
typedef int (*remove_func) __P((void *, const void *k, int d));
typedef void (*walk_func) __P((void *, dict_vis_func visit));
typedef unsigned (*count_func) __P((const void *));

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

@ -90,7 +90,6 @@ hb_dict_new(dict_cmp_func key_cmp, dict_del_func key_del,
dct->_insert = (insert_func)hb_tree_insert;
dct->_probe = (probe_func)hb_tree_probe;
dct->_search = (search_func)hb_tree_search;
dct->_csearch = (csearch_func)hb_tree_csearch;
dct->_remove = (remove_func)hb_tree_remove;
dct->_empty = (empty_func)hb_tree_empty;
dct->_walk = (walk_func)hb_tree_walk;
@ -170,12 +169,6 @@ hb_tree_search(hb_tree *tree, const void *key)
return NULL;
}
const void *
hb_tree_csearch(const hb_tree *tree, const void *key)
{
return hb_tree_csearch((hb_tree *)tree, key);
}
int
hb_tree_insert(hb_tree *tree, void *key, void *dat, int overwrite)
{

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

@ -26,7 +26,6 @@ void hb_tree_destroy __P((hb_tree *tree, int del));
int hb_tree_insert __P((hb_tree *tree, void *key, void *dat, int overwrite));
int hb_tree_probe __P((hb_tree *tree, void *key, void **dat));
void *hb_tree_search __P((hb_tree *tree, const void *key));
const void *hb_tree_csearch __P((const hb_tree *tree, const void *key));
int hb_tree_remove __P((hb_tree *tree, const void *key, int del));
void hb_tree_empty __P((hb_tree *tree, int del));
void hb_tree_walk __P((hb_tree *tree, dict_vis_func visit));

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

@ -4,7 +4,7 @@
* reserved.
* Copyright (c) 2013-2017 Inria. All rights reserved.
* Copyright (c) 2013-2015 Bull SAS. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -42,10 +42,30 @@ writing 4x4 matrix to monitoring_avg.mat
*/
#include "ompi_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#include <string.h>
#include <stdbool.h>
#if OMPI_BUILD_FORTRAN_BINDINGS
// Set these #defines in the same way that
// ompi/mpi/fortran/mpif-h/Makefile.am does when compiling the real
// Fortran mpif.h bindings. They set behaviors in the Fortran header
// files so that we can compile properly.
#define OMPI_BUILD_MPI_PROFILING 0
#define OMPI_COMPILING_FORTRAN_WRAPPERS 1
#endif
#include "opal/threads/thread_usage.h"
#include "ompi/include/mpi.h"
#include "ompi/mpi/fortran/base/constants.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"
#if OMPI_BUILD_FORTRAN_BINDINGS
#include "ompi/mpi/fortran/mpif-h/bindings.h"
#endif
static MPI_T_pvar_session session;
static int comm_world_size;
@ -383,12 +403,6 @@ int write_mat(char * filename, size_t * mat, unsigned int dim)
* MPI binding for fortran
*/
#include <stdbool.h>
#include "ompi_config.h"
#include "opal/threads/thread_usage.h"
#include "ompi/mpi/fortran/base/constants.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"
void monitoring_prof_mpi_init_f2c( MPI_Fint * );
void monitoring_prof_mpi_finalize_f2c( MPI_Fint * );
@ -423,8 +437,6 @@ void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) {
#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c
#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c
#elif OMPI_BUILD_FORTRAN_BINDINGS
#define OMPI_F77_PROTOTYPES_MPI_H
#include "ompi/mpi/fortran/mpif-h/bindings.h"
OMPI_GENERATE_F77_BINDINGS (MPI_INIT,
mpi_init,

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

@ -64,7 +64,7 @@ mca_btl_ofi_frag_completion_t *mca_btl_ofi_frag_completion_alloc
mca_btl_base_descriptor_t *mca_btl_ofi_alloc(
mca_btl_base_module_t *btl,
mca_btl_base_endpoint_t *endpoint,
uint64_t order, size_t size, uint32_t flags)
uint8_t order, size_t size, uint32_t flags)
{
mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t*) btl;
mca_btl_ofi_base_frag_t *frag = NULL;

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

@ -32,7 +32,7 @@
mca_btl_base_descriptor_t *mca_btl_ofi_alloc(
mca_btl_base_module_t *btl,
mca_btl_base_endpoint_t *endpoint,
uint64_t order, size_t size, uint32_t flags);
uint8_t order, size_t size, uint32_t flags);
int mca_btl_ofi_free (mca_btl_base_module_t *btl, mca_btl_base_descriptor_t *des);

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

@ -62,7 +62,7 @@ static int mca_btl_ofi_add_procs (mca_btl_base_module_t *btl,
} else {
/* We don't have this endpoint yet, create one */
peers[i] = mca_btl_ofi_endpoint_create (proc, ofi_btl->ofi_endpoint);
BTL_VERBOSE(("creating peer %p", peers[i]));
BTL_VERBOSE(("creating peer %p", (void*) peers[i]));
if (OPAL_UNLIKELY(NULL == peers[i])) {
return OPAL_ERR_OUT_OF_RESOURCE;

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

@ -115,7 +115,7 @@ static void flush_and_invalidate_cache (unsigned long a)
"isb":: "r" (a));
#endif
}
#endif // HAVE___CLEAR_CACHE
#endif // !HAVE___CLEAR_CACHE
// modify protection of memory range
static void ModifyMemoryProtection (uintptr_t addr, size_t length, int prot)

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

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -32,7 +33,7 @@
static const char *path_sep = OPAL_PATH_SEP;
char *opal_os_path(bool relative, ...)
char *opal_os_path(int relative, ...)
{
va_list ap;
char *element, *path;

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

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -62,8 +63,13 @@ BEGIN_C_DECLS
* provided path elements, separated by the path separator character
* appropriate to the local operating system. The path_name string has been malloc'd
* and therefore the user is responsible for free'ing the field.
*/
OPAL_DECLSPEC char *opal_os_path(bool relative, ...) __opal_attribute_malloc__ __opal_attribute_sentinel__ __opal_attribute_warn_unused_result__;
*
* Note that the "relative" argument is int instead of bool, because
* passing a parameter that undergoes default argument promotion to
* va_start() has undefined behavior (according to clang warnings on
* MacOS High Sierra).
*/
OPAL_DECLSPEC char *opal_os_path(int relative, ...) __opal_attribute_malloc__ __opal_attribute_sentinel__ __opal_attribute_warn_unused_result__;
/**
* Convert the path to be OS friendly. On UNIX this function will

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
@ -48,9 +48,9 @@ static char **search_dirs = NULL;
* Local functions
*/
static int opal_show_vhelp_internal(const char *filename, const char *topic,
bool want_error_header, va_list arglist);
int want_error_header, va_list arglist);
static int opal_show_help_internal(const char *filename, const char *topic,
bool want_error_header, ...);
int want_error_header, ...);
opal_show_help_fn_t opal_show_help = opal_show_help_internal;
opal_show_vhelp_fn_t opal_show_vhelp = opal_show_vhelp_internal;
@ -89,7 +89,7 @@ int opal_show_help_finalize(void)
* not optimization. :-)
*/
static int array2string(char **outstring,
bool want_error_header, char **lines)
int want_error_header, char **lines)
{
int i, count;
size_t len;
@ -293,7 +293,7 @@ static int load_array(char ***array, const char *filename, const char *topic)
}
char *opal_show_help_vstring(const char *filename, const char *topic,
bool want_error_header, va_list arglist)
int want_error_header, va_list arglist)
{
int rc;
char *single_string, *output, **array = NULL;
@ -317,7 +317,7 @@ char *opal_show_help_vstring(const char *filename, const char *topic,
}
char *opal_show_help_string(const char *filename, const char *topic,
bool want_error_handler, ...)
int want_error_handler, ...)
{
char *output;
va_list arglist;
@ -331,7 +331,7 @@ char *opal_show_help_string(const char *filename, const char *topic,
}
static int opal_show_vhelp_internal(const char *filename, const char *topic,
bool want_error_header, va_list arglist)
int want_error_header, va_list arglist)
{
char *output;
@ -349,7 +349,7 @@ static int opal_show_vhelp_internal(const char *filename, const char *topic,
}
static int opal_show_help_internal(const char *filename, const char *topic,
bool want_error_header, ...)
int want_error_header, ...)
{
va_list arglist;
int rc;

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -127,9 +127,14 @@ OPAL_DECLSPEC int opal_show_help_finalize(void);
* (typically $prefix/share/openmpi), and looks up the message
* based on the topic, and displays it. If want_error_header is
* true, a header and footer of asterisks are also displayed.
*
* Note that the "want_error_header" argument is int instead of bool,
* because passing a parameter that undergoes default argument
* promotion to va_start() has undefined behavior (according to clang
* warnings on MacOS High Sierra).
*/
typedef int (*opal_show_help_fn_t)(const char *filename, const char *topic,
bool want_error_header, ...);
int want_error_header, ...);
OPAL_DECLSPEC extern opal_show_help_fn_t opal_show_help;
/**
@ -137,7 +142,7 @@ OPAL_DECLSPEC extern opal_show_help_fn_t opal_show_help;
* a va_list form of varargs.
*/
typedef int (*opal_show_vhelp_fn_t)(const char *filename, const char *topic,
bool want_error_header, va_list ap);
int want_error_header, va_list ap);
OPAL_DECLSPEC extern opal_show_vhelp_fn_t opal_show_vhelp;
/**
@ -146,7 +151,7 @@ OPAL_DECLSPEC extern opal_show_vhelp_fn_t opal_show_vhelp;
*/
OPAL_DECLSPEC char* opal_show_help_string(const char *filename,
const char *topic,
bool want_error_header, ...);
int want_error_header, ...);
/**
* This function does the same thing as opal_show_help_string(), but
@ -154,7 +159,7 @@ OPAL_DECLSPEC char* opal_show_help_string(const char *filename,
*/
OPAL_DECLSPEC char* opal_show_help_vstring(const char *filename,
const char *topic,
bool want_error_header, va_list ap);
int want_error_header, va_list ap);
/**
* This function adds another search location for the files that

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
@ -591,7 +591,7 @@ void orte_show_help_finalize(void)
}
int orte_show_help(const char *filename, const char *topic,
bool want_error_header, ...)
int want_error_header, ...)
{
int rc = ORTE_SUCCESS;
va_list arglist;
@ -623,7 +623,7 @@ static void cbfunc(int status, void *cbdata)
}
int orte_show_help_norender(const char *filename, const char *topic,
bool want_error_header, const char *output)
int want_error_header, const char *output)
{
int rc = ORTE_SUCCESS;
int8_t have_output = 1;

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
* $COPYRIGHT$
*
@ -78,7 +78,7 @@ ORTE_DECLSPEC void orte_show_help_finalize(void);
* (e.g., cray).
*/
ORTE_DECLSPEC int orte_show_help(const char *filename, const char *topic,
bool want_error_header, ...);
int want_error_header, ...);
/**
* Exactly the same as orte_show_help, but pass in a rendered string,
@ -86,7 +86,7 @@ ORTE_DECLSPEC int orte_show_help(const char *filename, const char *topic,
*/
ORTE_DECLSPEC int orte_show_help_norender(const char *filename,
const char *topic,
bool want_error_header,
int want_error_header,
const char *output);
/**