grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/3] configure: Fix building with clang


From: Darren Kenny
Subject: [PATCH v2 2/3] configure: Fix building with clang
Date: Fri, 21 Oct 2022 13:33:00 +0000

Building the current code with clang and the latest gnulib fails due to
the use of a variable-length-array (vla) warning, which turns in to an
error due to the presence of the -Werror during the build.

The gnulib team stated that their code should not be built with -Werror.

At present, the only way to do this is for the complete code-base, by
using the --disable-werror option to configure.

Rather than doing this, and failing to gain any benefit that it
provides, instead, if building with clang, this patch makes it possible
to specifically not error on vlas, while retaining the -Werror
functionality otherwise.

Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1348b06a985a..93626b7982d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1939,6 +1939,10 @@ AC_ARG_ENABLE([werror],
 if test x"$enable_werror" != xno ; then
   TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
   HOST_CFLAGS="$HOST_CFLAGS -Werror"
+  if test "x$grub_cv_cc_target_clang" = xyes; then
+    TARGET_CFLAGS="$TARGET_CFLAGS -Wno-error=vla"
+    HOST_CFLAGS="$HOST_CFLAGS -Wno-error=vla"
+  fi
 fi
 
 TARGET_CPP="$TARGET_CC -E"
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]