Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97b64dbe authored by Colin Cross's avatar Colin Cross
Browse files

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
parent 991667ba
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -90,12 +90,24 @@ public:
                                        Parcel* reply,
                                        Parcel* reply,
                                        uint32_t flags = 0) = 0;
                                        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
    class DeathRecipient : public virtual RefBase
    {
    {
    public:
    public:
        virtual void binderDied(const wp<IBinder>& who) = 0;
        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
     * Register the @a recipient for a notification if this binder
     * goes away.  If this binder object unexpectedly goes away
     * goes away.  If this binder object unexpectedly goes away
+11 −0
Original line number Original line Diff line number Diff line
@@ -463,6 +463,11 @@ private:
        bool mMutable;
        bool mMutable;
    };
    };


    #if defined(__clang__)
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wweak-vtables"
    #endif

    class FlattenableHelperInterface {
    class FlattenableHelperInterface {
    protected:
    protected:
        ~FlattenableHelperInterface() { }
        ~FlattenableHelperInterface() { }
@@ -473,12 +478,18 @@ private:
        virtual status_t unflatten(void const* buffer, size_t size, int const* fds, size_t count) = 0;
        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>
    template<typename T>
    class FlattenableHelper : public FlattenableHelperInterface {
    class FlattenableHelper : public FlattenableHelperInterface {
        friend class Parcel;
        friend class Parcel;
        const Flattenable<T>& val;
        const Flattenable<T>& val;
        explicit FlattenableHelper(const Flattenable<T>& _val) : val(_val) { }
        explicit FlattenableHelper(const Flattenable<T>& _val) : val(_val) { }


    protected:
        ~FlattenableHelper() = default;
    public:
    public:
        virtual size_t getFlattenedSize() const {
        virtual size_t getFlattenedSize() const {
            return val.getFlattenedSize();
            return val.getFlattenedSize();
+9 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,11 @@ namespace android {


class Parcel;
class Parcel;


#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wweak-vtables"
#endif

// Abstract interface of all parcelables.
// Abstract interface of all parcelables.
class Parcelable {
class Parcelable {
public:
public:
@@ -46,6 +51,10 @@ public:
    virtual status_t readFromParcel(const Parcel* parcel) = 0;
    virtual status_t readFromParcel(const Parcel* parcel) = 0;
};  // class Parcelable
};  // class Parcelable


#if defined(__clang__)
#pragma clang diagnostic pop
#endif

}  // namespace android
}  // namespace android


#endif // ANDROID_PARCELABLE_H
#endif // ANDROID_PARCELABLE_H
+1 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,7 @@ class BufferItem;
class ConsumerListener : public virtual RefBase {
class ConsumerListener : public virtual RefBase {
public:
public:
    ConsumerListener() { }
    ConsumerListener() { }
    virtual ~ConsumerListener() { }
    virtual ~ConsumerListener();


    // onFrameAvailable is called from queueBuffer each time an additional
    // onFrameAvailable is called from queueBuffer each time an additional
    // frame becomes available for consumption. This means that frames that
    // frame becomes available for consumption. This means that frames that
+2 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ class ProducerListener : public virtual RefBase
{
{
public:
public:
    ProducerListener() {}
    ProducerListener() {}
    virtual ~ProducerListener() {}
    virtual ~ProducerListener();


    // onBufferReleased is called from IGraphicBufferConsumer::releaseBuffer to
    // onBufferReleased is called from IGraphicBufferConsumer::releaseBuffer to
    // notify the producer that a new buffer is free and ready to be dequeued.
    // notify the producer that a new buffer is free and ready to be dequeued.
@@ -59,6 +59,7 @@ public:
class DummyProducerListener : public BnProducerListener
class DummyProducerListener : public BnProducerListener
{
{
public:
public:
    virtual ~DummyProducerListener();
    virtual void onBufferReleased() {}
    virtual void onBufferReleased() {}
};
};


Loading