diff options
author | Andreas Huber <andih@google.com> | 2017-04-06 11:09:07 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2017-04-10 14:32:24 -0700 |
commit | 6755e9d6232f8c9451b5d57cfd36be35eeeb16e1 (patch) | |
tree | 978919fcbe815e723315a16fa2c9737f906e45ff /MemoryType.cpp | |
parent | 58b478bbb7e08e306458e1087ae19923d551d4e4 (diff) | |
download | hidl-6755e9d6232f8c9451b5d57cfd36be35eeeb16e1.tar.gz |
Enforce Treble "wire" ABI by emitting static_asserts for the sizes of
hidl types, such as hidl_handle, hidl_memory, hidl_string and friends.
Bug: 33846034
Test: make
Change-Id: I859b5a7185e2c3e59ef5665e8f8c1f5bb34bced3
Diffstat (limited to 'MemoryType.cpp')
-rw-r--r-- | MemoryType.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/MemoryType.cpp b/MemoryType.cpp index 614f3687..f685cfca 100644 --- a/MemoryType.cpp +++ b/MemoryType.cpp @@ -16,6 +16,8 @@ #include "MemoryType.h" +#include "HidlTypeAssertion.h" + #include <hidl-util/Formatter.h> #include <android-base/logging.h> @@ -140,9 +142,10 @@ bool MemoryType::isJavaCompatible() const { return false; } +static HidlTypeAssertion assertion("hidl_memory", 40 /* size */); void MemoryType::getAlignmentAndSize(size_t *align, size_t *size) const { *align = 8; // hidl_memory - *size = 40; + *size = assertion.size(); } status_t MemoryType::emitVtsTypeDeclarations(Formatter &out) const { |