[Openmp-commits] [openmp] r316623 - Fix fatal error message displaying
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Wed Oct 25 15:05:02 PDT 2017
Author: jlpeyton
Date: Wed Oct 25 15:05:02 2017
New Revision: 316623
URL: http://llvm.org/viewvc/llvm-project?rev=316623&view=rev
Log:
Fix fatal error message displaying
Replacing call to __kmp_msg(kmp_ms_fatal,...) with __kmp_fatal(...) caused an
issue when incomplete message is displayed in case an error message is followed
by another message (e.g. by a hint messa)ge. This is because __kmp_fatal()
passes incomplete list of arguments to __kmp_msg().
Patch by Olga Malysheva
Differential Revision: https://reviews.llvm.org/D39248
Modified:
openmp/trunk/runtime/src/kmp_i18n.cpp
Modified: openmp/trunk/runtime/src/kmp_i18n.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_i18n.cpp?rev=316623&r1=316622&r2=316623&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_i18n.cpp (original)
+++ openmp/trunk/runtime/src/kmp_i18n.cpp Wed Oct 25 15:05:02 2017
@@ -38,6 +38,9 @@ kmp_msg_t __kmp_msg_empty = {kmp_mt_dumm
kmp_msg_t __kmp_msg_null = {kmp_mt_dummy, 0, NULL, 0};
static char const *no_message_available = "(No message available)";
+static void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message,
+ va_list ap);
+
enum kmp_i18n_cat_status {
KMP_I18N_CLOSED, // Not yet opened or closed.
KMP_I18N_OPENED, // Opened successfully, ready to use.
@@ -784,9 +787,7 @@ kmp_msg_t __kmp_msg_error_mesg(char cons
} // __kmp_msg_error_mesg
// -----------------------------------------------------------------------------
-void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, ...) {
-
- va_list args;
+void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, va_list args) {
kmp_i18n_id_t format; // format identifier
kmp_msg_t fmsg; // formatted message
kmp_str_buf_t buffer;
@@ -815,7 +816,6 @@ void __kmp_msg(kmp_msg_severity_t severi
__kmp_str_free(&fmsg.str);
// Format other messages.
- va_start(args, message);
for (;;) {
message = va_arg(args, kmp_msg_t);
if (message.type == kmp_mt_dummy && message.str == NULL) {
@@ -838,7 +838,6 @@ void __kmp_msg(kmp_msg_severity_t severi
__kmp_str_buf_cat(&buffer, fmsg.str, fmsg.len);
__kmp_str_free(&fmsg.str);
}
- va_end(args);
// Print formatted messages.
// This lock prevents multiple fatal errors on the same problem.
@@ -852,8 +851,18 @@ void __kmp_msg(kmp_msg_severity_t severi
} // __kmp_msg
+void __kmp_msg(kmp_msg_severity_t severity, kmp_msg_t message, ...) {
+ va_list args;
+ va_start(args, message);
+ __kmp_msg(severity, message, args);
+ va_end(args);
+}
+
void __kmp_fatal(kmp_msg_t message, ...) {
- __kmp_msg(kmp_ms_fatal, message, __kmp_msg_null);
+ va_list args;
+ va_start(args, message);
+ __kmp_msg(kmp_ms_fatal, message, args);
+ va_end(args);
#if KMP_OS_WINDOWS
// Delay to give message a chance to appear before reaping
__kmp_thread_sleep(500);
More information about the Openmp-commits
mailing list