Re: [PATCH 1/2] libc: Make string.h POSIX.1-2024 compliant
Joel Sherrill <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAF9ehCVWK9xQ4HbtQyZndFG+S0S9MbwxXpvCKwnFW3oOnk8=9w@mail.gmail.com> |
This looks ok to me. Checked against POSIX Issue 8. --joel On Fri, Nov 14, 2025 at 4:02 PM Simon Barth <[email protected]> wrote: > POSIX.1-2024 added strlcpy, strlcat, and memmem to strings.h. Previously > these functions were only available as parts of BSD or GNU extensions. > > Fix the header so that the symbol are visible for either the right > extensions, or for POSIX.1-2024. > --- > newlib/libc/include/string.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h > index 32199c027..3e66ec3dd 100644 > --- a/newlib/libc/include/string.h > +++ b/newlib/libc/include/string.h > @@ -68,10 +68,12 @@ void * memccpy (void *__restrict, const void > *__restrict, int, size_t); > #endif > #if __GNU_VISIBLE > void * mempcpy (void *, const void *, size_t); > -void * memmem (const void *, size_t, const void *, size_t); > void * memrchr (const void *, int, size_t); > void * rawmemchr (const void *, int); > #endif > +#if __GNU_VISIBLE || __POSIX_VISIBLE >= 202405 > +void * memmem (const void *, size_t, const void *, size_t); > +#endif > #if __POSIX_VISIBLE >= 200809 > char *stpcpy (char *__restrict, const char *__restrict); > char *stpncpy (char *__restrict, const char *__restrict, size_t); > @@ -111,7 +113,7 @@ int __xpg_strerror_r (int, char *, size_t); > /* Reentrant version of strerror. */ > char * _strerror_r (struct _reent *, int, int, int *); > > -#if __BSD_VISIBLE > +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405L > size_t strlcat (char *, const char *, size_t); > size_t strlcpy (char *, const char *, size_t); > #endif > -- > 2.51.2 > >