Re: [PATCH 1/1] ACPI: Fix building with GCC 15

From: Brahmajit
Date: Tue Apr 15 2025 - 16:31:03 EST


On 15.04.2025 19:04, David Laight wrote:
>
> Doesn't than generate an 'unknown attribute' error on older compilers?
>
> Does:
> typedef char char_nonstring __attribute__((nonstring));
> char_nonstring name[4] = "abcd";
> work?
>
> If so the attribute could even be applied to 'u8'.
>
> David

David, what if I used the __nonstring attribute from
include/linux/compiler_attributes.h which defines the following

#if __has_attribute(__nonstring__)
# define __nonstring __attribute__((__nonstring__))
#else
# define __nonstring
#endif

Which I came across from
https://www.kernel.org/doc/html/latest/process/programming-language.html#attributes
Also the checkpatch.pl scripts suggests using that instead.

I guess this would work from older compilers as well.

--
Regards,
listout