libiberty, gcc: Add memrchr to libiberty and use it [PR119283].

This adds an implementation of memrchr to libiberty and arranges
to configure gcc to use it, if the host does not have it.

	PR cobol/119283

gcc/ChangeLog:

	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for host memrchr.

include/ChangeLog:

	* libiberty.h (memrchr): New.

libiberty/ChangeLog:

	* Makefile.in: Add memrchr build rules.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for memrchr.
	* functions.texi: Document memrchr.
	* memrchr.c: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
This commit is contained in:
Iain Sandoe
2025-03-15 22:30:20 +00:00
parent eb2182479f
commit 9018336252
10 changed files with 87 additions and 10 deletions

View File

@@ -215,6 +215,16 @@ extern int ffs(int);
extern int mkstemps(char *, int);
#endif
#if defined (HAVE_DECL_MKSTEMPS) && !HAVE_DECL_MKSTEMPS
extern int mkstemps(char *, int);
#endif
/* Make memrchr available on systems that do not have it. */
#if !defined (__GNU_LIBRARY__ ) && !defined (__linux__) && \
!defined (HAVE_MEMRCHR)
extern void *memrchr(const void *, int, size_t);
#endif
/* Get the working directory. The result is cached, so don't call
chdir() between calls to getpwd(). */