Better argument checking for output function and added a routine for error printing.
This commit was SVN r15855.
Этот коммит содержится в:
родитель
d7c5fea096
Коммит
1d97c183e7
@ -10,7 +10,7 @@
|
||||
|
||||
#include "pml_v_output.h"
|
||||
|
||||
int pml_v_output_init(char *output, int verbosity) {
|
||||
int pml_v_output_open(char *output, int verbosity) {
|
||||
opal_output_stream_t lds;
|
||||
char hostname[32] = "NA";
|
||||
|
||||
@ -40,6 +40,6 @@ int pml_v_output_init(char *output, int verbosity) {
|
||||
return mca_pml_v.output;
|
||||
}
|
||||
|
||||
void pml_v_output_finalize(void) {
|
||||
void pml_v_output_close(void) {
|
||||
opal_output_close(mca_pml_v.output);
|
||||
}
|
||||
|
@ -20,8 +20,22 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int pml_v_output_init(char *output, int verbosity);
|
||||
void pml_v_output_finalize(void);
|
||||
int pml_v_output_open(char *output, int verbosity);
|
||||
void pml_v_output_close(void);
|
||||
|
||||
static inline void V_OUTPUT_ERR(const char *fmt, ... ) __opal_attribute_format__(__printf__, 1, 2);
|
||||
static inline void V_OUTPUT_ERR(const char *fmt, ... )
|
||||
{
|
||||
va_list list;
|
||||
char *str;
|
||||
int ret;
|
||||
va_start(list, fmt);
|
||||
ret = vasprintf(&str, fmt, list);
|
||||
assert(-1 != ret);
|
||||
opal_output(0, str);
|
||||
free(str);
|
||||
va_end(list);
|
||||
}
|
||||
|
||||
/* Tricky stuff to define V_OUTPUT and V_OUTPUT_VERBOSE with variadic arguments
|
||||
*/
|
||||
@ -39,7 +53,9 @@ void pml_v_output_finalize(void);
|
||||
|
||||
#elif OMPI_ENABLE_DEBUG
|
||||
/* No variadic macros available... So sad */
|
||||
static inline void V_OUTPUT(const char* fmt, ... ) {
|
||||
static inline void V_OUTPUT(const char* fmt, ... ) __opal_attribute_format__(__printf__, 1, 2);
|
||||
static inline void V_OUTPUT(const char* fmt, ... )
|
||||
{
|
||||
va_list list;
|
||||
char *str;
|
||||
int ret;
|
||||
@ -50,6 +66,7 @@ static inline void V_OUTPUT(const char* fmt, ... ) {
|
||||
free(str);
|
||||
va_end(list);
|
||||
}
|
||||
static inline void V_OUTPUT_VERBOSE(int V, const char* fmt, ... ) __opal_attribute_format__(__printf__, 2, 3);
|
||||
static inline void V_OUTPUT_VERBOSE(int V, const char* fmt, ... ) {
|
||||
va_list list;
|
||||
char *str;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user