diff options
author | Ben Smith <binjimin@gmail.com> | 2018-05-16 19:21:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 19:21:19 -0700 |
commit | 1fec702978b82945f5e6097f765d505f25f30097 (patch) | |
tree | c1df59bd7fdfc8609c1eac150e3dd5a85854c1c7 /src/binary-reader-interp.cc | |
parent | dd7663d78bf483308cd8d70d114748321f2cd61f (diff) | |
download | wabt-1fec702978b82945f5e6097f765d505f25f30097.tar.gz wabt-1fec702978b82945f5e6097f765d505f25f30097.tar.bz2 wabt-1fec702978b82945f5e6097f765d505f25f30097.zip |
Print "warning" for ignored custom section errors (#843)
The previous message said "error", which makes it look like the output
is not created, so change the message to "warning" instead.
The error handling code is pretty ugly and can use a refactor, but that
would be a much larger change.
Diffstat (limited to 'src/binary-reader-interp.cc')
-rw-r--r-- | src/binary-reader-interp.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/binary-reader-interp.cc b/src/binary-reader-interp.cc index 38817b32..4849bbe4 100644 --- a/src/binary-reader-interp.cc +++ b/src/binary-reader-interp.cc @@ -78,7 +78,7 @@ class BinaryReaderInterp : public BinaryReaderNop { std::unique_ptr<OutputBuffer> ReleaseOutputBuffer(); // Implement BinaryReader. - bool OnError(const char* message) override; + bool OnError(ErrorLevel, const char* message) override; wabt::Result EndModule() override; @@ -222,7 +222,7 @@ class BinaryReaderInterp : public BinaryReaderNop { void PushLabel(IstreamOffset offset, IstreamOffset fixup_offset); void PopLabel(); - bool HandleError(Offset offset, const char* message); + bool HandleError(ErrorLevel, Offset offset, const char* message); void PrintError(const char* format, ...); Index TranslateSigIndexToEnv(Index sig_index); @@ -340,14 +340,16 @@ Label* BinaryReaderInterp::TopLabel() { return GetLabel(0); } -bool BinaryReaderInterp::HandleError(Offset offset, const char* message) { - return error_handler_->OnError(offset, message); +bool BinaryReaderInterp::HandleError(ErrorLevel error_level, + Offset offset, + const char* message) { + return error_handler_->OnError(error_level, offset, message); } void WABT_PRINTF_FORMAT(2, 3) BinaryReaderInterp::PrintError(const char* format, ...) { WABT_SNPRINTF_ALLOCA(buffer, length, format); - HandleError(kInvalidOffset, buffer); + HandleError(ErrorLevel::Error, kInvalidOffset, buffer); } Index BinaryReaderInterp::TranslateSigIndexToEnv(Index sig_index) { @@ -545,8 +547,8 @@ wabt::Result BinaryReaderInterp::EmitFuncOffset(DefinedFunc* func, return wabt::Result::Ok; } -bool BinaryReaderInterp::OnError(const char* message) { - return HandleError(state->offset, message); +bool BinaryReaderInterp::OnError(ErrorLevel error_level, const char* message) { + return HandleError(error_level, state->offset, message); } wabt::Result BinaryReaderInterp::OnTypeCount(Index count) { |