Conforms with the exception specification of `std::atomic`
authorAndroid Tools Maintainers <android-tools-devel@lists.alioth.debian.org>
Fri, 21 Jan 2022 15:26:23 +0000 (15:26 +0000)
committerRoger Shimizu <rosh@debian.org>
Fri, 21 Jan 2022 15:26:23 +0000 (15:26 +0000)
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
runtime/mirror/dex_cache.h
runtime/mirror/object_reference.h

index 32af62d5a5c10aff684ae899cfa3ef72a8f59dfd..00d5d9086216ecfd96f2fc4d539243f27b42ed2b 100644 (file)
@@ -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<MirrorType> ref)
index b41443e5fb75b3a3aa33fd860cfbdcb5192d2b71..6b7c2d798b67fc8409139484db89e7144d94b4c3 100644 (file)
@@ -68,7 +68,7 @@ template <typename T> 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<T> object, uint32_t index);
-  DexCachePair() : index(0) {}
+  DexCachePair() noexcept : index(0) {}
   DexCachePair(const DexCachePair<T>&) = default;
   DexCachePair& operator=(const DexCachePair<T>&) = default;
 
@@ -91,7 +91,7 @@ template <typename T> 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<T>&) = default;
   NativeDexCachePair& operator=(const NativeDexCachePair<T>&) = default;
 
index f01bcbd83ae4b895782cd87d6fe27dc488febc58..3d92f91ae26ad763e7105f0321a038bfa2de30bf 100644 (file)
@@ -164,7 +164,7 @@ static_assert(sizeof(mirror::HeapReference<mirror::Object>) == kHeapReferenceSiz
 template<class MirrorType>
 class MANAGED CompressedReference : public mirror::ObjectReference<false, MirrorType> {
  public:
-  CompressedReference<MirrorType>() REQUIRES_SHARED(Locks::mutator_lock_)
+  CompressedReference<MirrorType>() noexcept REQUIRES_SHARED(Locks::mutator_lock_)
       : mirror::ObjectReference<false, MirrorType>(nullptr) {}
 
   static CompressedReference<MirrorType> FromMirrorPtr(MirrorType* p)