Fix -Wnontrivial-memcall warning
Memcall functions work at the byte level so they don't know about C++
semantics and these C++ objects might not have trivial
constructors or destructors. I silenced the warning by explicitly
casting the pointer to void* with static_cast for one case. I fixed the
the key_value_pair_t into a trivial type by using the default copy
constructor.
system/core/libutils/include/utils/RefBase.h:728:17: note: explicitly
cast the pointer to silence this warning
728 | memmove(dest, src, n*sizeof(sp<TYPE>));
| ^
| (void*)
system/core/libutils/include/utils/TypeHelpers.h:163:12: error: first
argument in call to 'memcpy' is a pointer to non-trivially copyable type
'android::key_value_pair_t<unsigned int, unsigned long>'
[-Werror,-Wnontrivial-memcall]
163 | memcpy(d,s,n*sizeof(TYPE));
| ^
Bug: 430598176
Test: m & presubmits
Change-Id: Ia1bc978d5d4415336fd19dd971bf142bc6ceeb65
Loading
Please register or sign in to comment