[Openmp-commits] [PATCH] D39248: Fix fatal error message displaying

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Oct 25 15:05:35 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316623: Fix fatal error message displaying (authored by jlpeyton).

Changed prior to commit:
  https://reviews.llvm.org/D39248?vs=120101&id=120325#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39248

Files:
  openmp/trunk/runtime/src/kmp_i18n.cpp


Index: openmp/trunk/runtime/src/kmp_i18n.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_i18n.cpp
+++ openmp/trunk/runtime/src/kmp_i18n.cpp
@@ -38,6 +38,9 @@
 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_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 @@
   __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 @@
     __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 @@
 
 } // __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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39248.120325.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20171025/541ca174/attachment.bin>


More information about the Openmp-commits mailing list