From 0199c44374c41940660ab76419ad01dd07f0b8f6 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 26 May 2024 15:06:03 +0900 Subject: [PATCH] [build] Fix some config errors found by gcc 14 Or more realistically, attempting to use gcc 14 (it ICEs, so can't be used yet). --- config.d/compiling.m4 | 4 ++-- config.d/header_files.m4 | 6 +++--- include/compat.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config.d/compiling.m4 b/config.d/compiling.m4 index 0ce257f7b..ea1b18ab4 100644 --- a/config.d/compiling.m4 +++ b/config.d/compiling.m4 @@ -56,7 +56,7 @@ if test "x$GCC" = xyes; then shift args="$*" AC_MSG_CHECKING(for gcc version) - CCVER="gcc `$CC --version | grep '[[0-9]]\.[[0-9]]' | sed -e 's/.*(GCC)//' -e 's/[[^0-9]]*\([[0-9.]]*\).*/\1/'`" + CCVER="gcc `$CC --version | grep '[[0-9]]\.[[0-9]]' | sed -e 's/.*([[^)]]*)//' -e 's/[[^0-9]]*\([[0-9.]]*\).*/\1/'`" set $CCVER save_IFS="$IFS" IFS="." @@ -340,7 +340,7 @@ if test "x$leave_cflags_alone" != xyes; then [[bool flag = true;]], [[return flag ? 1 : 0]])], [], - [QF_CC_OPTION_TEST(-std=gnu23,[],QF_CC_OPTION(-std=gnu2x))] + [QF_CC_OPTION_TEST(-std=gnu23,QF_CC_OPTION(-std=gnu23),QF_CC_OPTION(-std=gnu2x))] ) fi AC_MSG_CHECKING([for c23]) diff --git a/config.d/header_files.m4 b/config.d/header_files.m4 index 93513dc8c..c8133457d 100644 --- a/config.d/header_files.m4 +++ b/config.d/header_files.m4 @@ -37,16 +37,16 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "fnmatch.h"]], [[int (*foo)() = fn ]) AC_MSG_CHECKING(for strnlen in string.h) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "string.h"]], [[int (*foo)() = strnlen;]])],[AC_DEFINE(HAVE_STRNLEN_PROTO, 1, Define this if strnlen is prototyped in string.h) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "string.h"]], [[size_t (*foo)(const char *, size_t) = strnlen;]])],[AC_DEFINE(HAVE_STRNLEN_PROTO, 1, Define this if strnlen is prototyped in string.h) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for strndup in string.h) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "string.h"]], [[int (*foo)() = strndup;]])],[AC_DEFINE(HAVE_STRNDUP_PROTO, 1, Define this if strndup is prototyped in string.h) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "string.h"]], [[char *(*foo)(const char *, size_t) = strndup;]])],[AC_DEFINE(HAVE_STRNDUP_PROTO, 1, Define this if strndup is prototyped in string.h) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(for strcasestr in string.h) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "string.h"]], [[int (*foo)() = strcasestr;]])],[AC_DEFINE(HAVE_STRCASESTR_PROTO, 1, Define this if strcasestr is prototyped in string.h) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "string.h"]], [[char *(*foo)(const char *, const char *) = strcasestr;]])],[AC_DEFINE(HAVE_STRCASESTR_PROTO, 1, Define this if strcasestr is prototyped in string.h) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) ]) diff --git a/include/compat.h b/include/compat.h index 07c871667..f1d608a50 100644 --- a/include/compat.h +++ b/include/compat.h @@ -96,7 +96,7 @@ size_t strnlen (const char *str, size_t len); #endif #ifdef HAVE_STRNDUP # ifndef HAVE_STRNDUP_PROTO -size_t strndup (const char *str, size_t len); +char *strndup (const char *str, size_t len); # endif #else # define strndup Q_strndup