All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Brahmajit Das <brahmajit.xyz@gmail.com>,
	rafael.j.wysocki@intel.com, lenb@kernel.org,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] ACPI: Fix building with GCC 15
Date: Thu, 13 Feb 2025 20:06:05 +0000	[thread overview]
Message-ID: <20250213200605.6e62302a@pumpkin> (raw)
In-Reply-To: <CAMj1kXGvgad183WbUHPGduXHEahfoWasued-LdJ+Tkhc=z-9GA@mail.gmail.com>

On Thu, 13 Feb 2025 16:46:56 +0100
Ard Biesheuvel <ardb@kernel.org> wrote:

> On Tue, 21 Jan 2025 at 22:42, Brahmajit Das <brahmajit.xyz@gmail.com> wrote:
> >
> > Building with GCC 15 results in the following build error:
> >
> > ...
> >   CC      drivers/acpi/tables.o
> > In file included from ./include/acpi/actbl.h:371,
> >                  from ./include/acpi/acpi.h:26,
> >                  from ./include/linux/acpi.h:26,
> >                  from drivers/acpi/tables.c:19:
> > ./include/acpi/actbl1.h:30:33: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
> >    30 | #define ACPI_SIG_BERT           "BERT"  /* Boot Error Record Table */
> >       |                                 ^~~~~~
> > drivers/acpi/tables.c:400:9: note: in expansion of macro ‘ACPI_SIG_BERT’
> >   400 |         ACPI_SIG_BERT, ACPI_SIG_BGRT, ACPI_SIG_CPEP, ACPI_SIG_ECDT,
> >       |         ^~~~~~~~~~~~~
> > ./include/acpi/actbl1.h:31:33: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
> >    31 | #define ACPI_SIG_BGRT           "BGRT"  /* Boot Graphics Resource Table */
> >       |                                 ^~~~~~
> > drivers/acpi/tables.c:400:24: note: in expansion of macro ‘ACPI_SIG_BGRT’
> >   400 |         ACPI_SIG_BERT, ACPI_SIG_BGRT, ACPI_SIG_CPEP, ACPI_SIG_ECDT,
> >       |                        ^~~~~~~~~~~~~
> > ./include/acpi/actbl1.h:34:33: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
> >    34 | #define ACPI_SIG_CPEP           "CPEP"  /* Corrected Platform Error Polling table */
> > ...
> >
> > This is due to GCC having enabled
> > -Werror=unterminated-string-initialization[0] by default. To work around
> > this build time error we're modifying the size of table_sigs from
> > table_sigs[][ACPI_NAMESEG_SIZE] to table_sigs[][ACPI_NAMESEG_SIZE + 1].
> > This ensures space for NUL, thus satisfying GCC.
> >
> > [0]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wno-unterminated-string-initialization
> >
> > Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
> > ---
> >  drivers/acpi/tables.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
> > index 9e1b01c35070..5a6524eb79d8 100644
> > --- a/drivers/acpi/tables.c
> > +++ b/drivers/acpi/tables.c
> > @@ -396,7 +396,7 @@ static u8 __init acpi_table_checksum(u8 *buffer, u32 length)
> >  }
> >
> >  /* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */
> > -static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst = {
> > +static const char table_sigs[][ACPI_NAMESEG_SIZE + 1] __initconst = {
> >         ACPI_SIG_BERT, ACPI_SIG_BGRT, ACPI_SIG_CPEP, ACPI_SIG_ECDT,
> >         ACPI_SIG_EINJ, ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT,
> >         ACPI_SIG_MSCT, ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT,  
> 
> Please add the __nonstring attribute instead.

That doesn't fix initialisers.
There is a gcc bug about it (and a patch)...

	David



  reply	other threads:[~2025-02-13 20:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 21:42 [PATCH 1/1] ACPI: Fix building with GCC 15 Brahmajit Das
2025-02-13 15:46 ` Ard Biesheuvel
2025-02-13 20:06   ` David Laight [this message]
2025-02-14 19:27     ` Brahmajit
  -- strict thread matches above, loose matches on Subject: below --
2025-04-14 16:16 Brahmajit Das
2025-04-14 16:24 ` Brahmajit
2025-04-14 16:39   ` Rafael J. Wysocki
2025-04-15 18:04 ` David Laight
2025-04-15 20:30   ` Brahmajit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250213200605.6e62302a@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=ardb@kernel.org \
    --cc=brahmajit.xyz@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.