[PATCH] D107654: [Flang] Fix error messages on Windows.

Ivan Zhechev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 08:45:52 PDT 2021


ijan1 created this revision.
ijan1 added reviewers: Meinersbur, awarzynski, Leporacanthicus, kiranchandramohan, jdoerfert, sscalpone, tskeith.
ijan1 requested review of this revision.
Herald added a project: LLVM.

Flang uses positional arguments for messages::say(),
such as "%1$s" which is only supported in MS Compilers
with the _*printf_p form of the function.
This uses a conditional macro to convert the existing
vsnprintf used to the one needed in MS-World.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107654

Files:
  flang/lib/Parser/message.cpp


Index: flang/lib/Parser/message.cpp
===================================================================
--- flang/lib/Parser/message.cpp
+++ flang/lib/Parser/message.cpp
@@ -28,6 +28,10 @@
   return o;
 }
 
+#ifdef _MSC_VER
+#define vsnprintf _vsprintf_p
+#endif
+
 void MessageFormattedText::Format(const MessageFixedText *text, ...) {
   const char *p{text->text().begin()};
   std::string asString;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107654.364810.patch
Type: text/x-patch
Size: 402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210806/0a86a315/attachment.bin>


More information about the llvm-commits mailing list