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
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 14fd002..74e75d7 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -463,6 +463,11 @@
bool mMutable;
};
+ #if defined(__clang__)
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wweak-vtables"
+ #endif
+
class FlattenableHelperInterface {
protected:
~FlattenableHelperInterface() { }
@@ -473,12 +478,18 @@
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();