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/tools/bit/util.cpp:28:12: error: first argument in call
to 'memset' is a pointer to non-trivially copyable type 'FileInfo'
[-Werror,-Wnontrivial-memcall]
28 | memset(this, 0, sizeof(FileInfo));
| ^
frameworks/base/tools/bit/util.cpp:33:12: error: first argument in call
to 'memcpy' is a pointer to non-trivially copyable type 'FileInfo'
[-Werror,-Wnontrivial-memcall]
33 | memcpy(this, &that, sizeof(FileInfo));
| ^
frameworks/base/tools/bit/util.cpp:41:16: error: first argument in call
to 'memset' is a pointer to non-trivially copyable type 'FileInfo'
[-Werror,-Wnontrivial-memcall]
41 | memset(this, 0, sizeof(FileInfo));
| ^
Flag: EXEMPT warning fix
Bug: 430598176
Test: m && presubmits
Change-Id: I3620b46ecf194719f12169e23735b73b0717d9a1
Loading
Please register or sign in to comment