[llvm-commits] CVS: llvm/tools/opt/opt.cpp
Jeff Cohen
jeffc at jolt-lang.org
Sat Jan 22 09:36:31 PST 2005
Changes in directory llvm/tools/opt:
opt.cpp updated: 1.105 -> 1.106
---
Log message:
Use binary mode for reading/writing bytecode files
---
Diffs of the changes: (+6 -3)
opt.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.105 llvm/tools/opt/opt.cpp:1.106
--- llvm/tools/opt/opt.cpp:1.105 Thu Jan 6 01:01:08 2005
+++ llvm/tools/opt/opt.cpp Sat Jan 22 11:36:17 2005
@@ -95,6 +95,7 @@
}
// Figure out what stream we are supposed to write to...
+ // FIXME: cout is not binary!
std::ostream *Out = &std::cout; // Default to printing to stdout...
if (OutputFilename != "-") {
if (!Force && std::ifstream(OutputFilename.c_str())) {
@@ -104,7 +105,9 @@
<< "Use -f command line argument to force output\n";
return 1;
}
- Out = new std::ofstream(OutputFilename.c_str());
+ std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
+ std::ios::binary;
+ Out = new std::ofstream(OutputFilename.c_str(), io_mode);
if (!Out->good()) {
std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n";
@@ -117,8 +120,8 @@
}
// If the output is set to be emitted to standard out, and standard out is a
- // console, print out a warning message and refuse to do it. We don't impress
- // anyone by spewing tons of binary goo to a terminal.
+ // console, print out a warning message and refuse to do it. We don't
+ // impress anyone by spewing tons of binary goo to a terminal.
if (!Force && !NoOutput && CheckBytecodeOutputToConsole(Out,!Quiet)) {
NoOutput = true;
}
More information about the llvm-commits
mailing list