summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-09-25 20:52:36 +0300
committerAndrei Karas <akaras@inbox.ru>2019-10-17 03:30:39 +0300
commit1bc17b805aec9dff503afca1e4b7120c5c836b75 (patch)
tree650394991a8f5d924a936aa5c2e9cbaf2ed77c6b
parent5b2f2fd6edbc13c2ba7ea777ceb205294899b72b (diff)
downloadhercules-1bc17b805aec9dff503afca1e4b7120c5c836b75.tar.gz
hercules-1bc17b805aec9dff503afca1e4b7120c5c836b75.tar.bz2
hercules-1bc17b805aec9dff503afca1e4b7120c5c836b75.tar.xz
hercules-1bc17b805aec9dff503afca1e4b7120c5c836b75.zip
Fix compilation warnings in gcc-9
Also reenabled array bound warning
-rwxr-xr-xconfigure90
-rw-r--r--configure.ac1
-rw-r--r--src/common/cbasetypes.h7
-rw-r--r--src/map/clif.c3
-rw-r--r--src/map/map.c3
5 files changed, 14 insertions, 90 deletions
diff --git a/configure b/configure
index 957398296..1eca0d195 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac 76896e850.
+# From configure.ac b3a11d273.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -7986,94 +7986,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-array-bounds" >&5
-$as_echo_n "checking whether $CC supports -Wno-array-bounds... " >&6; }
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Werror -Wno-array-bounds"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int foo;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- # Recent versions of gcc don't fail if -Wno-foo is not recognized
- # (unless there are also other warnings), so we also check for -Wfoo
- # which always fails if not supported
- CFLAGS="$OLD_CFLAGS -Werror -Warray-bounds"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int foo;
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- CFLAGS="$OLD_CFLAGS -Wno-array-bounds"
- # Optionally, run a test
- if test "x" != "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-array-bounds" >&5
-$as_echo_n "checking whether $CC can actually use -Wno-array-bounds... " >&6; }
- CFLAGS="$OLD_CFLAGS -Werror -Warray-bounds"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5
-$as_echo "not needed but enabled" >&6; }
- CFLAGS="$OLD_CFLAGS"
-
-else
-
- CFLAGS="$OLD_CFLAGS -Werror -Wno-array-bounds"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- CFLAGS="$OLD_CFLAGS -Wno-array-bounds"
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="$OLD_CFLAGS"
-
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="$OLD_CFLAGS"
-
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="$OLD_CFLAGS"
-
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-
# Certain versions of gcc make -Wshadow completely useless by making it flood
# you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239>
# Let's check if we can really use it
diff --git a/configure.ac b/configure.ac
index cbb9a5c46..ec9e35cfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1090,7 +1090,6 @@ AC_CHECK_COMPILER_WNOFLAG(format-nonliteral)
AC_CHECK_COMPILER_WNOFLAG(switch)
AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers)
AC_CHECK_COMPILER_WNOFLAG(suggest-attribute=format)
-AC_CHECK_COMPILER_WNOFLAG(array-bounds)
# Certain versions of gcc make -Wshadow completely useless by making it flood
# you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239>
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;