aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/always-compiler-options.m423
-rw-r--r--config/zfs-build.m41
-rw-r--r--module/lua/ldo.c11
3 files changed, 35 insertions, 0 deletions
diff --git a/config/always-compiler-options.m4 b/config/always-compiler-options.m4
index 8cfd27535..a67319691 100644
--- a/config/always-compiler-options.m4
+++ b/config/always-compiler-options.m4
@@ -205,6 +205,29 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH], [
])
dnl #
+dnl # Check if cc supports -Winfinite-recursion option.
+dnl #
+AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_INFINITE_RECURSION], [
+ AC_MSG_CHECKING([whether $CC supports -Winfinite-recursion])
+
+ saved_flags="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Winfinite-recursion"
+
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
+ INFINITE_RECURSION=-Winfinite-recursion
+ AC_DEFINE([HAVE_INFINITE_RECURSION], 1,
+ [Define if compiler supports -Winfinite-recursion])
+ AC_MSG_RESULT([yes])
+ ], [
+ INFINITE_RECURSION=
+ AC_MSG_RESULT([no])
+ ])
+
+ CFLAGS="$saved_flags"
+ AC_SUBST([INFINITE_RECURSION])
+])
+
+dnl #
dnl # Check if cc supports -fno-omit-frame-pointer option.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER], [
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
index b40776da7..d14a6bb7a 100644
--- a/config/zfs-build.m4
+++ b/config/zfs-build.m4
@@ -210,6 +210,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
AC_SUBST(CPU_COUNT)
ZFS_AC_CONFIG_ALWAYS_CC_NO_CLOBBERED
+ ZFS_AC_CONFIG_ALWAYS_CC_INFINITE_RECURSION
ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH
ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN
ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION
diff --git a/module/lua/ldo.c b/module/lua/ldo.c
index 727757f7d..1b1f08b47 100644
--- a/module/lua/ldo.c
+++ b/module/lua/ldo.c
@@ -167,6 +167,13 @@ static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
L->top = oldtop + 1;
}
+/*
+ * Silence infinite recursion warning which was added to -Wall in gcc 12.1
+ */
+#if defined(HAVE_INFINITE_RECURSION)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Winfinite-recursion"a
+#endif
l_noret luaD_throw (lua_State *L, int errcode) {
if (L->errorJmp) { /* thread has an error handler? */
@@ -189,6 +196,10 @@ l_noret luaD_throw (lua_State *L, int errcode) {
}
}
+#if defined(HAVE_INFINITE_RECURSION)
+#pragma GCC diagnostic pop
+#endif
+
int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
unsigned short oldnCcalls = L->nCcalls;