From 8e7bb25493113cf0ac550acac4634a08f8182cb8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 20 Jun 2017 01:43:28 +0300 Subject: Add some warnings ignores in mumblemanager for gcc 8+. --- src/localconsts.h | 6 ++++++ src/mumblemanager.cpp | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/localconsts.h b/src/localconsts.h index 843e694da..ba2905113 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -192,6 +192,12 @@ #define const2 const +#if GCC_VERSION >= 80000 +#define PRAGMA8(str) _Pragma(#str) +#else // GCC_VERSION > 80000 +#define PRAGMA8(str) +#endif // GCC_VERSION > 80000 + #if GCC_VERSION >= 60000 #define PRAGMA6(str) _Pragma(#str) #else // GCC_VERSION > 60000 diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index 27aed89e6..d003cfbbb 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -189,7 +189,10 @@ void MumbleManager::setPlayer(const std::string &userName) // (e.g. the ingame Name). mbstowcs(mLinkedMemCache.identity, userName.c_str(), 256); mLinkedMemCache.uiTick ++; +PRAGMA8(GCC diagnostic push) +PRAGMA8(GCC diagnostic ignored "-Wclass-memaccess") memcpy(mLinkedMem, &mLinkedMemCache, sizeof(mLinkedMemCache)); +PRAGMA8(GCC diagnostic pop) } void MumbleManager::setAction(const int action) @@ -217,7 +220,10 @@ void MumbleManager::setAction(const int action) mLinkedMemCache.fCameraPosition[1] = mLinkedMemCache.fAvatarPosition[1]; mLinkedMemCache.uiTick++; +PRAGMA8(GCC diagnostic push) +PRAGMA8(GCC diagnostic ignored "-Wclass-memaccess") memcpy(mLinkedMem, &mLinkedMemCache, sizeof(mLinkedMemCache)); +PRAGMA8(GCC diagnostic pop) } void MumbleManager::setPos(const int tileX, const int tileY, @@ -267,7 +273,10 @@ void MumbleManager::setPos(const int tileX, const int tileY, } mLinkedMemCache.uiTick ++; +PRAGMA8(GCC diagnostic push) +PRAGMA8(GCC diagnostic ignored "-Wclass-memaccess") memcpy(mLinkedMem, &mLinkedMemCache, sizeof(mLinkedMemCache)); +PRAGMA8(GCC diagnostic pop) } void MumbleManager::setMap(const std::string &mapName) @@ -293,11 +302,17 @@ void MumbleManager::setServer(const std::string &serverName) size = sizeof(mLinkedMemCache.context) - 1; memset(mLinkedMemCache.context, 0, sizeof(mLinkedMemCache.context)); +PRAGMA8(GCC diagnostic push) +PRAGMA8(GCC diagnostic ignored "-Wclass-memaccess") memcpy(mLinkedMemCache.context, serverName.c_str(), size); +PRAGMA8(GCC diagnostic pop) mLinkedMemCache.context[size] = '\0'; mLinkedMemCache.context_len = size; mLinkedMemCache.uiTick ++; +PRAGMA8(GCC diagnostic push) +PRAGMA8(GCC diagnostic ignored "-Wclass-memaccess") memcpy(mLinkedMem, &mLinkedMemCache, sizeof(mLinkedMemCache)); +PRAGMA8(GCC diagnostic pop) } #endif // USE_MUMBLE -- cgit v1.2.3-70-g09d2