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

Commit 9a47361e 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. I did this fix because I
assume the code developer knows the consequences with using memcall
functions with C++ objects.

frameworks/base/libs/androidfw/include/androidfw/ConfigDescription.h:153:10:
error: first argument in call to 'memset' is a pointer to non-trivially
copyable type 'android::ConfigDescription'
[-Werror,-Wnontrivial-memcall]
  153 |   memset(this, 0, sizeof(*this));
      |          ^

Flag: EXEMPT bugfix
Bug: 430598176
Test: m && presubmits
Change-Id: I64df06fcd9267914a65c6cb3a3ae7708b41b33bd
parent e22d9d10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ struct ConfigDescription : public ResTable_config {
};

inline ConfigDescription::ConfigDescription() {
  memset(this, 0, sizeof(*this));
  memset(static_cast<void*>(this), 0, sizeof(*this));
  size = sizeof(android::ResTable_config);
}