Skip to content

Commit

Permalink
better error output, lit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dschuff committed Aug 18, 2023
1 parent ab7e31d commit bcd2e78
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/support/command-line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ Options& Options::add_positional(const std::string& name,
void Options::parse(int argc, const char* argv[]) {

#ifdef _WIN32
auto argListW = CommandLineToArgvW(GetCommandLineW(), &argc);
LPWSTR* argListW = CommandLineToArgvW(GetCommandLineW(), &argc);
std::vector<std::string> argList;
std::cerr << "cmd line ";
//std::cerr << "cmd line ";
for (size_t i = 0, e = argc; i < e; ++i) {
argList.push_back(wasm::Path::wstring_to_string(argListW[i]));
std::cerr << argListW[i] << " " << argList[i] << "\n";
//std::cerr << *argListW[i] << " " << argList[i] << "\n";
}
#else
const char** argList = argv;
Expand Down
4 changes: 2 additions & 2 deletions src/support/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ wasm::Output::Output(const std::string& filename, Flags::BinaryOption binary)
buffer = std::cout.rdbuf();
} else {
BYN_TRACE("Opening '" << filename << "'\n");
auto flags = std::ofstream::out | std::ofstream::trunc;
std::ios_base::openmode flags = std::ofstream::out | std::ofstream::trunc;
if (binary == Flags::Binary) {
flags |= std::ofstream::binary;
}
outfile.open(wasm::Path::to_path(filename), flags);
if (!outfile.is_open()) {
Fatal() << "Failed opening '" << filename << "'";
Fatal() << "Failed opening output file '" << filename << "': " << strerror(errno);
}
buffer = outfile.rdbuf();
}
Expand Down
2 changes: 1 addition & 1 deletion src/wasm/wasm-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void ModuleWriter::writeBinary(Module& wasm, Output& output) {
sourceMapStream = std::make_unique<std::ofstream>();
sourceMapStream->open(wasm::Path::to_path(sourceMapFilename));
if (!sourceMapStream->is_open()) {
Fatal() << "Failed opening '" << sourceMapFilename << "'";
Fatal() << "Failed opening sourcemap output file '" << sourceMapFilename << "'";
}
writer.setSourceMap(sourceMapStream.get(), sourceMapUrl);
}
Expand Down
13 changes: 13 additions & 0 deletions test/lit/unicode.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
;; RUN: wasm-as %s -o %t-❤.wasm

(module
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(memory $0 256 256)
(export "add" (func $add))
(func $add (; 0 ;) (param $0 i32) (param $1 i32) (result i32)
(i32.add
(local.get $0)
(local.get $1)
)
)
)

0 comments on commit bcd2e78

Please sign in to comment.