Make sure warning and error messages are not split up
They could be split up by other processes writing to stdout at the same time.
This commit is contained in:
parent
95e8643d70
commit
11aa71b939
2 changed files with 17 additions and 6 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2017-06-16: wsfulton
|
||||||
|
Make sure warning and error messages are not split up by other processes writing to
|
||||||
|
stdout at the same time.
|
||||||
|
|
||||||
2017-06-16: wsfulton
|
2017-06-16: wsfulton
|
||||||
[R] Fix wrapping function pointers containing rvalue and lvalue reference parameters.
|
[R] Fix wrapping function pointers containing rvalue and lvalue reference parameters.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,13 +106,16 @@ void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const c
|
||||||
}
|
}
|
||||||
if (warnall || wrn) {
|
if (warnall || wrn) {
|
||||||
String *formatted_filename = format_filename(filename);
|
String *formatted_filename = format_filename(filename);
|
||||||
|
String *full_message = NewString("");
|
||||||
if (wnum) {
|
if (wnum) {
|
||||||
Printf(stderr, wrn_wnum_fmt, formatted_filename, line, wnum);
|
Printf(full_message, wrn_wnum_fmt, formatted_filename, line, wnum);
|
||||||
} else {
|
} else {
|
||||||
Printf(stderr, wrn_nnum_fmt, formatted_filename, line);
|
Printf(full_message, wrn_nnum_fmt, formatted_filename, line);
|
||||||
}
|
}
|
||||||
Printf(stderr, "%s", msg);
|
Printf(full_message, "%s", msg);
|
||||||
|
Printv(stderr, full_message, NIL);
|
||||||
nwarning++;
|
nwarning++;
|
||||||
|
Delete(full_message);
|
||||||
Delete(formatted_filename);
|
Delete(formatted_filename);
|
||||||
}
|
}
|
||||||
Delete(out);
|
Delete(out);
|
||||||
|
|
@ -128,6 +131,7 @@ void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const c
|
||||||
void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
|
void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
String *formatted_filename = NULL;
|
String *formatted_filename = NULL;
|
||||||
|
String *full_message = NULL;
|
||||||
|
|
||||||
if (silence)
|
if (silence)
|
||||||
return;
|
return;
|
||||||
|
|
@ -136,14 +140,17 @@ void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ..
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
formatted_filename = format_filename(filename);
|
formatted_filename = format_filename(filename);
|
||||||
|
full_message = NewString("");
|
||||||
if (line > 0) {
|
if (line > 0) {
|
||||||
Printf(stderr, err_line_fmt, formatted_filename, line);
|
Printf(full_message, err_line_fmt, formatted_filename, line);
|
||||||
} else {
|
} else {
|
||||||
Printf(stderr, err_eof_fmt, formatted_filename);
|
Printf(full_message, err_eof_fmt, formatted_filename);
|
||||||
}
|
}
|
||||||
vPrintf(stderr, fmt, ap);
|
vPrintf(full_message, fmt, ap);
|
||||||
|
Printv(stderr, full_message, NIL);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
nerrors++;
|
nerrors++;
|
||||||
|
Delete(full_message);
|
||||||
Delete(formatted_filename);
|
Delete(formatted_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue