bug-gnulib
[Top][All Lists]
Advanced

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

Re: base64: gcc-15 compile issue


From: Jeffrey Walton
Subject: Re: base64: gcc-15 compile issue
Date: Sat, 21 Dec 2024 14:58:16 -0500

On Sat, Dec 21, 2024 at 9:45 AM Bruno Haible via Gnulib discussion
list <bug-gnulib@gnu.org> wrote:
>
> Rudi Heitbaum wrote:
> > When compiling grub-2.12 with gcc-15-20241208 the following line causes
> > the following error:
> >
> > https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/base64.c#n62
> >
> > ../../grub-core/lib/gnulib/base64.c:65:3:
> >   error: initializer-string for array of 'char' is too long
> >   [-Werror=unterminated-string-initialization]
> >
> >    65 |   
> > "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
> >       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> No, this line is not causing an error. This line causes a warning, and
> it is either your use of CPPFLAGS and CFLAGS or grub's configure.ac which
> adds '-Werror' and thus turns the warning into an error.
>
> Use of -Werror with gnulib is unsupported. We cannot avoid all compiler
> warnings on all systems, in particular because some warnings are style
> warnings and opposite warnings exist as well.
>
> In this case, the code is perfectly fine: it initializes an array of
> size 64 with 64 characters. There is no better way to write such an
> initialization.

The string literal includes the trailing NULL, so the literal is 65
chars, not 64 char.

> So, you need to remove that particular warning from your CPPFLAGS and
> CFLAGS or from grub's configure.ac.
>
> See also <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178>,
>          <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116082>.

Jeff



reply via email to

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