Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
#define DUMP_OCTETS_PER_LINE 16
#define DUMP_OCTETS_PER_GROUP 2

#define ERROR0(msg) fprintf(stderr, "%s:%d: " msg, __FILE__, __LINE__)
#define ERROR(fmt, ...) \
fprintf(stderr, "%s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__)
#define UNIMPLMENTED(msg) fprintf(stderr, "%s:%d: " msg, __FILE__, __LINE__)
#define ERROR(fmt, ...) fprintf(stderr, "wabt: " fmt, __VA_ARGS__)

namespace wabt {

Expand Down Expand Up @@ -136,7 +135,8 @@ Result OutputBuffer::WriteToFile(std::string_view filename) const {
std::string filename_str(filename);
FILE* file = fopen(filename_str.c_str(), "wb");
if (!file) {
ERROR("unable to open %s for writing\n", filename_str.c_str());
ERROR("unable to open %s for writing: %s\n", filename_str.c_str(),
strerror(errno));
return Result::Error;
}

Expand Down Expand Up @@ -238,7 +238,8 @@ FileStream::FileStream(std::string_view filename, Stream* log_stream)
if (file_) {
should_close_ = true;
} else {
ERROR("fopen name=\"%s\" failed, errno=%d\n", filename_str.c_str(), errno);
ERROR("unable to open %s for writing: %s\n", filename_str.c_str(),
strerror(errno));
}
}

Expand Down Expand Up @@ -304,7 +305,7 @@ Result FileStream::MoveDataImpl(size_t dst_offset,
return Result::Ok;
}
// TODO(binji): implement if needed.
ERROR0("FileStream::MoveDataImpl not implemented!\n");
UNIMPLMENTED("FileStream::MoveDataImpl not implemented!\n");
return Result::Error;
}

Expand All @@ -313,7 +314,7 @@ Result FileStream::TruncateImpl(size_t size) {
return Result::Error;
}
// TODO(binji): implement if needed.
ERROR0("FileStream::TruncateImpl not implemented!\n");
UNIMPLMENTED("FileStream::TruncateImpl not implemented!\n");
return Result::Error;
}

Expand Down
3 changes: 1 addition & 2 deletions src/tools/wasm-stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include "wabt/option-parser.h"
#include "wabt/stream.h"

#define ERROR(fmt, ...) \
fprintf(stderr, "%s:%d: " fmt, __FILE__, __LINE__, __VA_ARGS__)
#define ERROR(fmt, ...) fprintf(stderr, "wabt: " fmt, __VA_ARGS__)

using namespace wabt;

Expand Down
7 changes: 7 additions & 0 deletions test/dump/bad-output-path.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
;;; RUN: %(wat2wasm)s %(in_file)s -o %(temp_file)s.wasm
;;; RUN: %(wasm-strip)s -o non-existent/out.wasm %(temp_file)s.wasm
;;; ERROR: 1
(module)
(;; STDERR ;;;
wabt: unable to open non-existent/out.wasm for writing: No such file or directory
;;; STDERR ;;)
Loading