Commit 38277b4a authored by Shravan Narayan's avatar Shravan Narayan
Browse files

Bug 1831227 - Remove windows.h dependency in wasm2c host program r=glandium

parent 74b0dcba
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@ origin:
  description: wasm2c fork used for rlbox sandboxing
  url: https://github.com/WebAssembly/wabt

  release: 5abbeaab97eb802acccf866d9c8cc021c1f7e570 (2023-05-02T18:27:21Z).
  revision: 5abbeaab97eb802acccf866d9c8cc021c1f7e570
  release: d24691ba62c371fb8dc2634956030e7102302174 (2023-05-05T23:57:24Z).
  revision: d24691ba62c371fb8dc2634956030e7102302174

  license: Apache-2.0
  license-file: LICENSE
+3 −3
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ replaced_variables = """

#define WABT_DEBUG 0

/* We don't require color printing of wasm2c errors on any platform */
#define HAVE_WIN32_VT100 0

#ifdef _WIN32
  // Ignore whatever is set in mozilla-config.h wrt alloca because it is
  // wrong when cross-compiling on Windows.
@@ -51,12 +54,9 @@ replaced_variables = """
  #define HAVE_SSIZE_T 0
  /* Whether strcasecmp is defined by strings.h */
  #define HAVE_STRCASECMP 0
  /* Whether ENABLE_VIRTUAL_TERMINAL_PROCESSING is defined by windows.h */
  #define HAVE_WIN32_VT100 1
#else
  #define HAVE_SSIZE_T 1
  #define HAVE_STRCASECMP 1
  #define HAVE_WIN32_VT100 0
#endif

#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
+12 −0
Original line number Diff line number Diff line
@@ -449,6 +449,10 @@ Result BinaryReaderIR::TopLabelExpr(LabelNode** label, Expr** expr) {
  CHECK_RESULT(TopLabel(label));
  LabelNode* parent_label;
  CHECK_RESULT(GetLabelAt(&parent_label, 1));
  if (parent_label->exprs->empty()) {
    PrintError("TopLabelExpr: parent label has empty expr list");
    return Result::Error;
  }
  *expr = &parent_label->exprs->back();
  return Result::Ok;
}
@@ -1217,6 +1221,10 @@ Result BinaryReaderIR::OnUnreachableExpr() {

Result BinaryReaderIR::EndFunctionBody(Index index) {
  current_func_ = nullptr;
  if (!label_stack_.empty()) {
    PrintError("function %" PRIindex " missing end marker", index);
    return Result::Error;
  }
  return Result::Ok;
}

@@ -1297,6 +1305,10 @@ Result BinaryReaderIR::BeginElemSegmentInitExpr(Index index) {
}

Result BinaryReaderIR::EndInitExpr() {
  if (!label_stack_.empty()) {
    PrintError("init expression missing end marker");
    return Result::Error;
  }
  return Result::Ok;
}

+8 −1
Original line number Diff line number Diff line
@@ -560,7 +560,14 @@ Index BinaryReader::NumTotalFuncs() {

Result BinaryReader::ReadInitExpr(Index index) {
  // Read instructions until END opcode is reached.
  return ReadInstructions(/*stop_on_end=*/true, read_end_, NULL);
  Opcode final_opcode(Opcode::Invalid);
  CHECK_RESULT(
      ReadInstructions(/*stop_on_end=*/true, read_end_, &final_opcode));
  ERROR_UNLESS(state_.offset <= read_end_,
               "init expression longer than given size");
  ERROR_UNLESS(final_opcode == Opcode::End,
               "init expression must end with END opcode");
  return Result::Ok;
}

Result BinaryReader::ReadTable(Type* out_elem_type, Limits* out_elem_limits) {
+2 −0
Original line number Diff line number Diff line
@@ -21,8 +21,10 @@
#include "wabt/common.h"

#if _WIN32
#if HAVE_WIN32_VT100
#include <io.h>
#include <windows.h>
#endif
#elif HAVE_UNISTD_H
#include <unistd.h>
#endif
Loading