| 237 | } |
| 238 | |
| 239 | void WABT_PRINTF_FORMAT(2, 3) BinaryReader::PrintError(const char* format, |
| 240 | ...) { |
| 241 | ErrorLevel error_level = |
| 242 | reading_custom_section_ && !options_.fail_on_custom_section_error |
| 243 | ? ErrorLevel::Warning |
| 244 | : ErrorLevel::Error; |
| 245 | |
| 246 | WABT_SNPRINTF_ALLOCA(buffer, length, format); |
| 247 | Error error(error_level, Location(state_.offset), std::string_view(), buffer); |
| 248 | bool handled = delegate_->OnError(error); |
| 249 | |
| 250 | if (!handled) { |
| 251 | // Not great to just print, but we don't want to eat the error either. |
| 252 | fprintf(stderr, "%07" PRIzx ": %s: %s\n", state_.offset, |
| 253 | GetErrorLevelName(error_level), buffer); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | Result BinaryReader::ReportUnexpectedOpcode(Opcode opcode, const char* where) { |
| 258 | std::string message = "unexpected opcode"; |
nothing calls this directly
no test coverage detected