diff options
| author | 2016-09-26 13:48:02 -0700 | |
|---|---|---|
| committer | 2016-09-29 23:36:08 +0000 | |
| commit | 97b64dbe717b7daf29962f44c1b621c633473556 (patch) | |
| tree | 8460eccb36a66e610a4545b892450872a518e620 | |
| parent | 991667ba8c77631010d34f9a2e2e70f0d97964a4 (diff) | |
Fix weak vtable warnings
Move virtual destructors into cpp file so that the compiler knows which
translation unit to put the vtable into. Hide the warning for
DeathRecipient, which has no virtual methods to move. The warnings were
being hidden by the use of -isystem to include
frameworks/native/include.
Bug: 31752268
Test: m -j
Change-Id: I25329d66bfc1f6a5064d05ce7d12ad9b090601f8
| -rw-r--r-- | include/binder/IBinder.h | 12 | ||||
| -rw-r--r-- | include/binder/Parcel.h | 11 | ||||
| -rw-r--r-- | include/binder/Parcelable.h | 9 | ||||
| -rw-r--r-- | include/gui/IConsumerListener.h | 2 | ||||
| -rw-r--r-- | include/gui/IProducerListener.h | 3 | ||||
| -rw-r--r-- | libs/gui/IConsumerListener.cpp | 1 | ||||
| -rw-r--r-- | libs/gui/IProducerListener.cpp | 4 |
7 files changed, 40 insertions, 2 deletions
diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h index 5f1e87cd5e..9097cb3bb9 100644 --- a/include/binder/IBinder.h +++ b/include/binder/IBinder.h @@ -90,12 +90,24 @@ public: Parcel* reply, uint32_t flags = 0) = 0; + // DeathRecipient is pure abstract, there is no virtual method + // implementation to put in a translation unit in order to silence the + // weak vtables warning. + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wweak-vtables" + #endif + class DeathRecipient : public virtual RefBase { public: virtual void binderDied(const wp<IBinder>& who) = 0; }; + #if defined(__clang__) + #pragma clang diagnostic pop + #endif + /** * Register the @a recipient for a notification if this binder * goes away. If this binder object unexpectedly goes away diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 14fd002af3..74e75d74fc 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -463,6 +463,11 @@ private: bool mMutable; }; + #if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wweak-vtables" + #endif + class FlattenableHelperInterface { protected: ~FlattenableHelperInterface() { } @@ -473,12 +478,18 @@ private: virtual status_t unflatten(void const* buffer, size_t size, int const* fds, size_t count) = 0; }; + #if defined(__clang__) + #pragma clang diagnostic pop + #endif + template<typename T> class FlattenableHelper : public FlattenableHelperInterface { friend class Parcel; const Flattenable<T>& val; explicit FlattenableHelper(const Flattenable<T>& _val) : val(_val) { } + protected: + ~FlattenableHelper() = default; public: virtual size_t getFlattenedSize() const { return val.getFlattenedSize(); diff --git a/include/binder/Parcelable.h b/include/binder/Parcelable.h index faf0d34e9f..d5b57ac587 100644 --- a/include/binder/Parcelable.h +++ b/include/binder/Parcelable.h @@ -26,6 +26,11 @@ namespace android { class Parcel; +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#endif + // Abstract interface of all parcelables. class Parcelable { public: @@ -46,6 +51,10 @@ public: virtual status_t readFromParcel(const Parcel* parcel) = 0; }; // class Parcelable +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + } // namespace android #endif // ANDROID_PARCELABLE_H diff --git a/include/gui/IConsumerListener.h b/include/gui/IConsumerListener.h index e428371538..aef076cbd2 100644 --- a/include/gui/IConsumerListener.h +++ b/include/gui/IConsumerListener.h @@ -39,7 +39,7 @@ class BufferItem; class ConsumerListener : public virtual RefBase { public: ConsumerListener() { } - virtual ~ConsumerListener() { } + virtual ~ConsumerListener(); // onFrameAvailable is called from queueBuffer each time an additional // frame becomes available for consumption. This means that frames that diff --git a/include/gui/IProducerListener.h b/include/gui/IProducerListener.h index 3848a6c850..4a5ed46891 100644 --- a/include/gui/IProducerListener.h +++ b/include/gui/IProducerListener.h @@ -33,7 +33,7 @@ class ProducerListener : public virtual RefBase { public: ProducerListener() {} - virtual ~ProducerListener() {} + virtual ~ProducerListener(); // onBufferReleased is called from IGraphicBufferConsumer::releaseBuffer to // notify the producer that a new buffer is free and ready to be dequeued. @@ -59,6 +59,7 @@ public: class DummyProducerListener : public BnProducerListener { public: + virtual ~DummyProducerListener(); virtual void onBufferReleased() {} }; diff --git a/libs/gui/IConsumerListener.cpp b/libs/gui/IConsumerListener.cpp index 9a0b7a4368..4382ee8b26 100644 --- a/libs/gui/IConsumerListener.cpp +++ b/libs/gui/IConsumerListener.cpp @@ -92,6 +92,7 @@ status_t BnConsumerListener::onTransact( return BBinder::onTransact(code, data, reply, flags); } +ConsumerListener::~ConsumerListener() = default; // --------------------------------------------------------------------------- }; // namespace android diff --git a/libs/gui/IProducerListener.cpp b/libs/gui/IProducerListener.cpp index 9d18ea23a1..855a4885cf 100644 --- a/libs/gui/IProducerListener.cpp +++ b/libs/gui/IProducerListener.cpp @@ -56,4 +56,8 @@ status_t BnProducerListener::onTransact(uint32_t code, const Parcel& data, return BBinder::onTransact(code, data, reply, flags); } +ProducerListener::~ProducerListener() = default; + +DummyProducerListener::~DummyProducerListener() = default; + } // namespace android |