summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-20 01:43:28 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-20 01:43:28 +0300
commit8e7bb25493113cf0ac550acac4634a08f8182cb8 (patch)
treebb506e8a39bdafa271d1d1732f131e88aa2ebba2
parent41959b08b3e44e00e7a388451142ee7934f05d2b (diff)
downloadmanaplus-8e7bb25493113cf0ac550acac4634a08f8182cb8.tar.gz
manaplus-8e7bb25493113cf0ac550acac4634a08f8182cb8.tar.bz2
manaplus-8e7bb25493113cf0ac550acac4634a08f8182cb8.tar.xz
manaplus-8e7bb25493113cf0ac550acac4634a08f8182cb8.zip
Add some warnings ignores in mumblemanager for gcc 8+.
-rw-r--r--src/localconsts.h6
-rw-r--r--src/mumblemanager.cpp15
2 files changed, 21 insertions, 0 deletions
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