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

David Majnemer david.majnemer at gmail.com
Sun Jan 12 20:50:42 PST 2014


Couldn't we use _O_U8TEXT with O_BINARY to get the best of both worlds?


On Sun, Jan 12, 2014 at 2:06 PM, Reid Kleckner <rnk at google.com> wrote:

> So assertion failures on Windows are no longer printed as wide strings?
>  If so, thanks for fixing this!
>
>
> On Sun, Jan 12, 2014 at 8:14 AM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:
>
>> 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
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140112/8151623e/attachment.html>


More information about the llvm-commits mailing list