[vm] Fix gcc build.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46748
Change-Id: I21807884d974a918adf2aec91f2e2a8d06504776
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
diff --git a/runtime/vm/elf.cc b/runtime/vm/elf.cc
index 12210a4..a4f550f 100644
--- a/runtime/vm/elf.cc
+++ b/runtime/vm/elf.cc
@@ -228,7 +228,7 @@
private:
static intptr_t EncodeFlags(bool allocate, bool executable, bool writable) {
// Executable and writable only make sense if this is an allocated section.
- ASSERT(allocate || !executable && !writable);
+ ASSERT(allocate || (!executable && !writable));
if (!allocate) return 0;
intptr_t flags = elf::SHF_ALLOC;
// We currently don't allow sections that are both executable and writable.
diff --git a/runtime/vm/object_graph_copy.cc b/runtime/vm/object_graph_copy.cc
index e22b3e6..7b9189f 100644
--- a/runtime/vm/object_graph_copy.cc
+++ b/runtime/vm/object_graph_copy.cc
@@ -115,7 +115,7 @@
};
struct HandleTypes {
- using Object = const Object&;
+ using Object = const dart::Object&;
static const dart::UntaggedObject* UntagObject(Object arg) {
return arg.ptr().untag();
}
@@ -123,7 +123,7 @@
static Object HandlifyObject(Object arg) { return arg; }
#define DO(V) \
- using V = const V&; \
+ using V = const dart::V&; \
static Untagged##V* Untag##V(V arg) { return arg.ptr().untag(); } \
static V##Ptr Get##V##Ptr(V arg) { return arg.ptr(); } \
static V Cast##V(const dart::Object& arg) { return dart::V::Cast(arg); }
@@ -1451,7 +1451,7 @@
// Result will be [<msg>, <objects-in-msg-to-rehash>]
ObjectPtr CopyObjectGraph(const Object& root) {
- const char* exception_msg = nullptr;
+ const char* volatile exception_msg = nullptr;
auto& result = Object::Handle(zone_);
{
@@ -1491,7 +1491,7 @@
private:
ObjectPtr CopyObjectGraphInternal(const Object& root,
- const char** exception_msg) {
+ const char* volatile* exception_msg) {
const auto& result_array = Array::Handle(zone_, Array::New(2));
if (!root.ptr()->IsHeapObject()) {
result_array.SetAt(0, root);
@@ -1590,7 +1590,8 @@
const intptr_t size = UntaggedObject::SizeTag::decode(tags);
// External typed data is already initialized.
if (!IsExternalTypedDataClassId(cid) && !IsTypedDataViewClassId(cid)) {
- memset(to.untag(), 0x0, from.untag()->HeapSize());
+ memset(reinterpret_cast<void*>(to.untag()), 0,
+ from.untag()->HeapSize());
SetNewSpaceTaggingWord(to, cid, size);
UpdateLengthField(cid, from, to);
}
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index dbc59c7..47e7abc 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -91,7 +91,20 @@
return Error::null();
}
-ObjectStore::ObjectStore() {
+ObjectStore::ObjectStore()
+ :
+#define EMIT_FIELD_INIT(type, name) name##_(nullptr),
+ OBJECT_STORE_FIELD_LIST(EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT,
+ EMIT_FIELD_INIT)
+#undef EMIT_FIELD_INIT
+ unused_field_(0) // Just to prevent a trailing comma.
+{
for (ObjectPtr* current = from(); current <= to(); current++) {
*current = Object::null();
}
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 8148bc2..64dabde 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -543,6 +543,7 @@
UNREACHABLE();
return NULL;
}
+ uword unused_field_;
friend class ProgramSerializationRoots;
friend class ProgramDeserializationRoots;