From a1a9ce04eeefb5ff00b2101732ef3f5e02d36093 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 8 Aug 2017 23:17:14 +0300 Subject: Disable warning -Wdiscarded-qualifiers in hpm code for now. --- src/common/cbasetypes.h | 7 +++++++ src/plugins/HPMHooking.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 2c36c23bc..5be2d62e4 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -306,6 +306,13 @@ typedef uintptr_t uintptr; #define PRAGMA_GCC46(str) #endif // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40600) +// Pragma macro only enabled on gcc >= 5 or clang - borrowed from Mana Plus +#if defined(__GNUC__) && (GCC_VERSION >= 50000) +#define PRAGMA_GCC5(str) _Pragma(#str) +#else // ! defined(__GNUC__) && (GCC_VERSION >= 50000) +#define PRAGMA_GCC5(str) +#endif // ! defined(__GNUC__) && (GCC_VERSION >= 50000) + // fallthrough attribute only enabled on gcc >= 7.0 #if defined(__GNUC__) && (GCC_VERSION >= 70000) #define FALLTHROUGH __attribute__ ((fallthrough)); diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index a5354211d..6d6184402 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -26,6 +26,8 @@ #include "common/mmo.h" #include "common/socket.h" +PRAGMA_GCC5(GCC diagnostic push) +PRAGMA_GCC5(GCC diagnostic ignored "-Wdiscarded-qualifiers") #if defined (HPMHOOKING_LOGIN) #define HPM_SERVER_TYPE SERVER_TYPE_LOGIN #define HPM_CORE_INCLUDE "HPMHooking/HPMHooking_login.HPMHooksCore.inc" @@ -109,6 +111,7 @@ #define HPM_SOURCES_INCLUDE "HPMHooking/HPMHooking.sources.inc" #error HPMHooking plugin needs to be compiled for a specific server type. Please make sure your Makefiles are up to date. #endif +PRAGMA_GCC5(GCC diagnostic pop) #include "common/conf.h" #include "common/console.h" #include "common/db.h" @@ -212,7 +215,10 @@ HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target, return false; } +PRAGMA_GCC5(GCC diagnostic push) +PRAGMA_GCC5(GCC diagnostic ignored "-Wdiscarded-qualifiers") #include HPM_HOOKS_INCLUDE +PRAGMA_GCC5(GCC diagnostic pop) void HPM_HP_final(void) { int i, len = HPMHooks.data.total * 2; -- cgit v1.2.3-70-g09d2