From b3d73ba6a5df388caf2ef8cd879067348009945a Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 10 Oct 2018 23:32:32 +0200 Subject: [PATCH] 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 --- libretroshare/src/retroshare/rstypes.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/retroshare/rstypes.h b/libretroshare/src/retroshare/rstypes.h index 4991292e4..137939fc8 100644 --- a/libretroshare/src/retroshare/rstypes.h +++ b/libretroshare/src/retroshare/rstypes.h @@ -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(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(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(ref)); RS_SERIAL_PROCESS(handle); + std::uintptr_t& parentHandle(reinterpret_cast(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);