diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-12-13 23:16:49 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-12-13 23:16:49 +0000 |
commit | b92cb30cf547bf9a8590a981a49040f480c8eb82 (patch) | |
tree | fc2accf7bb61ca5179758404fefeb418e1a2aed0 /lib/Support | |
parent | faebf11a3468767bb702b8e9fca98237f1d3a126 (diff) | |
download | external_llvm-b92cb30cf547bf9a8590a981a49040f480c8eb82.zip external_llvm-b92cb30cf547bf9a8590a981a49040f480c8eb82.tar.gz external_llvm-b92cb30cf547bf9a8590a981a49040f480c8eb82.tar.bz2 |
Support/Program: Make Change<stream>ToBinary return error_code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Program.cpp | 1 | ||||
-rw-r--r-- | lib/Support/Unix/Program.inc | 12 | ||||
-rw-r--r-- | lib/Support/Windows/Program.inc | 18 | ||||
-rw-r--r-- | lib/Support/raw_ostream.cpp | 1 |
4 files changed, 20 insertions, 12 deletions
diff --git a/lib/Support/Program.cpp b/lib/Support/Program.cpp index 01860b0..75bc282 100644 --- a/lib/Support/Program.cpp +++ b/lib/Support/Program.cpp @@ -13,6 +13,7 @@ #include "llvm/Support/Program.h" #include "llvm/Config/config.h" +#include "llvm/Support/system_error.h" using namespace llvm; using namespace sys; diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc index 346baf1..e5990d0 100644 --- a/lib/Support/Unix/Program.inc +++ b/lib/Support/Unix/Program.inc @@ -412,19 +412,19 @@ Program::Kill(std::string* ErrMsg) { return false; } -bool Program::ChangeStdinToBinary(){ +error_code Program::ChangeStdinToBinary(){ // Do nothing, as Unix doesn't differentiate between text and binary. - return false; + return make_error_code(errc::success); } -bool Program::ChangeStdoutToBinary(){ +error_code Program::ChangeStdoutToBinary(){ // Do nothing, as Unix doesn't differentiate between text and binary. - return false; + return make_error_code(errc::success); } -bool Program::ChangeStderrToBinary(){ +error_code Program::ChangeStderrToBinary(){ // Do nothing, as Unix doesn't differentiate between text and binary. - return false; + return make_error_code(errc::success); } } diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index b328b3c..80ccaa6 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -397,19 +397,25 @@ Program::Kill(std::string* ErrMsg) { return false; } -bool Program::ChangeStdinToBinary(){ +error_code Program::ChangeStdinToBinary(){ int result = _setmode( _fileno(stdin), _O_BINARY ); - return result == -1; + if (result == -1) + return error_code(errno, generic_category()); + return make_error_code(errc::success); } -bool Program::ChangeStdoutToBinary(){ +error_code Program::ChangeStdoutToBinary(){ int result = _setmode( _fileno(stdout), _O_BINARY ); - return result == -1; + if (result == -1) + return error_code(errno, generic_category()); + return make_error_code(errc::success); } -bool Program::ChangeStderrToBinary(){ +error_code Program::ChangeStderrToBinary(){ int result = _setmode( _fileno(stderr), _O_BINARY ); - return result == -1; + if (result == -1) + return error_code(errno, generic_category()); + return make_error_code(errc::success); } } diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 4927e9a..72d3986 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -20,6 +20,7 @@ #include "llvm/Config/config.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/system_error.h" #include "llvm/ADT/STLExtras.h" #include <cctype> #include <cerrno> |