[Openmp-commits] [openmp] r321361 - Remove unused positional argument for printf

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Fri Dec 22 08:40:27 PST 2017


Author: jprotze
Date: Fri Dec 22 08:40:26 2017
New Revision: 321361

URL: http://llvm.org/viewvc/llvm-project?rev=321361&view=rev
Log:
Remove unused positional argument for printf

The format string for hints only prints the second argument (string) and drops
the first argument (hint id). Depending on how you read the POSIX text for
printf, this could be valid. But for practical reason, i.e., unpacking the
va_list passed to printf based on the formating information, it makes sense
to fix the implementation and not pass the id for hint.

Failing testcases were:

misc_bugs/teams-reduction.c
ompt/parallel/not_enough_threads.c

Differential Revision: https://reviews.llvm.org/D41504

Modified:
    openmp/trunk/runtime/src/i18n/en_US.txt
    openmp/trunk/runtime/src/kmp_i18n.cpp

Modified: openmp/trunk/runtime/src/i18n/en_US.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/i18n/en_US.txt?rev=321361&r1=321360&r2=321361&view=diff
==============================================================================
--- openmp/trunk/runtime/src/i18n/en_US.txt (original)
+++ openmp/trunk/runtime/src/i18n/en_US.txt Fri Dec 22 08:40:26 2017
@@ -115,7 +115,7 @@ Info                         "OMP: Info
 Warning                      "OMP: Warning #%1$d: %2$s\n"
 Fatal                        "OMP: Error #%1$d: %2$s\n"
 SysErr                       "OMP: System error #%1$d: %2$s\n"
-Hint                         "OMP: Hint: %2$s\n"
+Hint                         "OMP: Hint %1$s\n"
 
 Pragma                       "%1$s pragma (at %2$s:%3$s():%4$s)"
     # %1 is pragma name (like "parallel" or "master",

Modified: openmp/trunk/runtime/src/kmp_i18n.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_i18n.cpp?rev=321361&r1=321360&r2=321361&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_i18n.cpp (original)
+++ openmp/trunk/runtime/src/kmp_i18n.cpp Fri Dec 22 08:40:26 2017
@@ -823,13 +823,15 @@ void __kmp_msg(kmp_msg_severity_t severi
     switch (message.type) {
     case kmp_mt_hint: {
       format = kmp_i18n_fmt_Hint;
+      // we cannot skip %1$ and only use %2$ to print the message without the number
+      fmsg = __kmp_msg_format(format, message.str);
     } break;
     case kmp_mt_syserr: {
       format = kmp_i18n_fmt_SysErr;
+      fmsg = __kmp_msg_format(format, message.num, message.str);
     } break;
     default: { KMP_DEBUG_ASSERT(0); }
     }
-    fmsg = __kmp_msg_format(format, message.num, message.str);
     __kmp_str_free(&message.str);
     __kmp_str_buf_cat(&buffer, fmsg.str, fmsg.len);
     __kmp_str_free(&fmsg.str);




More information about the Openmp-commits mailing list