From 1bc17b805aec9dff503afca1e4b7120c5c836b75 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 Sep 2019 20:52:36 +0300 Subject: Fix compilation warnings in gcc-9 Also reenabled array bound warning --- src/common/cbasetypes.h | 7 +++++++ src/map/clif.c | 3 +++ src/map/map.c | 3 +++ 3 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 89f7f8588..c9c189032 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -313,6 +313,13 @@ typedef uintptr_t uintptr; #define PRAGMA_GCC5(str) #endif // ! defined(__GNUC__) && (GCC_VERSION >= 50000) +// Pragma macro only enabled on gcc >= 9 +#if defined(__GNUC__) && (GCC_VERSION >= 90000) +#define PRAGMA_GCC9(str) _Pragma(#str) +#else // ! defined(__GNUC__) && (GCC_VERSION >= 90000) +#define PRAGMA_GCC9(str) +#endif // ! defined(__GNUC__) && (GCC_VERSION >= 90000) + // fallthrough attribute only enabled on gcc >= 7.0 #if defined(__GNUC__) && (GCC_VERSION >= 70000) #define FALLTHROUGH __attribute__ ((fallthrough)); diff --git a/src/map/clif.c b/src/map/clif.c index f6caa502e..3e6a3469d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -16091,7 +16091,10 @@ static void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) p->packetType = HEADER_ZC_ACK_RANKING; p->rankType = type; #if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190703 || PACKETVER_ZERO_NUM >= 20190724 +PRAGMA_GCC9(GCC diagnostic push) +PRAGMA_GCC9(GCC diagnostic ignored "-Waddress-of-packed-member") clif->ranklist_sub2(p->chars, p->points, type); +PRAGMA_GCC9(GCC diagnostic pop) #else clif->ranklist_sub(&p->ranks, type); #endif diff --git a/src/map/map.c b/src/map/map.c index 332bbe75f..f3fc9d46b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -6835,7 +6835,10 @@ void map_defaults(void) map->bl_list_size = 0; //all in a big chunk, respects order +PRAGMA_GCC9(GCC diagnostic push) +PRAGMA_GCC9(GCC diagnostic ignored "-Warray-bounds") memset(ZEROED_BLOCK_POS(map), 0, ZEROED_BLOCK_SIZE(map)); +PRAGMA_GCC9(GCC diagnostic pop) map->cpsd = NULL; map->list = NULL; -- cgit v1.2.3-70-g09d2