Commit 7e64eaaa by Karl Schimpf

Remove dependence on header file unistd.h.

Fixes bug in function reportFatalErrorThenExitSuccess by using fwrite instead of write (a unix posix include file not supported by MSC). BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1370323005 .
parent 318f4cda
...@@ -29,18 +29,11 @@ ...@@ -29,18 +29,11 @@
#include "llvm/Support/StreamingMemoryObject.h" #include "llvm/Support/StreamingMemoryObject.h"
#pragma clang diagnostic pop #pragma clang diagnostic pop
#include <cstdio>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#if defined(HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined(_MSC_VER)
# include <io.h>
# include <fcntl.h>
#endif
namespace Ice { namespace Ice {
namespace { namespace {
...@@ -116,7 +109,8 @@ void reportFatalErrorThenExitSuccess(void *UserData, const std::string &Reason, ...@@ -116,7 +109,8 @@ void reportFatalErrorThenExitSuccess(void *UserData, const std::string &Reason,
llvm::raw_svector_ostream OS(Buffer); llvm::raw_svector_ostream OS(Buffer);
OS << "LLVM ERROR: " << Reason << "\n"; OS << "LLVM ERROR: " << Reason << "\n";
llvm::StringRef MessageStr = OS.str(); llvm::StringRef MessageStr = OS.str();
ssize_t written = ::write(2, MessageStr.data(), MessageStr.size()); ssize_t written =
::fwrite(MessageStr.data(), sizeof(char), MessageStr.size(), ::stdout);
(void)written; // If something went wrong, we deliberately just give up. (void)written; // If something went wrong, we deliberately just give up.
// If we reached here, we are failing ungracefully. Run the interrupt handlers // If we reached here, we are failing ungracefully. Run the interrupt handlers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment