Suppress aliasing warning in DirDetails and DirStub

Order of serialization doesn't matter ATM as we use those only for
  JSON API.
Those classes should be rewritten anyway with proper naming of the
  memebers and using std::uintptr_t instead of void* and rstime_t for
  timestamps
This commit is contained in:
Gioacchino Mazzurco 2018-10-10 23:32:32 +02:00
parent 047ae7f723
commit b3d73ba6a5
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -277,8 +277,14 @@ struct DirStub : RsSerializable
{
RS_SERIAL_PROCESS(type);
RS_SERIAL_PROCESS(name);
#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif // defined(__GNUC__) && !defined(__clang__)
std::uintptr_t& handle(reinterpret_cast<std::uintptr_t&>(ref));
RS_SERIAL_PROCESS(handle);
#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic pop
#endif // defined(__GNUC__) && !defined(__clang__)
}
};
@ -313,11 +319,17 @@ struct DirDetails : RsSerializable
void serial_process(RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx)
{
std::uintptr_t& parentHandle(reinterpret_cast<std::uintptr_t&>(parent));
RS_SERIAL_PROCESS(parentHandle);
RS_SERIAL_PROCESS(prow);
#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif // defined(__GNUC__) && !defined(__clang__)
std::uintptr_t& handle(reinterpret_cast<std::uintptr_t&>(ref));
RS_SERIAL_PROCESS(handle);
std::uintptr_t& parentHandle(reinterpret_cast<std::uintptr_t&>(parent));
RS_SERIAL_PROCESS(parentHandle);
#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic pop
#endif // defined(__GNUC__) && !defined(__clang__)
RS_SERIAL_PROCESS(prow);
RS_SERIAL_PROCESS(type);
RS_SERIAL_PROCESS(id);
RS_SERIAL_PROCESS(name);