Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fa49d22 authored by Sharjeel Khan's avatar Sharjeel Khan
Browse files

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
parent 08531077
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment