https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109293

--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> Something like this:
> diff --git a/fixincludes/configure.ac b/fixincludes/configure.ac
> index 14813b910f1..00aeb1ce1d9 100644
> --- a/fixincludes/configure.ac
> +++ b/fixincludes/configure.ac
> @@ -89,6 +89,7 @@ define(fixincludes_UNLOCKED_FUNCS, clearerr_unlocked
> feof_unlocked dnl
>    putchar_unlocked putc_unlocked)
>  AC_CHECK_FUNCS(fixincludes_UNLOCKED_FUNCS)
>  AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, vasprintf])
> +AC_CHECK_DECLS([memmem])
>  AC_CHECK_DECLS(m4_split(m4_normalize(fixincludes_UNLOCKED_FUNCS)))
> 
>  # Checks for typedefs, structures, and compiler characteristics.
> diff --git a/fixincludes/system.h b/fixincludes/system.h
> index dca5d57b2e3..f7bbd0e952c 100644
> --- a/fixincludes/system.h
> +++ b/fixincludes/system.h
> @@ -209,6 +209,11 @@ extern int errno;
>  extern void abort (void);
>  #endif
> 
> +#if defined (HAVE_DECL_MEMMEM) && !HAVE_DECL_MEMMEM
> +extern void *memmem (const void *, size_t, const void *, size_t);
> +#endif
> +
> +
>  #if HAVE_SYS_STAT_H
>  # include <sys/stat.h>
>  #endif

Yes, I'm testing it in a container environment where I've removed memmem from
system string.h.

Reply via email to