[4/5] linux: Replace zero-length array with flexible-array member on struct dirstream
Commit Message
The linux kernel has always required a compiler supporting c99
flexible-arrays.
Signed-off-by: Cristian Rodríguez <cristian@rodriguez.im>
---
sysdeps/unix/sysv/linux/dirstream.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
* Cristian Rodríguez via Libc-alpha:
> The linux kernel has always required a compiler supporting c99
> flexible-arrays.
This is not an installed header, so this commit message is misleading.
Why __attribute_nonstring__?
Thanks,
Florian
On Thu, Jun 22, 2023 at 1:25 AM Florian Weimer <fweimer@redhat.com> wrote:
> * Cristian Rodríguez via Libc-alpha:
>
> > The linux kernel has always required a compiler supporting c99
> > flexible-arrays.
>
> This is not an installed header, so this commit message is misleading.
> Why __attribute_nonstring__?
>
>
>
So there is a warning if someone, by a mistake obviously.,,treats it as an
string or calls any str* function on it.. data is filled with struct
linux_dirent s
@@ -47,7 +47,7 @@ struct __dirstream
sufficient because dirents on 32-bit platforms can require
64-bit alignment. We use "long double" here to be consistent
with what malloc uses. */
- char data[0] __attribute__ ((aligned (__alignof__ (long double))));
+ char data[] __attribute_nonstring__ __attribute__ ((aligned (__alignof__ (long double))));
};
#define _DIR_dirfd(dirp) ((dirp)->fd)