diff --git a/BUILD.bazel b/BUILD.bazel index 74af72e8e..d46f07308 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -22,8 +22,6 @@ copy_file( LOCAL_DEFINES = [ "HAVE_CONFIG_H", - "HAVE_MEMMOVE", - "HAVE_STRERROR", "PCRE2_STATIC", "SUPPORT_PCRE2_8", "SUPPORT_UNICODE", diff --git a/CMakeLists.txt b/CMakeLists.txt index ec3b68547..0b6de498c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,11 +172,8 @@ check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(windows.h HAVE_WINDOWS_H) -check_symbol_exists(bcopy "strings.h" HAVE_BCOPY) check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE) -check_symbol_exists(memmove "string.h" HAVE_MEMMOVE) check_symbol_exists(secure_getenv "stdlib.h" HAVE_SECURE_GETENV) -check_symbol_exists(strerror "string.h" HAVE_STRERROR) check_c_source_compiles( [=[ diff --git a/build.zig b/build.zig index 94cea6415..8c1ed604e 100644 --- a/build.zig +++ b/build.zig @@ -31,9 +31,6 @@ pub fn build(b: *std.Build) !void { .HAVE_BUILTIN_UNREACHABLE = true, .HAVE_VISIBILITY = true, - .HAVE_MEMMOVE = true, - .HAVE_STRERROR = true, - .SUPPORT_PCRE2_8 = codeUnitWidth == CodeUnitWidth.@"8", .SUPPORT_PCRE2_16 = codeUnitWidth == CodeUnitWidth.@"16", .SUPPORT_PCRE2_32 = codeUnitWidth == CodeUnitWidth.@"32", diff --git a/configure.ac b/configure.ac index 7bc750903..b6fe20c14 100644 --- a/configure.ac +++ b/configure.ac @@ -578,11 +578,7 @@ Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All such macros are listed as a commented #undef in config.h.generic. Macros such as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are -surrounded by #ifndef/#endif lines so that the value can be overridden by -D. - -PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if -HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make -sure both macros are undefined; an emulation function will then be used. */]) +surrounded by #ifndef/#endif lines so that the value can be overridden by -D. */]) # Checks for header files. AC_CHECK_HEADERS(assert.h limits.h sys/types.h sys/stat.h dirent.h) @@ -627,7 +623,7 @@ AC_TYPE_SIZE_T # Checks for library functions. -AC_CHECK_FUNCS(bcopy memfd_create memmove mkostemp secure_getenv strerror) +AC_CHECK_FUNCS(memfd_create mkostemp secure_getenv) AC_MSG_CHECKING([for realpath]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include diff --git a/maint/README b/maint/README index dbfb66308..a7ae00607 100644 --- a/maint/README +++ b/maint/README @@ -226,9 +226,6 @@ new release. maint/RunPerlTest shell script can be used to do this testing in Unix-like environment. - - It is possible to test with the emulated memmove() function by undefining - HAVE_MEMMOVE and HAVE_BCOPY in config.h, though I do not do this often. - - Check the external testing tools. CodeQL & Clang Static Analyzer report their results to the GitHub "Security" dashboard. Coverity has its own external dashboard, as does OSS-Fuzz. Since we have these tools, we should diff --git a/src/config-cmake.h.in b/src/config-cmake.h.in index 4e13e0bc1..3e6cf0fdd 100644 --- a/src/config-cmake.h.in +++ b/src/config-cmake.h.in @@ -11,11 +11,8 @@ #cmakedefine HAVE_UNISTD_H 1 #cmakedefine HAVE_WINDOWS_H 1 -#cmakedefine HAVE_BCOPY 1 #cmakedefine HAVE_MEMFD_CREATE 1 -#cmakedefine HAVE_MEMMOVE 1 #cmakedefine HAVE_SECURE_GETENV 1 -#cmakedefine HAVE_STRERROR 1 #cmakedefine SUPPORT_PCRE2_8 1 #cmakedefine SUPPORT_PCRE2_16 1 diff --git a/src/config.h.generic b/src/config.h.generic index ed0149007..2d47d19b5 100644 --- a/src/config.h.generic +++ b/src/config.h.generic @@ -22,11 +22,7 @@ Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All such macros are listed as a commented #undef in config.h.generic. Macros such as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are -surrounded by #ifndef/#endif lines so that the value can be overridden by -D. - -PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if -HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make -sure both macros are undefined; an emulation function will then be used. */ +surrounded by #ifndef/#endif lines so that the value can be overridden by -D. */ /* By default, the \R escape sequence matches any Unicode line ending character or sequence of characters. If BSR_ANYCRLF is defined (to any @@ -63,9 +59,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define this if your compiler supports __attribute__((uninitialized)) */ /* #undef HAVE_ATTRIBUTE_UNINITIALIZED */ -/* Define to 1 if you have the `bcopy' function. */ -/* #undef HAVE_BCOPY */ - /* Define this if your compiler provides __assume() */ /* #undef HAVE_BUILTIN_ASSUME */ @@ -99,9 +92,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the `memfd_create' function. */ /* #undef HAVE_MEMFD_CREATE */ -/* Define to 1 if you have the `memmove' function. */ -/* #undef HAVE_MEMMOVE */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_MINIX_CONFIG_H */ @@ -138,9 +128,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the header file. */ /* #undef HAVE_STDLIB_H */ -/* Define to 1 if you have the `strerror' function. */ -/* #undef HAVE_STRERROR */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_STRINGS_H */ diff --git a/src/pcre2_internal.h b/src/pcre2_internal.h index f5e46adc9..cad67bb49 100644 --- a/src/pcre2_internal.h +++ b/src/pcre2_internal.h @@ -209,28 +209,6 @@ code that a non-static object is being referenced. */ #define PRIV(name) _pcre2_##name #endif -/* When compiling for use with the Virtual Pascal compiler, these functions -need to have their names changed. PCRE2 must be compiled with the -DVPCOMPAT -option on the command line. */ - -#ifdef VPCOMPAT -#define strlen(s) _strlen(s) -#define strncmp(s1,s2,m) _strncmp(s1,s2,m) -#define memcmp(s,c,n) _memcmp(s,c,n) -#define memcpy(d,s,n) _memcpy(d,s,n) -#define memmove(d,s,n) _memmove(d,s,n) -#define memset(s,c,n) _memset(s,c,n) -#else /* VPCOMPAT */ - -/* Otherwise, to cope with SunOS4 and other systems that lack memmove(), define -a macro that calls an emulating function. */ - -#ifndef HAVE_MEMMOVE -#undef memmove /* Some systems may have a macro */ -#define memmove(a, b, c) PRIV(memmove)(a, b, c) -#endif /* not HAVE_MEMMOVE */ -#endif /* not VPCOMPAT */ - /* This is an unsigned int value that no UTF character can ever have, as Unicode doesn't go beyond 0x0010ffff. */ @@ -2380,13 +2358,6 @@ extern BOOL _pcre2_xclass(uint32_t, PCRE2_SPTR, const uint8_t *, BOOL); extern BOOL _pcre2_eclass(uint32_t, PCRE2_SPTR, PCRE2_SPTR, const uint8_t *, BOOL); -/* This function is needed only when memmove() is not available. */ - -#if !defined(VPCOMPAT) && !defined(HAVE_MEMMOVE) -#define _pcre2_memmove PCRE2_SUFFIX(_pcre2_memmove) -extern void * _pcre2_memmove(void *, const void *, size_t); -#endif - #endif /* PCRE2_CODE_UNIT_WIDTH */ #include "pcre2_util.h" diff --git a/src/pcre2_string_utils.c b/src/pcre2_string_utils.c index a973c90eb..f1ac718f6 100644 --- a/src/pcre2_string_utils.c +++ b/src/pcre2_string_utils.c @@ -48,42 +48,6 @@ functions work only on 8-bit data. */ -/************************************************* -* Emulated memmove() for systems without it * -*************************************************/ - -/* This function can make use of bcopy() if it is available. Otherwise do it by -steam, as there some non-Unix environments that lack both memmove() and -bcopy(). */ - -#if !defined(VPCOMPAT) && !defined(HAVE_MEMMOVE) -void * -PRIV(memmove)(void *d, const void *s, size_t n) -{ -#ifdef HAVE_BCOPY -bcopy(s, d, n); -return d; -#else -size_t i; -unsigned char *dest = (unsigned char *)d; -const unsigned char *src = (const unsigned char *)s; -if (dest > src) - { - dest += n; - src += n; - for (i = 0; i < n; ++i) *(--dest) = *(--src); - return (void *)dest; - } -else - { - for (i = 0; i < n; ++i) *dest++ = *src++; - return (void *)(dest - n); - } -#endif /* not HAVE_BCOPY */ -} -#endif /* not VPCOMPAT && not HAVE_MEMMOVE */ - - /************************************************* * Compare two zero-terminated PCRE2 strings * *************************************************/ diff --git a/src/pcre2grep.c b/src/pcre2grep.c index 4b8887ee6..705e15f5d 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -535,44 +535,6 @@ const char utf8_table4[] = { 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }; -#if !defined(VPCOMPAT) && !defined(HAVE_MEMMOVE) -/************************************************* -* Emulated memmove() for systems without it * -*************************************************/ - -/* This function can make use of bcopy() if it is available. Otherwise do it by -steam, as there are some non-Unix environments that lack both memmove() and -bcopy(). */ - -static void * -emulated_memmove(void *d, const void *s, size_t n) -{ -#ifdef HAVE_BCOPY -bcopy(s, d, n); -return d; -#else -size_t i; -unsigned char *dest = (unsigned char *)d; -const unsigned char *src = (const unsigned char *)s; -if (dest > src) - { - dest += n; - src += n; - for (i = 0; i < n; ++i) *(--dest) = *(--src); - return (void *)dest; - } -else - { - for (i = 0; i < n; ++i) *dest++ = *src++; - return (void *)(dest - n); - } -#endif /* not HAVE_BCOPY */ -} -#undef memmove -#define memmove(d,s,n) emulated_memmove(d,s,n) -#endif /* not VPCOMPAT && not HAVE_MEMMOVE */ - - /************************************************* * Convert code point to UTF-8 * @@ -1175,28 +1137,6 @@ FWRITE_IGNORE(buf, 1, length, stdout); -#ifndef HAVE_STRERROR -/************************************************* -* Provide strerror() for non-ANSI libraries * -*************************************************/ - -/* Some old-fashioned systems still around (e.g. SunOS4) don't have strerror() -in their libraries, but can provide the same facility by this simple -alternative function. */ - -extern int sys_nerr; -extern char *sys_errlist[]; - -char * -strerror(int n) -{ -if (n < 0 || n >= sys_nerr) return "unknown error number"; -return sys_errlist[n]; -} -#endif /* HAVE_STRERROR */ - - - /************************************************* * Usage function * *************************************************/ diff --git a/src/pcre2test.c b/src/pcre2test.c index dbb1cb561..1ca2f9f6a 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -1421,67 +1421,6 @@ static const uint8_t tables2[] = { -#if !defined(VPCOMPAT) && !defined(HAVE_MEMMOVE) -/************************************************* -* Emulated memmove() for systems without it * -*************************************************/ - -/* This function can make use of bcopy() if it is available. Otherwise do it by -steam, as there are some non-Unix environments that lack both memmove() and -bcopy(). */ - -static void * -emulated_memmove(void *d, const void *s, size_t n) -{ -#ifdef HAVE_BCOPY -bcopy(s, d, n); -return d; -#else -size_t i; -unsigned char *dest = (unsigned char *)d; -const unsigned char *src = (const unsigned char *)s; -if (dest > src) - { - dest += n; - src += n; - for (i = 0; i < n; ++i) *(--dest) = *(--src); - return (void *)dest; - } -else - { - for (i = 0; i < n; ++i) *dest++ = *src++; - return (void *)(dest - n); - } -#endif /* not HAVE_BCOPY */ -} -#undef memmove -#define memmove(d,s,n) emulated_memmove(d,s,n) -#endif /* not VPCOMPAT && not HAVE_MEMMOVE */ - - - -#ifndef HAVE_STRERROR -/************************************************* -* Provide strerror() for non-ANSI libraries * -*************************************************/ - -/* Some old-fashioned systems (e.g. SunOS4) didn't have strerror() in their -libraries. They may no longer be around, but just in case, we can try to -provide the same facility by this simple alternative function. */ - -extern int sys_nerr; -extern char *sys_errlist[]; - -char * -strerror(int n) -{ -if (n < 0 || n >= sys_nerr) return "unknown error number"; -return sys_errlist[n]; -} -#endif /* HAVE_STRERROR */ - - - /************************************************* * Local memory functions * *************************************************/ diff --git a/vms/configure.com b/vms/configure.com index 19c9ff5bb..235647867 100644 --- a/vms/configure.com +++ b/vms/configure.com @@ -463,11 +463,7 @@ Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE2_8 should either be defined (conventionally to 1) for TRUE, and not defined at all for FALSE. All such macros are listed as a commented #undef in config.h.generic. Macros such as MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are -surrounded by #ifndef/#endif lines so that the value can be overridden by -D. - -PCRE2 uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if -HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make -sure both macros are undefined; an emulation function will then be used. */ +surrounded by #ifndef/#endif lines so that the value can be overridden by -D. */ /* By default, the \R escape sequence matches any Unicode line ending character or sequence of characters. If BSR_ANYCRLF is defined (to any @@ -499,9 +495,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the header file. */ #define HAVE_ASSERT_H 1 -/* Define to 1 if you have the 'bcopy' function. */ -#define HAVE_BCOPY 1 - /* Define this if your compiler provides __builtin_mul_overflow() */ #undef HAVE_BUILTIN_MUL_OVERFLOW @@ -529,9 +522,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the 'memfd_create' function. */ #undef HAVE_MEMFD_CREATE -/* Define to 1 if you have the 'memmove' function. */ -#define HAVE_MEMMOVE 1 - /* Define to 1 if you have the header file. */ #undef HAVE_MINIX_CONFIG_H @@ -568,9 +558,6 @@ sure both macros are undefined; an emulation function will then be used. */ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 -/* Define to 1 if you have the 'strerror' function. */ -#define HAVE_STRERROR 1 - /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1