commit | 981fc59d7836c7e8e4530beef5ab360ac86a4daf | [log] [tgz] |
---|---|---|
author | Jooyung Han <jooyung@google.com> | Sat Nov 06 20:24:45 2021 +0900 |
committer | Jooyung Han <jooyung@google.com> | Mon Nov 08 13:53:27 2021 +0900 |
tree | da37453ad987a399847d2d163fd68e50d57b3013 | |
parent | fa41b533a960a409f8c20d82b4a0fbcac94bbaf3 [diff] |
fix `byte[]` with negative values (C++/NDK) In C++/NDK backends, byte[] is mapped to vector<uint8_t> while byte alone is mapped to int8_t. When byte[]'s default value has negative elements, resulting code won't compile without extra casting. For example, while `byte[] a = {-1}` is perfectly valid, the C++ output was `vector<uint8_t> a = {-1}`, which is an error. Now, those negative values are casted to uint8_t when necessary. This is fine because of how C++ casting(static_cast) works. As a side-effect of this fix, C++ backend now doesn't emit extra value casting (e.g. previously, `int32_t n = int32_t(1);`, but now it's just `int32_t n = 1;`). Bug: 204116012 Test: m (no regression) Test: aidl_unittests Merged-In: I9bbe9b4e6109502f182fc40bf1dc721ea9738971 Change-Id: I9bbe9b4e6109502f182fc40bf1dc721ea9738971 (cherry picked from commit a96a1090478a3fec8f4db9a2b423c514b4a40b3c)
Documentation for this project is currently maintained here:
https://source.android.com/devices/architecture/aidl/overview