Re: [PATCH] compiler_types: Introduce __nonstring_array
From: Miguel Ojeda
Date: Mon Mar 10 2025 - 19:04:24 EST
On Mon, Mar 10, 2025 at 10:42 PM Kees Cook <kees@xxxxxxxxxx> wrote:
>
> GCC has expanded support of the "nonstring" attribute so that it can be
> applied to arrays of character arrays[1], which is needed to identify
> correct static initialization of those kinds of objects. Since this was
> not supported prior to GCC 15, we need to distinguish the usage of Linux's
> existing __nonstring macro for the attribute for non-multi-dimensional
> char arrays. Until GCC 15 is the minimum version, use __nonstring_array to
> mark arrays of non-string character arrays. (Regular non-string character
> arrays can continue to use __nonstring.)
Sounds reasonable. So this means that, when the GCC minimum goes over
15 in some years, we can both remove it and move it to
`compiler_attributes.h`, right?
Perhaps we should mention part of this commit message (or the sentence
above) in the comment to clarify (it will also help to clarify what
that "only supported since GCC >= 15" means).
If you are going to use it in a series that has a use case:
Acked-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
Thanks!
Cheers,
Miguel