Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 32-bit build fails on non-size_t based size assertions #1289

Merged
merged 1 commit into from
Jul 27, 2023
Merged
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
22 changes: 12 additions & 10 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ static_assert(sizeof(v8::ReturnValue<v8::Value>) == sizeof(size_t) * 1,
static_assert(sizeof(v8::TryCatch) == sizeof(size_t) * 6,
"TryCatch size mismatch");

static_assert(sizeof(v8::Isolate::DisallowJavascriptExecutionScope) ==
sizeof(size_t) * 2,
"DisallowJavascriptExecutionScope size mismatch");

static_assert(sizeof(v8::Isolate::AllowJavascriptExecutionScope) ==
sizeof(size_t) * 2,
"AllowJavascriptExecutionScope size mismatch");
Expand Down Expand Up @@ -96,6 +92,9 @@ static_assert(offsetof(v8::ScriptCompiler::CachedData, rejected) == 12,
"CachedData.rejected offset mismatch");
static_assert(offsetof(v8::ScriptCompiler::CachedData, buffer_policy) == 16,
"CachedData.buffer_policy offset mismatch");
static_assert(sizeof(v8::Isolate::DisallowJavascriptExecutionScope) ==
16,
"DisallowJavascriptExecutionScope size mismatch");
#else
static_assert(sizeof(v8::ScriptCompiler::CachedData) == 16,
"CachedData size mismatch");
Expand All @@ -107,6 +106,9 @@ static_assert(offsetof(v8::ScriptCompiler::CachedData, rejected) == 8,
"CachedData.rejected offset mismatch");
static_assert(offsetof(v8::ScriptCompiler::CachedData, buffer_policy) == 12,
"CachedData.buffer_policy offset mismatch");
static_assert(sizeof(v8::Isolate::DisallowJavascriptExecutionScope) ==
12,
"DisallowJavascriptExecutionScope size mismatch");
#endif

extern "C" {
Expand Down Expand Up @@ -1030,12 +1032,12 @@ class ExternalConstOneByteStringResource
public:
ExternalConstOneByteStringResource(int length)
: _length(length) {
static_assert(offsetof(ExternalConstOneByteStringResource, _length) == 16,
"ExternalConstOneByteStringResource's length was not at offset 16");
static_assert(sizeof(ExternalConstOneByteStringResource) == 24,
"ExternalConstOneByteStringResource size was not 24");
static_assert(alignof(ExternalConstOneByteStringResource) == 8,
"ExternalConstOneByteStringResource align was not 8");
static_assert(offsetof(ExternalConstOneByteStringResource, _length) == sizeof(size_t) * 2,
"ExternalConstOneByteStringResource's length was not at offset of sizeof(size_t) * 2");
static_assert(sizeof(ExternalConstOneByteStringResource) == sizeof(size_t) * 3,
"ExternalConstOneByteStringResource size was not sizeof(size_t) * 3");
static_assert(alignof(ExternalConstOneByteStringResource) == sizeof(size_t),
"ExternalConstOneByteStringResource align was not sizeof(size_t)");
}
const char* data() const override { return nullptr; }
size_t length() const override { return _length; }
Expand Down
Loading