Pull in gnulib fix to allow base64.c to compile using GCC 15 or newer.

Pulled from: GNULIB commit 25df6dc4253480a343dde3376ce6fd99c316a532

GCC 15 adds a new compiler warning "-Wunterminated-string-initialization"
that will trigger what is considered a false-positive in base64.c as this
array is not treated as a string but an array of characters so the lack
of NULL string terminator is expected.

GCC team has added ability to flag such instances of arrays that the
compiler may think are strings as "nonstring" arrays to avoid this
warning: _attribute_((nonstring)).

Fixes: https://savannah.gnu.org/bugs/?66470

Signed-off-by: Andrew Hamilton <adham...@gmail.com>
---
 bootstrap.conf                                        |  1 +
 grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch | 11 +++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch

diff --git a/bootstrap.conf b/bootstrap.conf
index 7a7813d28..471a9f4eb 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -85,6 +85,7 @@ bootstrap_post_import_hook () {
   # changes to gnulib and update the hash above when they've merged.  Do not
   # add new patches here.
   patch -d grub-core/lib/gnulib -p2 < 
grub-core/lib/gnulib-patches/fix-width.patch
+  patch -d grub-core/lib/gnulib -p2 < 
grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
 
   for patchname in \
       0001-Support-POTFILES-shell \
diff --git a/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch 
b/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
new file mode 100644
index 000000000..287332ea0
--- /dev/null
+++ b/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
@@ -0,0 +1,11 @@
+--- a/lib/base64.c
++++ b/lib/base64.c
+@@ -61,7 +61,7 @@
+   return ch;
+ }
+
+-static const char b64c[64] =
++static const char b64c[64] _GL_ATTRIBUTE_NONSTRING =
+   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ /* Base64 encode IN array of size INLEN into OUT array. OUT needs
-- 
2.39.5


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to