[llvm] r199057 - raw_fd_ostream: Don't change STDERR to O_BINARY, or w*printf() (in assert()) would barf wide chars after llvm::errs().

NAKAMURA Takumi geek4civic at gmail.com
Sun Jan 12 08:14:24 PST 2014


Author: chapuni
Date: Sun Jan 12 10:14:24 2014
New Revision: 199057

URL: http://llvm.org/viewvc/llvm-project?rev=199057&view=rev
Log:
raw_fd_ostream: Don't change STDERR to O_BINARY, or w*printf() (in assert()) would barf wide chars after llvm::errs().

Modified:
    llvm/trunk/lib/Support/raw_ostream.cpp

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=199057&r1=199056&r2=199057&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Sun Jan 12 10:14:24 2014
@@ -469,9 +469,10 @@ raw_fd_ostream::raw_fd_ostream(int fd, b
   : raw_ostream(unbuffered), FD(fd),
     ShouldClose(shouldClose), Error(false), UseAtomicWrites(false) {
 #ifdef O_BINARY
-  // Setting STDOUT and STDERR to binary mode is necessary in Win32
+  // Setting STDOUT to binary mode is necessary in Win32
   // to avoid undesirable linefeed conversion.
-  if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
+  // Don't touch STDERR, or w*printf() (in assert()) would barf wide chars.
+  if (fd == STDOUT_FILENO)
     setmode(fd, O_BINARY);
 #endif
 





More information about the llvm-commits mailing list