misc: passing a bool to va_start() is undefined
According to clang on MacOS, passing a bool parameter -- which undergoes default parameter promotion -- to va_start() results in undefined behavior. So just change these params to int and avoid the issue. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Этот коммит содержится в:
родитель
8f2620d3af
Коммит
3970b06134
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -32,7 +33,7 @@
|
|||||||
|
|
||||||
static const char *path_sep = OPAL_PATH_SEP;
|
static const char *path_sep = OPAL_PATH_SEP;
|
||||||
|
|
||||||
char *opal_os_path(bool relative, ...)
|
char *opal_os_path(int relative, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *element, *path;
|
char *element, *path;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -62,8 +63,13 @@ BEGIN_C_DECLS
|
|||||||
* provided path elements, separated by the path separator character
|
* provided path elements, separated by the path separator character
|
||||||
* appropriate to the local operating system. The path_name string has been malloc'd
|
* 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.
|
* 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
|
* Convert the path to be OS friendly. On UNIX this function will
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* 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
|
* Copyright (c) 2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
@ -48,9 +48,9 @@ static char **search_dirs = NULL;
|
|||||||
* Local functions
|
* Local functions
|
||||||
*/
|
*/
|
||||||
static int opal_show_vhelp_internal(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);
|
||||||
static int opal_show_help_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, ...);
|
||||||
|
|
||||||
opal_show_help_fn_t opal_show_help = opal_show_help_internal;
|
opal_show_help_fn_t opal_show_help = opal_show_help_internal;
|
||||||
opal_show_vhelp_fn_t opal_show_vhelp = opal_show_vhelp_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. :-)
|
* not optimization. :-)
|
||||||
*/
|
*/
|
||||||
static int array2string(char **outstring,
|
static int array2string(char **outstring,
|
||||||
bool want_error_header, char **lines)
|
int want_error_header, char **lines)
|
||||||
{
|
{
|
||||||
int i, count;
|
int i, count;
|
||||||
size_t len;
|
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,
|
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;
|
int rc;
|
||||||
char *single_string, *output, **array = NULL;
|
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,
|
char *opal_show_help_string(const char *filename, const char *topic,
|
||||||
bool want_error_handler, ...)
|
int want_error_handler, ...)
|
||||||
{
|
{
|
||||||
char *output;
|
char *output;
|
||||||
va_list arglist;
|
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,
|
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;
|
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,
|
static int opal_show_help_internal(const char *filename, const char *topic,
|
||||||
bool want_error_header, ...)
|
int want_error_header, ...)
|
||||||
{
|
{
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* 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
|
* (typically $prefix/share/openmpi), and looks up the message
|
||||||
* based on the topic, and displays it. If want_error_header is
|
* based on the topic, and displays it. If want_error_header is
|
||||||
* true, a header and footer of asterisks are also displayed.
|
* 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,
|
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;
|
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.
|
* a va_list form of varargs.
|
||||||
*/
|
*/
|
||||||
typedef int (*opal_show_vhelp_fn_t)(const char *filename, const char *topic,
|
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;
|
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,
|
OPAL_DECLSPEC char* opal_show_help_string(const char *filename,
|
||||||
const char *topic,
|
const char *topic,
|
||||||
bool want_error_header, ...);
|
int want_error_header, ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function does the same thing as opal_show_help_string(), but
|
* 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,
|
OPAL_DECLSPEC char* opal_show_help_vstring(const char *filename,
|
||||||
const char *topic,
|
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
|
* This function adds another search location for the files that
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* 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.
|
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2016-2017 Intel, Inc. 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,
|
int orte_show_help(const char *filename, const char *topic,
|
||||||
bool want_error_header, ...)
|
int want_error_header, ...)
|
||||||
{
|
{
|
||||||
int rc = ORTE_SUCCESS;
|
int rc = ORTE_SUCCESS;
|
||||||
va_list arglist;
|
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,
|
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;
|
int rc = ORTE_SUCCESS;
|
||||||
int8_t have_output = 1;
|
int8_t have_output = 1;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* 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 (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -78,7 +78,7 @@ ORTE_DECLSPEC void orte_show_help_finalize(void);
|
|||||||
* (e.g., cray).
|
* (e.g., cray).
|
||||||
*/
|
*/
|
||||||
ORTE_DECLSPEC int orte_show_help(const char *filename, const char *topic,
|
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,
|
* 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,
|
ORTE_DECLSPEC int orte_show_help_norender(const char *filename,
|
||||||
const char *topic,
|
const char *topic,
|
||||||
bool want_error_header,
|
int want_error_header,
|
||||||
const char *output);
|
const char *output);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user