[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/03: configure: add -Werror=array-bounds to CFLAGS whe
From: |
Rob Browning |
Subject: |
[Guile-commits] 02/03: configure: add -Werror=array-bounds to CFLAGS when available |
Date: |
Tue, 18 Mar 2025 15:35:50 -0400 (EDT) |
rlb pushed a commit to branch main
in repository guile.
commit aeb89f6ad6f3cdefb67b026cbe73de839af692a1
Author: Rob Browning <rlb@defaultvalue.org>
AuthorDate: Tue Mar 18 12:56:31 2025 -0500
configure: add -Werror=array-bounds to CFLAGS when available
This would have prevented https://bugs.gnu.org/76907
* configure.ac: add -Werror=array-bounds to CFLAGS when available
---
NEWS | 5 +++++
configure.ac | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/NEWS b/NEWS
index 394a7a78d..2adbdf099 100644
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,11 @@ every line in a file.
* Changes to the distribution
+* Build system changes
+
+** -Werror=array-bounds is now added to CFLAGS when available
+ This catches <https://bugs.gnu.org/76907>
+
* Bug fixes
** `basename` now checks the suffix against the base name, not the full path
diff --git a/configure.ac b/configure.ac
index f3a05ec70..eb2744b61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,14 @@ AC_PROG_INSTALL
AC_PROG_CC
gl_EARLY
+AC_MSG_CHECKING([whether the compiler supports -Werror=array-bounds])
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror=array-bounds"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo;], [])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ CFLAGS="$old_CFLAGS"])
+
AC_MSG_CHECKING([whether the compiler supports -fexcess-precision=standard])
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fexcess-precision=standard"