[vm] Assert only that intptr_t is big enough for ThreadId, not exactly the same.
On Fuchsia, ThreadId is a zx_handle_t/int32_t.
TEST=ci
Change-Id: I457064e51f14aba7faff5ab62bfebeb644f0b0eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288547
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
diff --git a/runtime/vm/os_thread_absl.cc b/runtime/vm/os_thread_absl.cc
index d442ec3..8968b07 100644
--- a/runtime/vm/os_thread_absl.cc
+++ b/runtime/vm/os_thread_absl.cc
@@ -264,7 +264,7 @@
}
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
- ASSERT(sizeof(id) == sizeof(intptr_t));
+ COMPILE_ASSERT(sizeof(id) <= sizeof(intptr_t));
#if defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_LINUX)
return static_cast<intptr_t>(id);
#elif defined(DART_HOST_OS_MACOS)
diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc
index 5ab93e3..176c25f 100644
--- a/runtime/vm/os_thread_android.cc
+++ b/runtime/vm/os_thread_android.cc
@@ -244,7 +244,7 @@
}
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
- ASSERT(sizeof(id) <= sizeof(intptr_t));
+ COMPILE_ASSERT(sizeof(id) <= sizeof(intptr_t));
return static_cast<intptr_t>(id);
}
diff --git a/runtime/vm/os_thread_fuchsia.cc b/runtime/vm/os_thread_fuchsia.cc
index 85822821..2cd616c 100644
--- a/runtime/vm/os_thread_fuchsia.cc
+++ b/runtime/vm/os_thread_fuchsia.cc
@@ -201,7 +201,7 @@
}
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
- ASSERT(sizeof(id) == sizeof(intptr_t));
+ COMPILE_ASSERT(sizeof(id) <= sizeof(intptr_t));
return static_cast<intptr_t>(id);
}
diff --git a/runtime/vm/os_thread_linux.cc b/runtime/vm/os_thread_linux.cc
index 3ab0366..63d077e 100644
--- a/runtime/vm/os_thread_linux.cc
+++ b/runtime/vm/os_thread_linux.cc
@@ -244,7 +244,7 @@
}
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
- ASSERT(sizeof(id) == sizeof(intptr_t));
+ COMPILE_ASSERT(sizeof(id) <= sizeof(intptr_t));
return static_cast<intptr_t>(id);
}
diff --git a/runtime/vm/os_thread_macos.cc b/runtime/vm/os_thread_macos.cc
index fa1ce61..a62dab1 100644
--- a/runtime/vm/os_thread_macos.cc
+++ b/runtime/vm/os_thread_macos.cc
@@ -226,7 +226,7 @@
}
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
- ASSERT(sizeof(id) == sizeof(intptr_t));
+ COMPILE_ASSERT(sizeof(id) <= sizeof(intptr_t));
return reinterpret_cast<intptr_t>(id);
}
diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc
index c35c84d..4e3473e 100644
--- a/runtime/vm/os_thread_win.cc
+++ b/runtime/vm/os_thread_win.cc
@@ -165,7 +165,7 @@
}
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
- ASSERT(sizeof(id) <= sizeof(intptr_t));
+ COMPILE_ASSERT(sizeof(id) <= sizeof(intptr_t));
return static_cast<intptr_t>(id);
}