Conforms with the exception specification of `std::atomic`
authorAndroid Tools Maintainers <android-tools-devel@lists.alioth.debian.org>
Thu, 13 Oct 2022 18:56:25 +0000 (19:56 +0100)
committerJochen Sprickerhof <jspricke@debian.org>
Thu, 13 Oct 2022 18:56:25 +0000 (19:56 +0100)
Forwarded: not-needed

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 8d8c32ce1635b0c2d2003b5af4a5381ddd8f3ced..358417dd1a4f79858e7646208fff888825bdef6c 100644 (file)
@@ -214,7 +214,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 6067c76e14d780c0e27687fd6638f8c431f60dd9..7f4b6af0e32ee7f67dcdaaa4d430dfe1f73f4479 100644 (file)
@@ -70,7 +70,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;
 
@@ -93,7 +93,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)