From 9f0dc207ce9ae149159cccb21588e1dd6420a9e2 Mon Sep 17 00:00:00 2001 From: Android Tools Maintainers Date: Tue, 5 Apr 2022 12:39:26 +0100 Subject: [PATCH] Conforms with the exception specification of `std::atomic` All constructors of `std::atomic` require `noexcept`. As a result, its members must also be able to instantiate without any exception throwing. Gbp-Pq: Name atomic-exception-specification.patch --- runtime/gc_root.h | 2 +- runtime/mirror/dex_cache.h | 4 ++-- runtime/mirror/object_reference.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/gc_root.h b/runtime/gc_root.h index 32af62d..00d5d90 100644 --- a/runtime/gc_root.h +++ b/runtime/gc_root.h @@ -213,7 +213,7 @@ class GcRoot { return root_.IsNull(); } - ALWAYS_INLINE GcRoot() {} + ALWAYS_INLINE GcRoot() noexcept {} explicit ALWAYS_INLINE GcRoot(MirrorType* ref) REQUIRES_SHARED(Locks::mutator_lock_); explicit ALWAYS_INLINE GcRoot(ObjPtr ref) diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h index b41443e..6b7c2d7 100644 --- a/runtime/mirror/dex_cache.h +++ b/runtime/mirror/dex_cache.h @@ -68,7 +68,7 @@ template struct PACKED(8) DexCachePair { // Set the initial state for the 0th entry to be {0,1} which is guaranteed to fail // the lookup id == stored id branch. DexCachePair(ObjPtr object, uint32_t index); - DexCachePair() : index(0) {} + DexCachePair() noexcept : index(0) {} DexCachePair(const DexCachePair&) = default; DexCachePair& operator=(const DexCachePair&) = default; @@ -91,7 +91,7 @@ template struct PACKED(2 * __SIZEOF_POINTER__) NativeDexCachePair { NativeDexCachePair(T* object, uint32_t index) : object(object), index(index) {} - NativeDexCachePair() : object(nullptr), index(0u) { } + NativeDexCachePair() noexcept : object(nullptr), index(0u) { } NativeDexCachePair(const NativeDexCachePair&) = default; NativeDexCachePair& operator=(const NativeDexCachePair&) = default; diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h index f01bcbd..3d92f91 100644 --- a/runtime/mirror/object_reference.h +++ b/runtime/mirror/object_reference.h @@ -164,7 +164,7 @@ static_assert(sizeof(mirror::HeapReference) == kHeapReferenceSiz template class MANAGED CompressedReference : public mirror::ObjectReference { public: - CompressedReference() REQUIRES_SHARED(Locks::mutator_lock_) + CompressedReference() noexcept REQUIRES_SHARED(Locks::mutator_lock_) : mirror::ObjectReference(nullptr) {} static CompressedReference FromMirrorPtr(MirrorType* p) -- 2.30.2