fix problems caused by using different kinds of compilers.
authorjiseob.jang <jiseob.jang@samsung.com>
Thu, 1 Feb 2018 07:30:32 +0000 (16:30 +0900)
committerjiseob.jang <jiseob.jang@samsung.com>
Tue, 20 Mar 2018 08:43:38 +0000 (17:43 +0900)
* problems
- Taking address of temporary array
- Calling an class's methods within a lambda function
- Non initializing constant value
An static constant variable in the class is called by static_assert in the constructor before it makes to a constant expression by static constant initialization.
- Missing noexcept Keyword
- Non-trivial designated initializers not supported

Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
16 files changed:
experiments/android_nn/nn/depend/hal/hardware/neuralnetworks/1.0/DeviceAll.cpp
experiments/android_nn/nn/depend/hal/hardware/neuralnetworks/1.0/ExecutionCallbackAll.cpp
experiments/android_nn/nn/depend/hal/hardware/neuralnetworks/1.0/PreparedModelAll.cpp
experiments/android_nn/nn/depend/hal/hardware/neuralnetworks/1.0/PreparedModelCallbackAll.cpp
experiments/android_nn/nn/depend/hal/hidl/allocator/1.0/AllocatorAll.cpp
experiments/android_nn/nn/depend/hal/hidl/base/1.0/BaseAll.cpp
experiments/android_nn/nn/depend/hal/hidl/manager/1.0/ServiceManagerAll.cpp
experiments/android_nn/nn/depend/hal/hidl/manager/1.0/ServiceNotificationAll.cpp
experiments/android_nn/nn/depend/hal/hidl/manager/1.1/ServiceManagerAll.cpp
experiments/android_nn/nn/depend/hal/hidl/memory/1.0/MapperAll.cpp
experiments/android_nn/nn/depend/hal/hidl/memory/1.0/MemoryAll.cpp
experiments/android_nn/nn/depend/libhidl/base/HidlSupport.cpp
experiments/android_nn/nn/depend/libhidl/base/include/hidl/HidlSupport.h
experiments/android_nn/nn/depend/libhidl/transport/ServiceManagement.cpp
experiments/android_nn/nn/depend/libhwbinder/IPCThreadState.cpp
experiments/android_nn/nn/runtime/ExecutionBuilder.cpp

index 25a6cf5..65129da 100644 (file)
@@ -67,8 +67,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IDevice::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){147,235,55,87,206,175,33,89,15,164,205,29,74,125,254,59,55,148,175,83,150,16,10,109,37,99,8,121,53,42,188,233} /* 93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){147,235,55,87,206,175,33,89,15,164,205,29,74,125,254,59,55,148,175,83,150,16,10,109,37,99,8,121,53,42,188,233}) /* 93eb3757ceaf21590fa4cd1d4a7dfe3b3794af5396100a6d25630879352abce9 */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index e2c306f..f7f8e52 100644 (file)
@@ -64,8 +64,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IExecutionCallback::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){246,111,154,56,84,27,249,32,1,211,173,204,230,120,205,126,61,162,38,33,36,190,251,70,11,28,154,234,148,146,129,59} /* f66f9a38541bf92001d3adcce678cd7e3da2262124befb460b1c9aea9492813b */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){246,111,154,56,84,27,249,32,1,211,173,204,230,120,205,126,61,162,38,33,36,190,251,70,11,28,154,234,148,146,129,59}) /* f66f9a38541bf92001d3adcce678cd7e3da2262124befb460b1c9aea9492813b */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index affd197..6593ad1 100644 (file)
@@ -64,8 +64,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IPreparedModel::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){149,54,7,130,41,84,67,88,116,244,184,22,134,68,10,96,78,42,136,205,210,217,22,76,98,147,243,213,119,37,16,215} /* 953607822954435874f4b81686440a604e2a88cdd2d9164c6293f3d5772510d7 */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){149,54,7,130,41,84,67,88,116,244,184,22,134,68,10,96,78,42,136,205,210,217,22,76,98,147,243,213,119,37,16,215}) /* 953607822954435874f4b81686440a604e2a88cdd2d9164c6293f3d5772510d7 */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 1fd25f2..4ad6ce1 100644 (file)
@@ -64,8 +64,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IPreparedModelCallback::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){115,224,53,115,73,75,169,111,14,113,26,183,241,149,108,91,45,84,195,218,105,12,215,236,244,214,208,242,135,68,119,48} /* 73e03573494ba96f0e711ab7f1956c5b2d54c3da690cd7ecf4d6d0f287447730 */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){115,224,53,115,73,75,169,111,14,113,26,183,241,149,108,91,45,84,195,218,105,12,215,236,244,214,208,242,135,68,119,48}) /* 73e03573494ba96f0e711ab7f1956c5b2d54c3da690cd7ecf4d6d0f287447730 */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 79a813a..d343326 100644 (file)
@@ -65,8 +65,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IAllocator::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){252,108,187,200,162,46,218,189,75,88,248,148,158,89,19,89,211,19,141,22,168,37,6,5,46,37,172,67,225,219,218,104} /* fc6cbbc8a22edabd4b58f8949e591359d3138d16a82506052e25ac43e1dbda68 */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){252,108,187,200,162,46,218,189,75,88,248,148,158,89,19,89,211,19,141,22,168,37,6,5,46,37,172,67,225,219,218,104}) /* fc6cbbc8a22edabd4b58f8949e591359d3138d16a82506052e25ac43e1dbda68 */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 3a77fef..f610ded 100644 (file)
@@ -59,7 +59,7 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IBase::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 24cad95..0b6b6ec 100644 (file)
@@ -263,8 +263,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IServiceManager::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){77,4,106,89,142,133,241,194,211,131,195,169,9,108,60,5,120,233,116,88,7,46,231,230,127,112,78,153,213,251,13,63} /* 4d046a598e85f1c2d383c3a9096c3c0578e97458072ee7e67f704e99d5fb0d3f */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){77,4,106,89,142,133,241,194,211,131,195,169,9,108,60,5,120,233,116,88,7,46,231,230,127,112,78,153,213,251,13,63}) /* 4d046a598e85f1c2d383c3a9096c3c0578e97458072ee7e67f704e99d5fb0d3f */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index c175028..8615208 100644 (file)
@@ -64,8 +64,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IServiceNotification::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){80,85,43,112,14,246,124,126,216,200,215,118,211,35,248,198,41,169,180,59,150,94,16,169,22,166,111,60,148,108,80,251} /* 50552b700ef67c7ed8c8d776d323f8c629a9b43b965e10a916a66f3c946c50fb */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){80,85,43,112,14,246,124,126,216,200,215,118,211,35,248,198,41,169,180,59,150,94,16,169,22,166,111,60,148,108,80,251}) /* 50552b700ef67c7ed8c8d776d323f8c629a9b43b965e10a916a66f3c946c50fb */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index f5c2f12..85c8624 100644 (file)
@@ -76,9 +76,9 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IServiceManager::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){11,148,220,135,111,116,158,210,74,152,246,28,65,212,106,215,90,39,81,17,99,241,150,138,8,66,19,163,60,104,78,246} /* 0b94dc876f749ed24a98f61c41d46ad75a27511163f1968a084213a33c684ef6 */,
-        (uint8_t[32]){77,4,106,89,142,133,241,194,211,131,195,169,9,108,60,5,120,233,116,88,7,46,231,230,127,112,78,153,213,251,13,63} /* 4d046a598e85f1c2d383c3a9096c3c0578e97458072ee7e67f704e99d5fb0d3f */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){11,148,220,135,111,116,158,210,74,152,246,28,65,212,106,215,90,39,81,17,99,241,150,138,8,66,19,163,60,104,78,246}) /* 0b94dc876f749ed24a98f61c41d46ad75a27511163f1968a084213a33c684ef6 */,
+        std::move((uint8_t[32]){77,4,106,89,142,133,241,194,211,131,195,169,9,108,60,5,120,233,116,88,7,46,231,230,127,112,78,153,213,251,13,63}) /* 4d046a598e85f1c2d383c3a9096c3c0578e97458072ee7e67f704e99d5fb0d3f */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 6692980..0891d7a 100644 (file)
@@ -64,8 +64,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IMapper::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){43,136,91,93,236,151,57,28,130,243,94,100,24,6,134,220,76,143,120,178,176,160,23,50,248,83,99,133,101,79,39,200} /* 2b885b5dec97391c82f35e64180686dc4c8f78b2b0a01732f8536385654f27c8 */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){43,136,91,93,236,151,57,28,130,243,94,100,24,6,134,220,76,143,120,178,176,160,23,50,248,83,99,133,101,79,39,200}) /* 2b885b5dec97391c82f35e64180686dc4c8f78b2b0a01732f8536385654f27c8 */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 2ec3076..0358a11 100644 (file)
@@ -70,8 +70,8 @@ __attribute__((destructor))static void static_destructor() {
 
 ::android::hardware::Return<void> IMemory::getHashChain(getHashChain_cb _hidl_cb){
     _hidl_cb({
-        (uint8_t[32]){70,50,36,96,23,1,62,117,83,111,166,238,71,219,40,107,36,163,35,251,146,195,124,107,20,187,10,183,150,183,161,107} /* 4632246017013e75536fa6ee47db286b24a323fb92c37c6b14bb0ab796b7a16b */,
-        (uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217} /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
+        std::move((uint8_t[32]){70,50,36,96,23,1,62,117,83,111,166,238,71,219,40,107,36,163,35,251,146,195,124,107,20,187,10,183,150,183,161,107}) /* 4632246017013e75536fa6ee47db286b24a323fb92c37c6b14bb0ab796b7a16b */,
+        std::move((uint8_t[32]){189,218,182,24,77,122,52,109,166,160,125,192,130,140,241,154,105,111,76,170,54,17,197,31,46,20,86,90,20,180,15,217}) /* bddab6184d7a346da6a07dc0828cf19a696f4caa3611c51f2e14565a14b40fd9 */});
     return ::android::hardware::Void();
 }
 
index 4de7f7c..6afc1a6 100644 (file)
@@ -56,7 +56,7 @@ hidl_handle::hidl_handle(const hidl_handle &other) {
 }
 
 // move constructor.
-hidl_handle::hidl_handle(hidl_handle &&other) {
+hidl_handle::hidl_handle(hidl_handle &&other) noexcept {
     mOwnsHandle = false;
     *this = std::move(other);
 }
@@ -87,7 +87,7 @@ hidl_handle &hidl_handle::operator=(const native_handle_t *native_handle) {
     return *this;
 }
 
-hidl_handle &hidl_handle::operator=(hidl_handle &&other) {
+hidl_handle &hidl_handle::operator=(hidl_handle &&other) noexcept {
     if (this != &other) {
         freeHandle();
         mHandle = other.mHandle;
@@ -167,11 +167,11 @@ hidl_string::hidl_string(const std::string &s) : hidl_string() {
     copyFrom(s.c_str(), s.size());
 }
 
-hidl_string::hidl_string(hidl_string &&other): hidl_string() {
+hidl_string::hidl_string(hidl_string &&other) noexcept : hidl_string() {
     moveFrom(std::forward<hidl_string>(other));
 }
 
-hidl_string &hidl_string::operator=(hidl_string &&other) {
+hidl_string &hidl_string::operator=(hidl_string &&other) noexcept {
     if (this != &other) {
         clear();
         moveFrom(std::forward<hidl_string>(other));
index f25cdc4..43afd5f 100644 (file)
@@ -465,7 +465,7 @@ struct hidl_vec {
     }
 
     // offsetof(hidl_string, mBuffer) exposed since mBuffer is private.
-    static const size_t kOffsetOfBuffer;
+    static const size_t kOffsetOfBuffer = offsetof(hidl_vec<T>, mBuffer);
 
 private:
     // Define std interator interface for walking the array contents
@@ -535,8 +535,6 @@ private:
     }
 };
 
-template <typename T>
-const size_t hidl_vec<T>::kOffsetOfBuffer = offsetof(hidl_vec<T>, mBuffer);
 
 ////////////////////////////////////////////////////////////////////////////////
 
index 692d778..35b9a59 100644 (file)
@@ -401,6 +401,7 @@ struct PassthroughServiceManager : IServiceManager1_1 {
                         if (!implName.empty()) instanceName += " ("s + implName + ")"s;
                         map.emplace(path + lib, InstanceDebugInfo{.interfaceName = matchedName,
                                                                   .instanceName = instanceName,
+                                                                  .pid = getpid(),
                                                                   .clientPids = {},
                                                                   .arch = arch});
                     }
index 13b18cd..4456da8 100644 (file)
@@ -1076,7 +1076,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
                 reply_sent = true;
                 if ((tr.flags & TF_ONE_WAY) == 0) {
                     replyParcel.setError(NO_ERROR);
-                    sendReply(replyParcel, 0);
+                    this->sendReply(replyParcel, 0);
                 } else {
                     ALOGE("Not sending reply in one-way transaction");
                 }
index 077e068..dd386d2 100644 (file)
@@ -640,8 +640,10 @@ int StepExecutor::startComputeOnCpu(sp<ExecutionCallback>* synchronizationCallba
     auto fixPointerArguments = [&requestPoolInfos](std::vector<ModelArgumentInfo>& argumentInfos) {
         for (ModelArgumentInfo& argumentInfo : argumentInfos) {
             if (argumentInfo.state == ModelArgumentInfo::POINTER) {
-                RunTimePoolInfo runTimeInfo = {
-                            .buffer = static_cast<uint8_t*>(argumentInfo.buffer)};
+                //RunTimePoolInfo runTimeInfo = {
+                //            .buffer = static_cast<uint8_t*>(argumentInfo.buffer)};
+                RunTimePoolInfo runTimeInfo = {};
+                runTimeInfo.buffer = static_cast<uint8_t*>(argumentInfo.buffer);
                 argumentInfo.locationAndLength.poolIndex =
                             static_cast<uint32_t>(requestPoolInfos.size());
                 argumentInfo.locationAndLength.offset = 0;