Upgrade libpcre2 to 10.47

This commit is contained in:
dmiller 2026-01-28 15:06:49 +00:00
parent 20c3b3b945
commit a5b332ccd2
76 changed files with 14493 additions and 16475 deletions

View file

@ -1,14 +1,14 @@
PCRE2 Authorship and Contributors
=================================
COPYRIGHT
Copyright
---------
Please see the file [LICENCE](./LICENCE.md) in the PCRE2 distribution for
copyright details.
MAINTAINERS
Maintainers
-----------
The PCRE and PCRE2 libraries were authored and maintained by Philip Hazel.
@ -62,7 +62,7 @@ Both administrators are volunteers acting in a personal capacity.
</table>
CONTRIBUTORS
Contributors
------------
Many others have participated and contributed to PCRE2 over its history.
@ -77,7 +77,7 @@ All names listed alphabetically.
### Contributors to PCRE2
This list includes names up until the PCRE2 10.44 release. New names will be
This list includes names up until the PCRE2 10.47 release. New names will be
added from the Git history on each release.
Scott Bell
@ -93,13 +93,16 @@ added from the Git history on each release.
Addison Crump
Alex Dowad
Daniel Engberg
Marco Feuerstein
Daniel Richard G
Isaac Oscar Gariano
David Gaussmann
Andrey Gorbachev
Jordan Griege
Jason Hood
Bumsu Hyeon
Roy Ivy
Nobuhiro Iwamatsu
Martin Joerg
Guillem Jover
Ralf Junker
@ -114,13 +117,17 @@ added from the Git history on each release.
Kai Lu
Behzod Mansurov
B. Scott Michel
Greg Minshall
Nathan Moinvaziri
Mike Munday
Marc Mutz
Fabio Pagani
Christian Persch
Alex Reinking
Joshua Rogers
Tristan Ross
William A Rowe Jr
Rocco Ruscitti
David Seifert
Yaakov Selkowitz
Rich Siegel
@ -131,6 +138,7 @@ added from the Git history on each release.
Greg Thain
Lucas Trzesniewski
Theodore Tsirpanis
Aaron M. Ucko
Matthew Vernon
Rémi Verschelde
Thomas Voss

View file

@ -20,15 +20,51 @@ copy_file(
out = "src/pcre2_chartables.c",
)
# Removed src/pcre2_ucptables.c below because it is #included in
# src/pcre2_tables.c. Also fixed typo: ckdint should be chkdint.
# PH, 22-March-2023.
LOCAL_DEFINES = [
"HAVE_CONFIG_H",
"SUPPORT_PCRE2_8",
"SUPPORT_UNICODE",
] + select({
"@platforms//os:windows": [],
"//conditions:default": ["HAVE_UNISTD_H"],
})
# Workaround for a Bazel quirk. It is extremely strict about the #include path
# used for internal headers. We have our headers inside src/, but we #include
# them as '#include "pcre2_internal.h"', assuming that src/ is added to the
# compiler's include path. Unfortunately, that violates the conventions used by
# Bazel.
#
# This is a workaround. Note that we can't use the "include = [...]" property
# to add the src/ directory, since that pollutes the include path for projects
# depending on PCRE2 (we must not make our config.h file visible to consumers
# of PCRE2).
cc_library(
name = "pcre2_internal_headers",
hdrs = [
"src/pcre2_compile.h",
"src/pcre2_internal.h",
"src/pcre2_intmodedep.h",
"src/pcre2_jit_match_inc.h",
"src/pcre2_jit_misc_inc.h",
"src/pcre2_printint_inc.h",
"src/pcre2_ucp.h",
"src/pcre2_ucptables_inc.h",
"src/pcre2_util.h",
"src/pcre2test_inc.h",
":config_h_generic",
],
strip_include_prefix = "src",
visibility = ["//visibility:private"],
)
cc_library(
name = "pcre2",
srcs = [
"src/pcre2_auto_possess.c",
"src/pcre2_chkdint.c",
"src/pcre2_compile.c",
"src/pcre2_compile_cgroup.c",
"src/pcre2_compile_class.c",
"src/pcre2_config.c",
"src/pcre2_context.c",
@ -41,6 +77,7 @@ cc_library(
"src/pcre2_maketables.c",
"src/pcre2_match.c",
"src/pcre2_match_data.c",
"src/pcre2_match_next.c",
"src/pcre2_newline.c",
"src/pcre2_ord2utf.c",
"src/pcre2_pattern_info.c",
@ -55,53 +92,49 @@ cc_library(
"src/pcre2_valid_utf.c",
"src/pcre2_xclass.c",
":pcre2_chartables_c",
"src/pcre2_compile.h",
"src/pcre2_internal.h",
"src/pcre2_intmodedep.h",
"src/pcre2_ucp.h",
"src/pcre2_util.h",
":config_h_generic",
],
textual_hdrs = [
"src/pcre2_jit_match.c",
"src/pcre2_jit_misc.c",
"src/pcre2_ucptables.c",
],
hdrs = [
":pcre2_h_generic",
],
local_defines = [
"HAVE_CONFIG_H",
"HAVE_MEMMOVE",
"PCRE2_CODE_UNIT_WIDTH=8",
hdrs = [":pcre2_h_generic"],
implementation_deps = [":pcre2_internal_headers"],
defines = [
"PCRE2_STATIC",
"SUPPORT_UNICODE",
],
includes = ["src"],
local_defines = LOCAL_DEFINES + [
"PCRE2_CODE_UNIT_WIDTH=8",
],
strip_include_prefix = "src",
linkstatic = True,
visibility = ["//visibility:public"],
)
# See below for explanation of why we need this.
#
# https://github.com/bazelbuild/bazel/issues/680
cc_library(
name = "pcre2posix_dotc_headers",
hdrs = [
"src/pcre2_tables.c",
],
strip_include_prefix = "src",
visibility = ["//visibility:private"],
)
cc_library(
name = "pcre2-posix",
srcs = [
"src/pcre2posix.c",
":config_h_generic",
srcs = ["src/pcre2posix.c"],
hdrs = ["src/pcre2posix.h"],
implementation_deps = [
":pcre2_internal_headers",
":pcre2posix_dotc_headers",
],
hdrs = [
"src/pcre2posix.h",
],
local_defines = [
"HAVE_CONFIG_H",
"HAVE_MEMMOVE",
local_defines = LOCAL_DEFINES + [
"PCRE2_CODE_UNIT_WIDTH=8",
"PCRE2_STATIC",
"SUPPORT_UNICODE",
],
includes = ["src"],
strip_include_prefix = "src",
linkstatic = True,
visibility = ["//visibility:public"],
deps = [":pcre2"],
deps = [
":pcre2",
],
)
# Totally weird issue in Bazel. It won't let you #include any files unless they
@ -118,7 +151,6 @@ cc_library(
name = "pcre2test_dotc_headers",
hdrs = [
"src/pcre2_chkdint.c",
"src/pcre2_printint.c",
"src/pcre2_tables.c",
"src/pcre2_ucd.c",
"src/pcre2_valid_utf.c",
@ -129,27 +161,19 @@ cc_library(
cc_binary(
name = "pcre2test",
srcs = [
"src/pcre2test.c",
":config_h_generic",
],
local_defines = [
"HAVE_CONFIG_H",
"HAVE_MEMMOVE",
"HAVE_STRERROR",
"PCRE2_STATIC",
"SUPPORT_UNICODE",
"SUPPORT_PCRE2_8",
] + select({
"@platforms//os:windows": [],
"//conditions:default": ["HAVE_UNISTD_H"],
}),
srcs = ["src/pcre2test.c"],
linkopts = select({
"@platforms//os:windows": ["-STACK:2500000"],
"//conditions:default": [],
}),
local_defines = LOCAL_DEFINES,
visibility = ["//visibility:public"],
deps = [":pcre2test_dotc_headers", ":pcre2", ":pcre2-posix"],
deps = [
":pcre2",
":pcre2-posix",
":pcre2_internal_headers",
":pcre2test_dotc_headers",
],
)
filegroup(
@ -159,6 +183,7 @@ filegroup(
native_test(
name = "pcre2_test",
size = "small",
src = select({
"@platforms//os:windows": "RunTest.bat",
"//conditions:default": "RunTest",
@ -167,6 +192,8 @@ native_test(
"@platforms//os:windows": "RunTest.bat",
"//conditions:default": "RunTest",
}),
data = [":pcre2test", ":testdata"],
size = "small",
)
data = [
":pcre2test",
":testdata",
],
)

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
PCRE2 License
PCRE2 Licence
=============
| SPDX-License-Identifier: | BSD-3-Clause WITH PCRE2-exception |
@ -16,7 +16,8 @@ testdata directory is not copyrighted and is in the public domain.
The basic library functions are written in C and are freestanding. Also
included in the distribution is a just-in-time compiler that can be used to
optimize pattern matching. This is an optional feature that can be omitted when
the library is built.
the library is built. The just-in-time compiler is separately licensed under the
"2-clause BSD" licence.
COPYRIGHT
@ -53,6 +54,8 @@ COPYRIGHT
Copyright (c) 2009-2024 Zoltan Herczeg
All rights reserved.
The code in the `deps/sljit` directory has its own LICENSE file.
### All other contributions
Many other contributors have participated in the authorship of PCRE2. As PCRE2
@ -99,5 +102,3 @@ not apply all the way down a chain of software. If binary package A includes
PCRE2, it must respect the condition, but if package B is software that
includes package A, the condition is not imposed on package B unless it uses
PCRE2 independently.
End

View file

@ -1,9 +1,9 @@
module(
name = "pcre2",
version = "10.45",
version = "10.47",
compatibility_level = 1,
)
bazel_dep(name = "rules_cc", version = "0.0.1")
bazel_dep(name = "bazel_skylib", version = "1.2.1")
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_cc", version = "0.2.8")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "platforms", version = "1.0.0")

View file

@ -7,6 +7,12 @@ ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS="-I$(srcdir)/src"
## Set some variables to accumulate conditionally-set Automake targets.
CLEAN_LOCAL_TARGETS=
DISTCLEAN_LOCAL_TARGETS=
PHONY_TARGETS=
## Specify the documentation files that are distributed.
dist_doc_DATA = \
@ -22,6 +28,7 @@ lib_LTLIBRARIES =
# TESTS is for binary unit tests, check_SCRIPTS for script-based tests
TESTS =
XFAIL_TESTS =
check_SCRIPTS =
dist_noinst_SCRIPTS =
@ -38,12 +45,7 @@ noinst_PROGRAMS =
# we list them here.
CLEANFILES = \
pcre2_dftables \
pcre2_jit_test \
pcre2fuzzcheck-8 \
pcre2fuzzcheck-16 \
pcre2fuzzcheck-32 \
pcre2demo
pcre2_dftables
DISTCLEANFILES = src/config.h.in~
MAINTAINERCLEANFILES =
@ -56,14 +58,16 @@ EXTRA_DIST =
# These files contain additional m4 macros that are used by autoconf.
EXTRA_DIST += \
m4/ax_pthread.m4 m4/pcre2_visibility.m4
m4/ax_check_vscript.m4 \
m4/ax_pthread.m4 \
m4/pcre2_visibility.m4 \
m4/pcre2_zos.m4
# These are support files for building with Bazel or Zig
EXTRA_DIST += \
BUILD.bazel \
MODULE.bazel \
WORKSPACE.bazel \
build.zig
# These are support files for building under VMS
@ -97,8 +101,9 @@ src/pcre2.h.generic: src/pcre2.h.in configure.ac
# running configure in a new directory, it complains. For this reason, we move
# config.status out of the way while doing the default configuration. The
# resulting config.h is munged by perl to put #ifdefs round any #defines for
# macros with values, and to #undef all boolean macros such as HAVE_xxx and
# SUPPORT_xxx. We also get rid of any gcc-specific visibility settings.
# macros with values, and to #undef all boolean macros such as HAVE_xxx,
# SUPPORT_xxx, and PCRE2_STATIC/PCRE2POSIX_SHARED. We also get rid of any
# GCC-specific visibility settings.
src/config.h.generic: configure.ac
rm -rf $@ _generic
@ -108,13 +113,13 @@ src/config.h.generic: configure.ac
cs=$(srcdir)/config.status; test ! -f $$cs.aside || mv -f $$cs.aside $$cs
test -f _generic/src/config.h
perl -n \
-e 'BEGIN{$$blank=0;}' \
-e 'if(/(.+?)\s*__attribute__ \(\(visibility/){print"$$1\n";$$blank=0;next;}' \
-e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
_generic/src/config.h >$@
-e 'BEGIN{$$blank=0;}' \
-e 'if(/(.+?)\s*__attribute__ \(\(visibility/){print"$$1\n";$$blank=0;next;}' \
-e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+|PCRE2_STATIC|PCRE2POSIX_SHARED)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
_generic/src/config.h >$@
rm -rf _generic
MAINTAINERCLEANFILES += src/pcre2.h.generic src/config.h.generic
@ -143,9 +148,21 @@ src/pcre2_chartables.c: pcre2_dftables$(EXEEXT)
rm -f $@
./pcre2_dftables$(EXEEXT) $@
else
if WITH_EBCDIC
if WITH_EBCDIC_NL25
src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl25
rm -f $@
$(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl25 $(abs_builddir)/src/pcre2_chartables.c
else # WITH_EBCDIC_NL25
src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl15
rm -f $@
$(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl15 $(abs_builddir)/src/pcre2_chartables.c
endif # WITH_EBCDIC_NL25
else # WITH_EBCDIC
src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.dist
rm -f $@
$(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.dist $(abs_builddir)/src/pcre2_chartables.c
endif # WITH_EBCDIC
endif # WITH_REBUILD_CHARTABLES
BUILT_SOURCES = src/pcre2_chartables.c
@ -159,6 +176,7 @@ COMMON_SOURCES = \
src/pcre2_chkdint.c \
src/pcre2_compile.c \
src/pcre2_compile.h \
src/pcre2_compile_cgroup.c \
src/pcre2_compile_class.c \
src/pcre2_config.c \
src/pcre2_context.c \
@ -169,11 +187,10 @@ COMMON_SOURCES = \
src/pcre2_find_bracket.c \
src/pcre2_internal.h \
src/pcre2_intmodedep.h \
src/pcre2_jit_char_inc.h \
src/pcre2_jit_compile.c \
src/pcre2_maketables.c \
src/pcre2_match.c \
src/pcre2_match_data.c \
src/pcre2_match_next.c \
src/pcre2_newline.c \
src/pcre2_ord2utf.c \
src/pcre2_pattern_info.c \
@ -186,14 +203,11 @@ COMMON_SOURCES = \
src/pcre2_tables.c \
src/pcre2_ucd.c \
src/pcre2_ucp.h \
src/pcre2_ucptables_inc.h \
src/pcre2_util.h \
src/pcre2_valid_utf.c \
src/pcre2_xclass.c
# The pcre2_ucptables.c file is #included by pcre2_tables.c
EXTRA_DIST += src/pcre2_ucptables.c
if WITH_PCRE2_8
lib_LTLIBRARIES += libpcre2-8.la
libpcre2_8_la_SOURCES = \
@ -239,10 +253,12 @@ endif # WITH_PCRE2_32
# The pcre2_chartables.c.dist file is the default version of
# pcre2_chartables.c, used unless --enable-rebuild-chartables is specified.
EXTRA_DIST += src/pcre2_chartables.c.dist
EXTRA_DIST += \
src/pcre2_chartables.c.dist \
src/pcre2_chartables.c.ebcdic-1047-nl15 \
src/pcre2_chartables.c.ebcdic-1047-nl25
CLEANFILES += src/pcre2_chartables.c
if WITH_PCRE2_8
libpcre2_8_la_LDFLAGS = $(EXTRA_LIBPCRE2_8_LDFLAGS)
endif # WITH_PCRE2_8
@ -292,9 +308,44 @@ libpcre2_posix_la_CFLAGS += $(GCOV_CFLAGS)
endif # WITH_GCOV
endif # WITH_PCRE2_8
## If fuzzer support is enabled, build a non-distributed library containing the
## fuzzing function. Also build the standalone checking binary from the same
## source but using -DSTANDALONE.
## -------- Testing ----------
# RunTest and RunGrepTest should clean up after themselves, but just in case
# they don't, add their working files to CLEANFILES.
CLEANFILES += \
testSinput \
testSoutput \
test3input \
test3output \
test3outputA \
test3outputB \
testtry \
teststdout \
teststderr \
teststderrgrep \
testtemp1grep \
testtemp2grep \
testtrygrep \
testNinputgrep
testoutput-clean:
-rm -rf testoutput8 testoutput8-jit testoutput8-dfa
-rm -rf testoutput16 testoutput16-jit testoutput16-dfa
-rm -rf testoutput32 testoutput32-jit testoutput32-dfa
CLEAN_LOCAL_TARGETS += testoutput-clean
PHONY_TARGETS += testoutput-clean
## ------------ End of testing -------------
# Symbol version files for use with GNU and Sun ld.
EXTRA_DIST += \
src/libpcre2-8.sym src/libpcre2-16.sym src/libpcre2-32.sym \
src/libpcre2-posix.sym
# gcov/lcov code coverage reporting
#
@ -375,35 +426,48 @@ coverage-clean: coverage-reset coverage-clean-report coverage-clean-data
coverage-distclean: coverage-clean
coverage: coverage-reset coverage-baseline coverage-check coverage-report
clean-local: coverage-clean
distclean-local: coverage-distclean
.PHONY: coverage coverage-baseline coverage-check coverage-report coverage-reset coverage-clean-report coverage-clean-data coverage-clean coverage-distclean
# Without coverage support, still arrange for 'make distclean' to get rid of
# any coverage files that may have been left from a different configuration.
CLEAN_LOCAL_TARGETS += coverage-clean
DISTCLEAN_LOCAL_TARGETS += coverage-distclean
PHONY_TARGETS += coverage coverage-baseline coverage-check coverage-report coverage-reset coverage-clean-report coverage-clean-data coverage-clean coverage-distclean
else
coverage:
@echo "Configuring with --enable-coverage is required to generate code coverage report."
# Without coverage support, still arrange for 'make distclean' to get rid of
# any coverage files that may have been left from a different configuration.
DISTCLEANFILES += src/*.gcda src/*.gcno
distclean-local:
coverage-distclean:
rm -rf $(PACKAGE)-$(VERSION)-coverage*
DISTCLEAN_LOCAL_TARGETS += coverage-distclean
PHONY_TARGETS += coverage-distclean
endif # WITH_GCOV
## CMake support
EXTRA_DIST += \
cmake/COPYING-CMAKE-SCRIPTS \
cmake/FindEditline.cmake \
cmake/FindReadline.cmake \
cmake/pcre2-config-version.cmake.in \
cmake/pcre2-config.cmake.in \
CMakeLists.txt \
config-cmake.h.in
cmake/PCRE2CheckVscript.cmake \
cmake/PCRE2UseSystemExtensions.cmake \
cmake/PCRE2WarningAsError.cmake \
src/config-cmake.h.in \
CMakeLists.txt
## Set the special make and Automake targets. We could very easily simply
## redefine these targets to append prerequisites to them, rather than
## collecting the prerequisites in variables. However, there is an annoying
## Automake behaviour where it emits a warning if a target has prerequisites
## appended in a conditional block.
clean-local: $(CLEAN_LOCAL_TARGETS)
distclean-local: $(DISTCLEAN_LOCAL_TARGETS)
.PHONY: $(PHONY_TARGETS)
## end Makefile.am

View file

@ -93,6 +93,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
TESTS =
XFAIL_TESTS =
bin_PROGRAMS =
noinst_PROGRAMS = $(am__EXEEXT_1)
@WITH_REBUILD_CHARTABLES_TRUE@am__append_1 = pcre2_dftables
@ -107,15 +108,23 @@ noinst_PROGRAMS = $(am__EXEEXT_1)
@WITH_GCOV_TRUE@@WITH_PCRE2_32_TRUE@am__append_10 = $(GCOV_CFLAGS)
@WITH_PCRE2_8_TRUE@am__append_11 = libpcre2-posix.la
@WITH_GCOV_TRUE@@WITH_PCRE2_8_TRUE@am__append_12 = $(GCOV_CFLAGS)
@WITH_GCOV_FALSE@am__append_13 = src/*.gcda src/*.gcno
@WITH_GCOV_TRUE@am__append_13 = coverage-clean
@WITH_GCOV_TRUE@am__append_14 = coverage-distclean
@WITH_GCOV_TRUE@am__append_15 = coverage coverage-baseline coverage-check coverage-report coverage-reset coverage-clean-report coverage-clean-data coverage-clean coverage-distclean
# Without coverage support, still arrange for 'make distclean' to get rid of
# any coverage files that may have been left from a different configuration.
@WITH_GCOV_FALSE@am__append_16 = src/*.gcda src/*.gcno
@WITH_GCOV_FALSE@am__append_17 = coverage-distclean
@WITH_GCOV_FALSE@am__append_18 = coverage-distclean
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_vscript.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/pcre2_visibility.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/pcre2_zos.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@ -163,22 +172,24 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libpcre2_16_la_DEPENDENCIES =
am__libpcre2_16_la_SOURCES_DIST = src/pcre2_auto_possess.c \
src/pcre2_chkdint.c src/pcre2_compile.c src/pcre2_compile.h \
src/pcre2_compile_class.c src/pcre2_config.c \
src/pcre2_context.c src/pcre2_convert.c src/pcre2_dfa_match.c \
src/pcre2_error.c src/pcre2_extuni.c src/pcre2_find_bracket.c \
src/pcre2_internal.h src/pcre2_intmodedep.h \
src/pcre2_jit_char_inc.h src/pcre2_jit_compile.c \
src/pcre2_maketables.c src/pcre2_match.c \
src/pcre2_match_data.c src/pcre2_newline.c src/pcre2_ord2utf.c \
src/pcre2_compile_cgroup.c src/pcre2_compile_class.c \
src/pcre2_config.c src/pcre2_context.c src/pcre2_convert.c \
src/pcre2_dfa_match.c src/pcre2_error.c src/pcre2_extuni.c \
src/pcre2_find_bracket.c src/pcre2_internal.h \
src/pcre2_intmodedep.h src/pcre2_maketables.c \
src/pcre2_match.c src/pcre2_match_data.c \
src/pcre2_match_next.c src/pcre2_newline.c src/pcre2_ord2utf.c \
src/pcre2_pattern_info.c src/pcre2_script_run.c \
src/pcre2_serialize.c src/pcre2_string_utils.c \
src/pcre2_study.c src/pcre2_substitute.c src/pcre2_substring.c \
src/pcre2_tables.c src/pcre2_ucd.c src/pcre2_ucp.h \
src/pcre2_util.h src/pcre2_valid_utf.c src/pcre2_xclass.c
src/pcre2_ucptables_inc.h src/pcre2_util.h \
src/pcre2_valid_utf.c src/pcre2_xclass.c
am__dirstamp = $(am__leading_dot)dirstamp
am__objects_1 = src/libpcre2_16_la-pcre2_auto_possess.lo \
src/libpcre2_16_la-pcre2_chkdint.lo \
src/libpcre2_16_la-pcre2_compile.lo \
src/libpcre2_16_la-pcre2_compile_cgroup.lo \
src/libpcre2_16_la-pcre2_compile_class.lo \
src/libpcre2_16_la-pcre2_config.lo \
src/libpcre2_16_la-pcre2_context.lo \
@ -187,10 +198,10 @@ am__objects_1 = src/libpcre2_16_la-pcre2_auto_possess.lo \
src/libpcre2_16_la-pcre2_error.lo \
src/libpcre2_16_la-pcre2_extuni.lo \
src/libpcre2_16_la-pcre2_find_bracket.lo \
src/libpcre2_16_la-pcre2_jit_compile.lo \
src/libpcre2_16_la-pcre2_maketables.lo \
src/libpcre2_16_la-pcre2_match.lo \
src/libpcre2_16_la-pcre2_match_data.lo \
src/libpcre2_16_la-pcre2_match_next.lo \
src/libpcre2_16_la-pcre2_newline.lo \
src/libpcre2_16_la-pcre2_ord2utf.lo \
src/libpcre2_16_la-pcre2_pattern_info.lo \
@ -221,21 +232,23 @@ libpcre2_16_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
libpcre2_32_la_DEPENDENCIES =
am__libpcre2_32_la_SOURCES_DIST = src/pcre2_auto_possess.c \
src/pcre2_chkdint.c src/pcre2_compile.c src/pcre2_compile.h \
src/pcre2_compile_class.c src/pcre2_config.c \
src/pcre2_context.c src/pcre2_convert.c src/pcre2_dfa_match.c \
src/pcre2_error.c src/pcre2_extuni.c src/pcre2_find_bracket.c \
src/pcre2_internal.h src/pcre2_intmodedep.h \
src/pcre2_jit_char_inc.h src/pcre2_jit_compile.c \
src/pcre2_maketables.c src/pcre2_match.c \
src/pcre2_match_data.c src/pcre2_newline.c src/pcre2_ord2utf.c \
src/pcre2_compile_cgroup.c src/pcre2_compile_class.c \
src/pcre2_config.c src/pcre2_context.c src/pcre2_convert.c \
src/pcre2_dfa_match.c src/pcre2_error.c src/pcre2_extuni.c \
src/pcre2_find_bracket.c src/pcre2_internal.h \
src/pcre2_intmodedep.h src/pcre2_maketables.c \
src/pcre2_match.c src/pcre2_match_data.c \
src/pcre2_match_next.c src/pcre2_newline.c src/pcre2_ord2utf.c \
src/pcre2_pattern_info.c src/pcre2_script_run.c \
src/pcre2_serialize.c src/pcre2_string_utils.c \
src/pcre2_study.c src/pcre2_substitute.c src/pcre2_substring.c \
src/pcre2_tables.c src/pcre2_ucd.c src/pcre2_ucp.h \
src/pcre2_util.h src/pcre2_valid_utf.c src/pcre2_xclass.c
src/pcre2_ucptables_inc.h src/pcre2_util.h \
src/pcre2_valid_utf.c src/pcre2_xclass.c
am__objects_3 = src/libpcre2_32_la-pcre2_auto_possess.lo \
src/libpcre2_32_la-pcre2_chkdint.lo \
src/libpcre2_32_la-pcre2_compile.lo \
src/libpcre2_32_la-pcre2_compile_cgroup.lo \
src/libpcre2_32_la-pcre2_compile_class.lo \
src/libpcre2_32_la-pcre2_config.lo \
src/libpcre2_32_la-pcre2_context.lo \
@ -244,10 +257,10 @@ am__objects_3 = src/libpcre2_32_la-pcre2_auto_possess.lo \
src/libpcre2_32_la-pcre2_error.lo \
src/libpcre2_32_la-pcre2_extuni.lo \
src/libpcre2_32_la-pcre2_find_bracket.lo \
src/libpcre2_32_la-pcre2_jit_compile.lo \
src/libpcre2_32_la-pcre2_maketables.lo \
src/libpcre2_32_la-pcre2_match.lo \
src/libpcre2_32_la-pcre2_match_data.lo \
src/libpcre2_32_la-pcre2_match_next.lo \
src/libpcre2_32_la-pcre2_newline.lo \
src/libpcre2_32_la-pcre2_ord2utf.lo \
src/libpcre2_32_la-pcre2_pattern_info.lo \
@ -274,21 +287,23 @@ libpcre2_32_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
libpcre2_8_la_DEPENDENCIES =
am__libpcre2_8_la_SOURCES_DIST = src/pcre2_auto_possess.c \
src/pcre2_chkdint.c src/pcre2_compile.c src/pcre2_compile.h \
src/pcre2_compile_class.c src/pcre2_config.c \
src/pcre2_context.c src/pcre2_convert.c src/pcre2_dfa_match.c \
src/pcre2_error.c src/pcre2_extuni.c src/pcre2_find_bracket.c \
src/pcre2_internal.h src/pcre2_intmodedep.h \
src/pcre2_jit_char_inc.h src/pcre2_jit_compile.c \
src/pcre2_maketables.c src/pcre2_match.c \
src/pcre2_match_data.c src/pcre2_newline.c src/pcre2_ord2utf.c \
src/pcre2_compile_cgroup.c src/pcre2_compile_class.c \
src/pcre2_config.c src/pcre2_context.c src/pcre2_convert.c \
src/pcre2_dfa_match.c src/pcre2_error.c src/pcre2_extuni.c \
src/pcre2_find_bracket.c src/pcre2_internal.h \
src/pcre2_intmodedep.h src/pcre2_maketables.c \
src/pcre2_match.c src/pcre2_match_data.c \
src/pcre2_match_next.c src/pcre2_newline.c src/pcre2_ord2utf.c \
src/pcre2_pattern_info.c src/pcre2_script_run.c \
src/pcre2_serialize.c src/pcre2_string_utils.c \
src/pcre2_study.c src/pcre2_substitute.c src/pcre2_substring.c \
src/pcre2_tables.c src/pcre2_ucd.c src/pcre2_ucp.h \
src/pcre2_util.h src/pcre2_valid_utf.c src/pcre2_xclass.c
src/pcre2_ucptables_inc.h src/pcre2_util.h \
src/pcre2_valid_utf.c src/pcre2_xclass.c
am__objects_5 = src/libpcre2_8_la-pcre2_auto_possess.lo \
src/libpcre2_8_la-pcre2_chkdint.lo \
src/libpcre2_8_la-pcre2_compile.lo \
src/libpcre2_8_la-pcre2_compile_cgroup.lo \
src/libpcre2_8_la-pcre2_compile_class.lo \
src/libpcre2_8_la-pcre2_config.lo \
src/libpcre2_8_la-pcre2_context.lo \
@ -297,10 +312,10 @@ am__objects_5 = src/libpcre2_8_la-pcre2_auto_possess.lo \
src/libpcre2_8_la-pcre2_error.lo \
src/libpcre2_8_la-pcre2_extuni.lo \
src/libpcre2_8_la-pcre2_find_bracket.lo \
src/libpcre2_8_la-pcre2_jit_compile.lo \
src/libpcre2_8_la-pcre2_maketables.lo \
src/libpcre2_8_la-pcre2_match.lo \
src/libpcre2_8_la-pcre2_match_data.lo \
src/libpcre2_8_la-pcre2_match_next.lo \
src/libpcre2_8_la-pcre2_newline.lo \
src/libpcre2_8_la-pcre2_ord2utf.lo \
src/libpcre2_8_la-pcre2_pattern_info.lo \
@ -359,6 +374,7 @@ am__depfiles_remade = \
src/$(DEPDIR)/libpcre2_16_la-pcre2_chartables.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_chkdint.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_compile.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_config.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_context.Plo \
@ -367,10 +383,10 @@ am__depfiles_remade = \
src/$(DEPDIR)/libpcre2_16_la-pcre2_error.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_extuni.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_find_bracket.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_match.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_match_data.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_ord2utf.Plo \
src/$(DEPDIR)/libpcre2_16_la-pcre2_pattern_info.Plo \
@ -388,6 +404,7 @@ am__depfiles_remade = \
src/$(DEPDIR)/libpcre2_32_la-pcre2_chartables.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_chkdint.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_compile.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_config.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_context.Plo \
@ -396,10 +413,10 @@ am__depfiles_remade = \
src/$(DEPDIR)/libpcre2_32_la-pcre2_error.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_extuni.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_find_bracket.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_match.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_match_data.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_ord2utf.Plo \
src/$(DEPDIR)/libpcre2_32_la-pcre2_pattern_info.Plo \
@ -417,6 +434,7 @@ am__depfiles_remade = \
src/$(DEPDIR)/libpcre2_8_la-pcre2_chartables.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_chkdint.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_compile.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_config.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_context.Plo \
@ -425,10 +443,10 @@ am__depfiles_remade = \
src/$(DEPDIR)/libpcre2_8_la-pcre2_error.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_extuni.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_find_bracket.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_match.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_match_data.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_ord2utf.Plo \
src/$(DEPDIR)/libpcre2_8_la-pcre2_pattern_info.Plo \
@ -708,6 +726,7 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CET_CFLAGS = @CET_CFLAGS@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
@ -784,6 +803,7 @@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_CXX = @PTHREAD_CXX@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
SED = @SED@
@ -795,6 +815,7 @@ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
VALGRIND_LIBS = @VALGRIND_LIBS@
VERSION = @VERSION@
VISIBILITY_CFLAGS = @VISIBILITY_CFLAGS@
VSCRIPT_LDFLAGS = @VSCRIPT_LDFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@ -855,6 +876,9 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = "-I$(srcdir)/src"
CLEAN_LOCAL_TARGETS = testoutput-clean $(am__append_13)
DISTCLEAN_LOCAL_TARGETS = $(am__append_14) $(am__append_17)
PHONY_TARGETS = testoutput-clean $(am__append_15) $(am__append_18)
dist_doc_DATA = \
AUTHORS.md \
LICENCE.md \
@ -872,10 +896,14 @@ dist_noinst_SCRIPTS =
# those binaries that *this* configuration has created. If the configuration
# has been changed, some binaries may not get automatically deleted. Therefore
# we list them here.
CLEANFILES = pcre2_dftables pcre2_jit_test pcre2fuzzcheck-8 \
pcre2fuzzcheck-16 pcre2fuzzcheck-32 pcre2demo \
src/pcre2_chartables.c
DISTCLEANFILES = src/config.h.in~ $(am__append_13)
# RunTest and RunGrepTest should clean up after themselves, but just in case
# they don't, add their working files to CLEANFILES.
CLEANFILES = pcre2_dftables src/pcre2_chartables.c testSinput \
testSoutput test3input test3output test3outputA test3outputB \
testtry teststdout teststderr teststderrgrep testtemp1grep \
testtemp2grep testtrygrep testNinputgrep
DISTCLEANFILES = src/config.h.in~ $(am__append_16)
MAINTAINERCLEANFILES = src/pcre2.h.generic src/config.h.generic
# Additional files to bundle with the distribution, over and above what
@ -891,18 +919,24 @@ MAINTAINERCLEANFILES = src/pcre2.h.generic src/config.h.generic
# for the benefit of people who are building PCRE2 manually, without the
# Autotools support.
# The pcre2_ucptables.c file is #included by pcre2_tables.c
# The pcre2_chartables.c.dist file is the default version of
# pcre2_chartables.c, used unless --enable-rebuild-chartables is specified.
EXTRA_DIST = m4/ax_pthread.m4 m4/pcre2_visibility.m4 BUILD.bazel \
MODULE.bazel WORKSPACE.bazel build.zig vms/configure.com \
# Symbol version files for use with GNU and Sun ld.
EXTRA_DIST = m4/ax_check_vscript.m4 m4/ax_pthread.m4 \
m4/pcre2_visibility.m4 m4/pcre2_zos.m4 BUILD.bazel \
MODULE.bazel build.zig vms/configure.com \
vms/openvms_readme.txt vms/pcre2.h_patch vms/stdint.h \
src/pcre2.h.generic src/config.h.generic src/pcre2_ucptables.c \
src/pcre2_chartables.c.dist cmake/COPYING-CMAKE-SCRIPTS \
cmake/FindEditline.cmake cmake/FindReadline.cmake \
cmake/pcre2-config-version.cmake.in \
cmake/pcre2-config.cmake.in CMakeLists.txt config-cmake.h.in
src/pcre2.h.generic src/config.h.generic \
src/pcre2_chartables.c.dist \
src/pcre2_chartables.c.ebcdic-1047-nl15 \
src/pcre2_chartables.c.ebcdic-1047-nl25 src/libpcre2-8.sym \
src/libpcre2-16.sym src/libpcre2-32.sym src/libpcre2-posix.sym \
cmake/COPYING-CMAKE-SCRIPTS cmake/pcre2-config.cmake.in \
cmake/PCRE2CheckVscript.cmake \
cmake/PCRE2UseSystemExtensions.cmake \
cmake/PCRE2WarningAsError.cmake src/config-cmake.h.in \
CMakeLists.txt
# These are the header files we'll install. We do not distribute pcre2.h
# because it is generated from pcre2.h.in.
@ -919,6 +953,7 @@ COMMON_SOURCES = \
src/pcre2_chkdint.c \
src/pcre2_compile.c \
src/pcre2_compile.h \
src/pcre2_compile_cgroup.c \
src/pcre2_compile_class.c \
src/pcre2_config.c \
src/pcre2_context.c \
@ -929,11 +964,10 @@ COMMON_SOURCES = \
src/pcre2_find_bracket.c \
src/pcre2_internal.h \
src/pcre2_intmodedep.h \
src/pcre2_jit_char_inc.h \
src/pcre2_jit_compile.c \
src/pcre2_maketables.c \
src/pcre2_match.c \
src/pcre2_match_data.c \
src/pcre2_match_next.c \
src/pcre2_newline.c \
src/pcre2_ord2utf.c \
src/pcre2_pattern_info.c \
@ -946,6 +980,7 @@ COMMON_SOURCES = \
src/pcre2_tables.c \
src/pcre2_ucd.c \
src/pcre2_ucp.h \
src/pcre2_ucptables_inc.h \
src/pcre2_util.h \
src/pcre2_valid_utf.c \
src/pcre2_xclass.c
@ -1181,6 +1216,8 @@ src/libpcre2_16_la-pcre2_chkdint.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_compile.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_compile_cgroup.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_compile_class.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_config.lo: src/$(am__dirstamp) \
@ -1197,14 +1234,14 @@ src/libpcre2_16_la-pcre2_extuni.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_find_bracket.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_jit_compile.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_maketables.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_match.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_match_data.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_match_next.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_newline.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_16_la-pcre2_ord2utf.lo: src/$(am__dirstamp) \
@ -1242,6 +1279,8 @@ src/libpcre2_32_la-pcre2_chkdint.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_compile.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_compile_cgroup.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_compile_class.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_config.lo: src/$(am__dirstamp) \
@ -1258,14 +1297,14 @@ src/libpcre2_32_la-pcre2_extuni.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_find_bracket.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_jit_compile.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_maketables.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_match.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_match_data.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_match_next.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_newline.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_32_la-pcre2_ord2utf.lo: src/$(am__dirstamp) \
@ -1303,6 +1342,8 @@ src/libpcre2_8_la-pcre2_chkdint.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_compile.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_compile_cgroup.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_compile_class.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_config.lo: src/$(am__dirstamp) \
@ -1319,14 +1360,14 @@ src/libpcre2_8_la-pcre2_extuni.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_find_bracket.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_jit_compile.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_maketables.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_match.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_match_data.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_match_next.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_newline.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libpcre2_8_la-pcre2_ord2utf.lo: src/$(am__dirstamp) \
@ -1417,6 +1458,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_chartables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_chkdint.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_compile.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_config.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_context.Plo@am__quote@ # am--include-marker
@ -1425,10 +1467,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_error.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_extuni.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_find_bracket.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_match.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_match_data.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_ord2utf.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_16_la-pcre2_pattern_info.Plo@am__quote@ # am--include-marker
@ -1446,6 +1488,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_chartables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_chkdint.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_compile.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_config.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_context.Plo@am__quote@ # am--include-marker
@ -1454,10 +1497,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_error.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_extuni.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_find_bracket.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_match.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_match_data.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_ord2utf.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_32_la-pcre2_pattern_info.Plo@am__quote@ # am--include-marker
@ -1475,6 +1518,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_chartables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_chkdint.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_compile.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_config.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_context.Plo@am__quote@ # am--include-marker
@ -1483,10 +1527,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_error.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_extuni.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_find_bracket.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_match.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_match_data.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_ord2utf.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libpcre2_8_la-pcre2_pattern_info.Plo@am__quote@ # am--include-marker
@ -1554,6 +1598,13 @@ src/libpcre2_16_la-pcre2_compile.lo: src/pcre2_compile.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_16_la-pcre2_compile.lo `test -f 'src/pcre2_compile.c' || echo '$(srcdir)/'`src/pcre2_compile.c
src/libpcre2_16_la-pcre2_compile_cgroup.lo: src/pcre2_compile_cgroup.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_16_la-pcre2_compile_cgroup.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Tpo -c -o src/libpcre2_16_la-pcre2_compile_cgroup.lo `test -f 'src/pcre2_compile_cgroup.c' || echo '$(srcdir)/'`src/pcre2_compile_cgroup.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Tpo src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_compile_cgroup.c' object='src/libpcre2_16_la-pcre2_compile_cgroup.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_16_la-pcre2_compile_cgroup.lo `test -f 'src/pcre2_compile_cgroup.c' || echo '$(srcdir)/'`src/pcre2_compile_cgroup.c
src/libpcre2_16_la-pcre2_compile_class.lo: src/pcre2_compile_class.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_16_la-pcre2_compile_class.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Tpo -c -o src/libpcre2_16_la-pcre2_compile_class.lo `test -f 'src/pcre2_compile_class.c' || echo '$(srcdir)/'`src/pcre2_compile_class.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Tpo src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Plo
@ -1610,13 +1661,6 @@ src/libpcre2_16_la-pcre2_find_bracket.lo: src/pcre2_find_bracket.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_16_la-pcre2_find_bracket.lo `test -f 'src/pcre2_find_bracket.c' || echo '$(srcdir)/'`src/pcre2_find_bracket.c
src/libpcre2_16_la-pcre2_jit_compile.lo: src/pcre2_jit_compile.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_16_la-pcre2_jit_compile.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Tpo -c -o src/libpcre2_16_la-pcre2_jit_compile.lo `test -f 'src/pcre2_jit_compile.c' || echo '$(srcdir)/'`src/pcre2_jit_compile.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Tpo src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_jit_compile.c' object='src/libpcre2_16_la-pcre2_jit_compile.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_16_la-pcre2_jit_compile.lo `test -f 'src/pcre2_jit_compile.c' || echo '$(srcdir)/'`src/pcre2_jit_compile.c
src/libpcre2_16_la-pcre2_maketables.lo: src/pcre2_maketables.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_16_la-pcre2_maketables.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Tpo -c -o src/libpcre2_16_la-pcre2_maketables.lo `test -f 'src/pcre2_maketables.c' || echo '$(srcdir)/'`src/pcre2_maketables.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Tpo src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Plo
@ -1638,6 +1682,13 @@ src/libpcre2_16_la-pcre2_match_data.lo: src/pcre2_match_data.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_16_la-pcre2_match_data.lo `test -f 'src/pcre2_match_data.c' || echo '$(srcdir)/'`src/pcre2_match_data.c
src/libpcre2_16_la-pcre2_match_next.lo: src/pcre2_match_next.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_16_la-pcre2_match_next.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Tpo -c -o src/libpcre2_16_la-pcre2_match_next.lo `test -f 'src/pcre2_match_next.c' || echo '$(srcdir)/'`src/pcre2_match_next.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Tpo src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_match_next.c' object='src/libpcre2_16_la-pcre2_match_next.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_16_la-pcre2_match_next.lo `test -f 'src/pcre2_match_next.c' || echo '$(srcdir)/'`src/pcre2_match_next.c
src/libpcre2_16_la-pcre2_newline.lo: src/pcre2_newline.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_16_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_16_la-pcre2_newline.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Tpo -c -o src/libpcre2_16_la-pcre2_newline.lo `test -f 'src/pcre2_newline.c' || echo '$(srcdir)/'`src/pcre2_newline.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Tpo src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Plo
@ -1757,6 +1808,13 @@ src/libpcre2_32_la-pcre2_compile.lo: src/pcre2_compile.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_32_la-pcre2_compile.lo `test -f 'src/pcre2_compile.c' || echo '$(srcdir)/'`src/pcre2_compile.c
src/libpcre2_32_la-pcre2_compile_cgroup.lo: src/pcre2_compile_cgroup.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_32_la-pcre2_compile_cgroup.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Tpo -c -o src/libpcre2_32_la-pcre2_compile_cgroup.lo `test -f 'src/pcre2_compile_cgroup.c' || echo '$(srcdir)/'`src/pcre2_compile_cgroup.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Tpo src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_compile_cgroup.c' object='src/libpcre2_32_la-pcre2_compile_cgroup.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_32_la-pcre2_compile_cgroup.lo `test -f 'src/pcre2_compile_cgroup.c' || echo '$(srcdir)/'`src/pcre2_compile_cgroup.c
src/libpcre2_32_la-pcre2_compile_class.lo: src/pcre2_compile_class.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_32_la-pcre2_compile_class.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Tpo -c -o src/libpcre2_32_la-pcre2_compile_class.lo `test -f 'src/pcre2_compile_class.c' || echo '$(srcdir)/'`src/pcre2_compile_class.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Tpo src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Plo
@ -1813,13 +1871,6 @@ src/libpcre2_32_la-pcre2_find_bracket.lo: src/pcre2_find_bracket.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_32_la-pcre2_find_bracket.lo `test -f 'src/pcre2_find_bracket.c' || echo '$(srcdir)/'`src/pcre2_find_bracket.c
src/libpcre2_32_la-pcre2_jit_compile.lo: src/pcre2_jit_compile.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_32_la-pcre2_jit_compile.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Tpo -c -o src/libpcre2_32_la-pcre2_jit_compile.lo `test -f 'src/pcre2_jit_compile.c' || echo '$(srcdir)/'`src/pcre2_jit_compile.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Tpo src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_jit_compile.c' object='src/libpcre2_32_la-pcre2_jit_compile.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_32_la-pcre2_jit_compile.lo `test -f 'src/pcre2_jit_compile.c' || echo '$(srcdir)/'`src/pcre2_jit_compile.c
src/libpcre2_32_la-pcre2_maketables.lo: src/pcre2_maketables.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_32_la-pcre2_maketables.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Tpo -c -o src/libpcre2_32_la-pcre2_maketables.lo `test -f 'src/pcre2_maketables.c' || echo '$(srcdir)/'`src/pcre2_maketables.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Tpo src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Plo
@ -1841,6 +1892,13 @@ src/libpcre2_32_la-pcre2_match_data.lo: src/pcre2_match_data.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_32_la-pcre2_match_data.lo `test -f 'src/pcre2_match_data.c' || echo '$(srcdir)/'`src/pcre2_match_data.c
src/libpcre2_32_la-pcre2_match_next.lo: src/pcre2_match_next.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_32_la-pcre2_match_next.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Tpo -c -o src/libpcre2_32_la-pcre2_match_next.lo `test -f 'src/pcre2_match_next.c' || echo '$(srcdir)/'`src/pcre2_match_next.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Tpo src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_match_next.c' object='src/libpcre2_32_la-pcre2_match_next.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_32_la-pcre2_match_next.lo `test -f 'src/pcre2_match_next.c' || echo '$(srcdir)/'`src/pcre2_match_next.c
src/libpcre2_32_la-pcre2_newline.lo: src/pcre2_newline.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_32_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_32_la-pcre2_newline.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Tpo -c -o src/libpcre2_32_la-pcre2_newline.lo `test -f 'src/pcre2_newline.c' || echo '$(srcdir)/'`src/pcre2_newline.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Tpo src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Plo
@ -1960,6 +2018,13 @@ src/libpcre2_8_la-pcre2_compile.lo: src/pcre2_compile.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_8_la-pcre2_compile.lo `test -f 'src/pcre2_compile.c' || echo '$(srcdir)/'`src/pcre2_compile.c
src/libpcre2_8_la-pcre2_compile_cgroup.lo: src/pcre2_compile_cgroup.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_8_la-pcre2_compile_cgroup.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Tpo -c -o src/libpcre2_8_la-pcre2_compile_cgroup.lo `test -f 'src/pcre2_compile_cgroup.c' || echo '$(srcdir)/'`src/pcre2_compile_cgroup.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Tpo src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_compile_cgroup.c' object='src/libpcre2_8_la-pcre2_compile_cgroup.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_8_la-pcre2_compile_cgroup.lo `test -f 'src/pcre2_compile_cgroup.c' || echo '$(srcdir)/'`src/pcre2_compile_cgroup.c
src/libpcre2_8_la-pcre2_compile_class.lo: src/pcre2_compile_class.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_8_la-pcre2_compile_class.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Tpo -c -o src/libpcre2_8_la-pcre2_compile_class.lo `test -f 'src/pcre2_compile_class.c' || echo '$(srcdir)/'`src/pcre2_compile_class.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Tpo src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Plo
@ -2016,13 +2081,6 @@ src/libpcre2_8_la-pcre2_find_bracket.lo: src/pcre2_find_bracket.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_8_la-pcre2_find_bracket.lo `test -f 'src/pcre2_find_bracket.c' || echo '$(srcdir)/'`src/pcre2_find_bracket.c
src/libpcre2_8_la-pcre2_jit_compile.lo: src/pcre2_jit_compile.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_8_la-pcre2_jit_compile.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Tpo -c -o src/libpcre2_8_la-pcre2_jit_compile.lo `test -f 'src/pcre2_jit_compile.c' || echo '$(srcdir)/'`src/pcre2_jit_compile.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Tpo src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_jit_compile.c' object='src/libpcre2_8_la-pcre2_jit_compile.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_8_la-pcre2_jit_compile.lo `test -f 'src/pcre2_jit_compile.c' || echo '$(srcdir)/'`src/pcre2_jit_compile.c
src/libpcre2_8_la-pcre2_maketables.lo: src/pcre2_maketables.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_8_la-pcre2_maketables.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Tpo -c -o src/libpcre2_8_la-pcre2_maketables.lo `test -f 'src/pcre2_maketables.c' || echo '$(srcdir)/'`src/pcre2_maketables.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Tpo src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Plo
@ -2044,6 +2102,13 @@ src/libpcre2_8_la-pcre2_match_data.lo: src/pcre2_match_data.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_8_la-pcre2_match_data.lo `test -f 'src/pcre2_match_data.c' || echo '$(srcdir)/'`src/pcre2_match_data.c
src/libpcre2_8_la-pcre2_match_next.lo: src/pcre2_match_next.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_8_la-pcre2_match_next.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Tpo -c -o src/libpcre2_8_la-pcre2_match_next.lo `test -f 'src/pcre2_match_next.c' || echo '$(srcdir)/'`src/pcre2_match_next.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Tpo src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/pcre2_match_next.c' object='src/libpcre2_8_la-pcre2_match_next.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -c -o src/libpcre2_8_la-pcre2_match_next.lo `test -f 'src/pcre2_match_next.c' || echo '$(srcdir)/'`src/pcre2_match_next.c
src/libpcre2_8_la-pcre2_newline.lo: src/pcre2_newline.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpcre2_8_la_CFLAGS) $(CFLAGS) -MT src/libpcre2_8_la-pcre2_newline.lo -MD -MP -MF src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Tpo -c -o src/libpcre2_8_la-pcre2_newline.lo `test -f 'src/pcre2_newline.c' || echo '$(srcdir)/'`src/pcre2_newline.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Tpo src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Plo
@ -2660,7 +2725,6 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
@WITH_GCOV_FALSE@clean-local:
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
@ -2672,6 +2736,7 @@ distclean: distclean-am
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_chartables.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_chkdint.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_config.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_context.Plo
@ -2680,10 +2745,10 @@ distclean: distclean-am
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_error.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_extuni.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_find_bracket.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_match.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_match_data.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_ord2utf.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_pattern_info.Plo
@ -2701,6 +2766,7 @@ distclean: distclean-am
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_chartables.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_chkdint.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_config.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_context.Plo
@ -2709,10 +2775,10 @@ distclean: distclean-am
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_error.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_extuni.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_find_bracket.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_match.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_match_data.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_ord2utf.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_pattern_info.Plo
@ -2730,6 +2796,7 @@ distclean: distclean-am
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_chartables.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_chkdint.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_config.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_context.Plo
@ -2738,10 +2805,10 @@ distclean: distclean-am
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_error.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_extuni.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_find_bracket.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_match.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_match_data.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_ord2utf.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_pattern_info.Plo
@ -2810,6 +2877,7 @@ maintainer-clean: maintainer-clean-am
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_chartables.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_chkdint.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_cgroup.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_compile_class.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_config.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_context.Plo
@ -2818,10 +2886,10 @@ maintainer-clean: maintainer-clean-am
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_error.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_extuni.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_find_bracket.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_jit_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_maketables.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_match.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_match_data.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_match_next.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_newline.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_ord2utf.Plo
-rm -f src/$(DEPDIR)/libpcre2_16_la-pcre2_pattern_info.Plo
@ -2839,6 +2907,7 @@ maintainer-clean: maintainer-clean-am
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_chartables.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_chkdint.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_cgroup.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_compile_class.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_config.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_context.Plo
@ -2847,10 +2916,10 @@ maintainer-clean: maintainer-clean-am
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_error.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_extuni.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_find_bracket.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_jit_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_maketables.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_match.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_match_data.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_match_next.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_newline.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_ord2utf.Plo
-rm -f src/$(DEPDIR)/libpcre2_32_la-pcre2_pattern_info.Plo
@ -2868,6 +2937,7 @@ maintainer-clean: maintainer-clean-am
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_chartables.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_chkdint.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_cgroup.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_compile_class.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_config.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_context.Plo
@ -2876,10 +2946,10 @@ maintainer-clean: maintainer-clean-am
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_error.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_extuni.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_find_bracket.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_jit_compile.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_maketables.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_match.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_match_data.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_match_next.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_newline.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_ord2utf.Plo
-rm -f src/$(DEPDIR)/libpcre2_8_la-pcre2_pattern_info.Plo
@ -2961,8 +3031,9 @@ src/pcre2.h.generic: src/pcre2.h.in configure.ac
# running configure in a new directory, it complains. For this reason, we move
# config.status out of the way while doing the default configuration. The
# resulting config.h is munged by perl to put #ifdefs round any #defines for
# macros with values, and to #undef all boolean macros such as HAVE_xxx and
# SUPPORT_xxx. We also get rid of any gcc-specific visibility settings.
# macros with values, and to #undef all boolean macros such as HAVE_xxx,
# SUPPORT_xxx, and PCRE2_STATIC/PCRE2POSIX_SHARED. We also get rid of any
# GCC-specific visibility settings.
src/config.h.generic: configure.ac
rm -rf $@ _generic
@ -2972,20 +3043,31 @@ src/config.h.generic: configure.ac
cs=$(srcdir)/config.status; test ! -f $$cs.aside || mv -f $$cs.aside $$cs
test -f _generic/src/config.h
perl -n \
-e 'BEGIN{$$blank=0;}' \
-e 'if(/(.+?)\s*__attribute__ \(\(visibility/){print"$$1\n";$$blank=0;next;}' \
-e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
_generic/src/config.h >$@
-e 'BEGIN{$$blank=0;}' \
-e 'if(/(.+?)\s*__attribute__ \(\(visibility/){print"$$1\n";$$blank=0;next;}' \
-e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+|PCRE2_STATIC|PCRE2POSIX_SHARED)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
_generic/src/config.h >$@
rm -rf _generic
@WITH_REBUILD_CHARTABLES_TRUE@src/pcre2_chartables.c: pcre2_dftables$(EXEEXT)
@WITH_REBUILD_CHARTABLES_TRUE@ rm -f $@
@WITH_REBUILD_CHARTABLES_TRUE@ ./pcre2_dftables$(EXEEXT) $@
@WITH_REBUILD_CHARTABLES_FALSE@src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.dist
@WITH_REBUILD_CHARTABLES_FALSE@ rm -f $@
@WITH_REBUILD_CHARTABLES_FALSE@ $(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.dist $(abs_builddir)/src/pcre2_chartables.c
@WITH_EBCDIC_NL25_TRUE@@WITH_EBCDIC_TRUE@@WITH_REBUILD_CHARTABLES_FALSE@src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl25
@WITH_EBCDIC_NL25_TRUE@@WITH_EBCDIC_TRUE@@WITH_REBUILD_CHARTABLES_FALSE@ rm -f $@
@WITH_EBCDIC_NL25_TRUE@@WITH_EBCDIC_TRUE@@WITH_REBUILD_CHARTABLES_FALSE@ $(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl25 $(abs_builddir)/src/pcre2_chartables.c
@WITH_EBCDIC_NL25_FALSE@@WITH_EBCDIC_TRUE@@WITH_REBUILD_CHARTABLES_FALSE@src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl15
@WITH_EBCDIC_NL25_FALSE@@WITH_EBCDIC_TRUE@@WITH_REBUILD_CHARTABLES_FALSE@ rm -f $@
@WITH_EBCDIC_NL25_FALSE@@WITH_EBCDIC_TRUE@@WITH_REBUILD_CHARTABLES_FALSE@ $(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.ebcdic-1047-nl15 $(abs_builddir)/src/pcre2_chartables.c
@WITH_EBCDIC_FALSE@@WITH_REBUILD_CHARTABLES_FALSE@src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.dist
@WITH_EBCDIC_FALSE@@WITH_REBUILD_CHARTABLES_FALSE@ rm -f $@
@WITH_EBCDIC_FALSE@@WITH_REBUILD_CHARTABLES_FALSE@ $(LN_S) $(abs_srcdir)/src/pcre2_chartables.c.dist $(abs_builddir)/src/pcre2_chartables.c
testoutput-clean:
-rm -rf testoutput8 testoutput8-jit testoutput8-dfa
-rm -rf testoutput16 testoutput16-jit testoutput16-dfa
-rm -rf testoutput32 testoutput32-jit testoutput32-dfa
@WITH_GCOV_TRUE@coverage-check: all
@WITH_GCOV_TRUE@ -$(MAKE) $(AM_MAKEFLAGS) -k check
@ -3039,20 +3121,17 @@ src/config.h.generic: configure.ac
@WITH_GCOV_TRUE@coverage-distclean: coverage-clean
@WITH_GCOV_TRUE@coverage: coverage-reset coverage-baseline coverage-check coverage-report
@WITH_GCOV_TRUE@clean-local: coverage-clean
@WITH_GCOV_TRUE@distclean-local: coverage-distclean
@WITH_GCOV_TRUE@.PHONY: coverage coverage-baseline coverage-check coverage-report coverage-reset coverage-clean-report coverage-clean-data coverage-clean coverage-distclean
# Without coverage support, still arrange for 'make distclean' to get rid of
# any coverage files that may have been left from a different configuration.
@WITH_GCOV_FALSE@coverage:
@WITH_GCOV_FALSE@ @echo "Configuring with --enable-coverage is required to generate code coverage report."
@WITH_GCOV_FALSE@distclean-local:
@WITH_GCOV_FALSE@coverage-distclean:
@WITH_GCOV_FALSE@ rm -rf $(PACKAGE)-$(VERSION)-coverage*
clean-local: $(CLEAN_LOCAL_TARGETS)
distclean-local: $(DISTCLEAN_LOCAL_TARGETS)
.PHONY: $(PHONY_TARGETS)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -18,6 +18,7 @@ src/pcre2grep.c
src/pcre2demo.c
src/pcre2_fuzzsupport.c
src/pcre2_printint.c
src/pcre2_jit_compile.c
src/pcre2_jit_char_inc.h
src/pcre2_jit_match.c
src/pcre2_jit_misc.c
@ -42,6 +43,6 @@ README
INSTALL
NON-AUTOTOOLS-BUILDS
o Made relevant changes to Makefile.am, configure.ac, CMakeLists.txt, and
src/pcre2_jit_compile.c to accommodate our smaller, non-JIT build
and to disable Unicode support by default.
o Made relevant changes to Makefile.am, configure.ac, and CMakeLists.txt to
accommodate our smaller, non-JIT build and to disable Unicode support by
default.

View file

@ -1,6 +1,8 @@
# Security policies
Security policies
=================
## Release security
Release security
----------------
The PCRE2 project provides source-only releases, with no binaries.
@ -20,7 +22,14 @@ Git checkout of the (GPG-signed) release tag.
Please contact the maintainers for any queries about release integrity or the
project's supply-chain.
## Reporting vulnerabilities
Previous vulnerabilities
------------------------
* CVE-2025-58050 (August 2025). Affects 10.45 only (not earlier), and is fixed
in 10.46.
Reporting vulnerabilities
-------------------------
The PCRE2 project prioritises security. We appreciate third-party testing and
security research, and would be grateful if you could responsibly disclose your
@ -38,7 +47,13 @@ aim to respond within 1 week, or perhaps 2 during holidays.
### Response procedure
PCRE2 has never previously made a rapid or embargoed release in response to a
security incident. We would work with security managers from trusted downstream
distributors, such as major Linux distributions, before disclosing the
vulnerability publicly.
PCRE2 has in the past made at least one rapid release in response to
security incidents.
We have never produced an embargoed release, or provided preferential
access to security fixes to any clients.
We would aim to notify security managers from trusted downstream distributors,
such as major Linux distributions, via the `pcre2-dev` mailing list, by
publicly signalling an upcoming security release before disclosing the
vulnerability publicly, where advance notification is possible.

View file

@ -1 +0,0 @@
# See MODULE.bazel

2
libpcre/aclocal.m4 vendored
View file

@ -1588,6 +1588,7 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/ax_check_vscript.m4])
m4_include([m4/ax_pthread.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
@ -1595,3 +1596,4 @@ m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
m4_include([m4/pcre2_visibility.m4])
m4_include([m4/pcre2_zos.m4])

View file

@ -11,13 +11,14 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const linkage = b.option(std.builtin.LinkMode, "linkage", "whether to statically or dynamically link the library") orelse @as(std.builtin.LinkMode, if (target.result.isGnuLibC()) .dynamic else .static);
const codeUnitWidth = b.option(CodeUnitWidth, "code-unit-width", "Sets the code unit width") orelse .@"8";
const jit = b.option(bool, "support_jit", "Enable/disable JIT compiler support") orelse false;
const pcre2_header_dir = b.addWriteFiles();
const pcre2_header = pcre2_header_dir.addCopyFile(b.path("src/pcre2.h.generic"), "pcre2.h");
const config_header = b.addConfigHeader(
.{
.style = .{ .cmake = b.path("config-cmake.h.in") },
.style = .{ .cmake = b.path("src/config-cmake.h.in") },
.include_path = "config.h",
},
.{
@ -25,13 +26,15 @@ pub fn build(b: *std.Build) !void {
.HAVE_UNISTD_H = (target.result.os.tag != .windows),
.HAVE_WINDOWS_H = (target.result.os.tag == .windows),
.HAVE_MEMMOVE = true,
.HAVE_STRERROR = true,
.HAVE_ATTRIBUTE_UNINITIALIZED = true,
.HAVE_BUILTIN_MUL_OVERFLOW = true,
.HAVE_BUILTIN_UNREACHABLE = true,
.SUPPORT_PCRE2_8 = codeUnitWidth == CodeUnitWidth.@"8",
.SUPPORT_PCRE2_16 = codeUnitWidth == CodeUnitWidth.@"16",
.SUPPORT_PCRE2_32 = codeUnitWidth == CodeUnitWidth.@"32",
.SUPPORT_UNICODE = true,
.SUPPORT_JIT = jit,
.PCRE2_EXPORT = null,
.PCRE2_LINK_SIZE = 2,
@ -41,28 +44,31 @@ pub fn build(b: *std.Build) !void {
.PCRE2_MAX_VARLOOKBEHIND = 255,
.NEWLINE_DEFAULT = 2,
.PCRE2_PARENS_NEST_LIMIT = 250,
.PCRE2GREP_BUFSIZE = 20480,
.PCRE2GREP_MAX_BUFSIZE = 1048576,
},
);
// pcre2-8/16/32.so
// pcre2-8/16/32 library
const lib = std.Build.Step.Compile.create(b, .{
.name = b.fmt("pcre2-{s}", .{@tagName(codeUnitWidth)}),
.root_module = .{
.target = target,
.optimize = optimize,
.link_libc = true,
},
.kind = .lib,
.linkage = linkage,
const lib_mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
});
lib.defineCMacro("HAVE_CONFIG_H", null);
lib.defineCMacro("PCRE2_CODE_UNIT_WIDTH", @tagName(codeUnitWidth));
lib_mod.addCMacro("HAVE_CONFIG_H", "");
lib_mod.addCMacro("PCRE2_CODE_UNIT_WIDTH", @tagName(codeUnitWidth));
if (linkage == .static) {
lib.defineCMacro("PCRE2_STATIC", null);
lib_mod.addCMacro("PCRE2_STATIC", "");
}
const lib = b.addLibrary(.{
.name = b.fmt("pcre2-{s}", .{@tagName(codeUnitWidth)}),
.root_module = lib_mod,
.linkage = linkage,
});
lib.addConfigHeader(config_header);
lib.addIncludePath(pcre2_header_dir.getDirectory());
lib.addIncludePath(b.path("src"));
@ -76,6 +82,7 @@ pub fn build(b: *std.Build) !void {
"src/pcre2_auto_possess.c",
"src/pcre2_chkdint.c",
"src/pcre2_compile.c",
"src/pcre2_compile_cgroup.c",
"src/pcre2_compile_class.c",
"src/pcre2_config.c",
"src/pcre2_context.c",
@ -88,6 +95,7 @@ pub fn build(b: *std.Build) !void {
"src/pcre2_maketables.c",
"src/pcre2_match.c",
"src/pcre2_match_data.c",
"src/pcre2_match_next.c",
"src/pcre2_newline.c",
"src/pcre2_ord2utf.c",
"src/pcre2_pattern_info.c",
@ -107,36 +115,49 @@ pub fn build(b: *std.Build) !void {
lib.installHeader(pcre2_header, "pcre2.h");
b.installArtifact(lib);
// pcre2test
const pcre2test_mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
});
pcre2test_mod.addCMacro("HAVE_CONFIG_H", "");
if (linkage == .static) {
pcre2test_mod.addCMacro("PCRE2_STATIC", "");
} else {
pcre2test_mod.addCMacro("PCRE2POSIX_SHARED", "");
}
const pcre2test = b.addExecutable(.{
.name = "pcre2test",
.target = target,
.optimize = optimize,
.root_module = pcre2test_mod,
});
// pcre2-posix.so
// pcre2-posix library
if (codeUnitWidth == CodeUnitWidth.@"8") {
const posixLib = std.Build.Step.Compile.create(b, .{
.name = "pcre2-posix",
.root_module = .{
.target = target,
.optimize = optimize,
.link_libc = true,
},
.kind = .lib,
.linkage = linkage,
const posixLib_mod = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
});
posixLib.defineCMacro("HAVE_CONFIG_H", null);
posixLib.defineCMacro("PCRE2_CODE_UNIT_WIDTH", @tagName(codeUnitWidth));
posixLib_mod.addCMacro("HAVE_CONFIG_H", "");
posixLib_mod.addCMacro("PCRE2_CODE_UNIT_WIDTH", @tagName(codeUnitWidth));
if (linkage == .static) {
posixLib.defineCMacro("PCRE2_STATIC", null);
posixLib_mod.addCMacro("PCRE2_STATIC", "");
} else {
posixLib_mod.addCMacro("PCRE2POSIX_SHARED", "");
}
const posixLib = b.addLibrary(.{
.name = "pcre2-posix",
.root_module = posixLib_mod,
.linkage = linkage,
});
posixLib.addConfigHeader(config_header);
posixLib.addIncludePath(pcre2_header_dir.getDirectory());
posixLib.addIncludePath(b.path("src"));
@ -147,17 +168,16 @@ pub fn build(b: *std.Build) !void {
},
});
posixLib.linkLibrary(lib);
posixLib.installHeader(b.path("src/pcre2posix.h"), "pcre2posix.h");
b.installArtifact(posixLib);
pcre2test.linkLibrary(posixLib);
}
// pcre2test (again)
pcre2test.defineCMacro("HAVE_CONFIG_H", null);
pcre2test.addConfigHeader(config_header);
pcre2test.addIncludePath(pcre2_header_dir.getDirectory());
pcre2test.addIncludePath(b.path("src"));
@ -166,7 +186,6 @@ pub fn build(b: *std.Build) !void {
.file = b.path("src/pcre2test.c"),
});
pcre2test.linkLibC();
pcre2test.linkLibrary(lib);
b.installArtifact(pcre2test);

View file

@ -0,0 +1,112 @@
# Similarly to Autoconf's ax_check_vscript.m4, check whether the linker supports
# version scripts (GNU ld) or map files (Sun linker).
# Sets the "have_var" to TRUE or FALSE depending on the detected support; and if
# support is detected then sets "flag_var" to the appropriate flag to pass to
# the linker (namely, --version-script or -M).
function(pcre2_check_vscript have_var flag_var)
set(${have_var} FALSE PARENT_SCOPE)
set(${flag_var} "" PARENT_SCOPE)
if(MSVC)
return()
endif()
set(first_run FALSE)
if(NOT DEFINED HAVE_VSCRIPT_GNU)
set(first_run TRUE)
message(STATUS "Detecting linker version script support")
endif()
include(CheckCSourceCompiles)
include(CMakePushCheckState)
# The BSD file here is a workaround for the fact that check_c_source_compiles
# very unfortunately only supports linking executables
# with an entrypoint (or a static library), and yet the symbol visibility
# requirements for executables are understandably different on some platforms
# as compared to linking a shared library. On FreeBSD, linking fails if you
# use the linker script to hide various global symbols from /usr/lib/crt1.o.
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269370
# Basically, everyone using --version-script is actually going to be creating
# a shared library. It's a frustrating mismatch.
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file.sym "PCRE2_10.00 { global: exposethis; local: *; };")
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file-bsd.sym "PCRE2_10.00 { global: exposethis; environ; __progname; local: *; };")
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file-broken.sym "PCRE2_10.00 { global: exposethis; local: *; }; {")
set(HAVE_VSCRIPT FALSE)
# Using an executable to check for version-script support is rather delicate,
# because linking in an entrypoint (main) adds extra symbols into the mix.
# If CMake ever added a SHARED_LIBRARY option to check_c_source_compiles, we'd
# use it here.
set(
test_source
[=[
int exposethis = 0, hidethis = 0;
int main(void) {
return exposethis + hidethis;
}
]=]
)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_QUIET TRUE)
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script,${PROJECT_BINARY_DIR}/test-map-file.sym")
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_GNU)
if(HAVE_VSCRIPT_GNU)
set(VSCRIPT_FLAG --version-script)
set(HAVE_VSCRIPT TRUE)
else()
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script,${PROJECT_BINARY_DIR}/test-map-file-bsd.sym")
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_BSD)
if(HAVE_VSCRIPT_BSD)
set(VSCRIPT_FLAG --version-script)
set(HAVE_VSCRIPT TRUE)
else()
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,-M,${PROJECT_BINARY_DIR}/test-map-file.sym")
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_SUN)
if(HAVE_VSCRIPT_SUN)
set(VSCRIPT_FLAG -M)
set(HAVE_VSCRIPT TRUE)
endif()
endif()
endif()
if(HAVE_VSCRIPT)
# Perform the same logic as ax_check_vscript.m4, to test whether the linker
# silently ignores (and overwrites) linker scripts it doesn't understand.
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/test-map-file-broken.sym")
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_BROKEN)
if(HAVE_VSCRIPT_BROKEN)
set(HAVE_VSCRIPT FALSE)
if(first_run)
message(STATUS "Detecting linker version script support - no (linker overwrites unknown scripts)")
endif()
else()
if(first_run)
message(STATUS "Detecting linker version script support - yes (${VSCRIPT_FLAG})")
endif()
endif()
else()
if(first_run)
message(STATUS "Detecting linker version script support - none detected")
endif()
endif()
cmake_pop_check_state()
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file.sym)
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file-bsd.sym)
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file-broken.sym)
if(HAVE_VSCRIPT)
set(${have_var} TRUE PARENT_SCOPE)
set(${flag_var} "${VSCRIPT_FLAG}" PARENT_SCOPE)
endif()
endfunction()

View file

@ -0,0 +1,89 @@
# This CMake module is supposed to give similar results to the
# AC_USE_SYSTEM_EXTENSIONS Autoconf macro, which turns on a load of
# system feature-check macros, including _ALL_SOURCE, _GNU_SOURCE,
# _NETBSD_SOURCE, and many more.
#
# Because PCRE2 uses so few OS features, we don't seem to actually need to
# enable many of these. Modern platforms with CMake users generally enable
# all the basic POSIX features by default.
#
# So far, we know that we require:
# - _ALL_SOURCE on IBM systems (z/OS, probably AIX) in order to call
# getrlimit() in pcre2test.
# - _GNU_SOURCE on Linux in order to call mkostemp() in some (non-default)
# configurations of the JIT.
#
# Autoconf enables this unconditionally. However, our CMake script potentially
# supports *more* platforms than Autoconf, so we use a feature check.
function(pcre2_use_system_extensions)
if(WIN32)
return()
endif()
set(first_run FALSE)
set(found_macro FALSE)
if(NOT DEFINED HAVE_GETRLIMIT_NAKED)
set(first_run TRUE)
message(STATUS "Detecting platform feature test macros")
endif()
include(CheckSymbolExists)
include(CheckCSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(
_pcre2_test_src
[=[
#include <sys/time.h>
#include <sys/resource.h>
int main(void) {
struct rlimit rlim;
getrlimit(RLIMIT_STACK, &rlim);
return 0;
}
]=]
)
set(CMAKE_REQUIRED_QUIET TRUE)
check_c_source_compiles("${_pcre2_test_src}" HAVE_GETRLIMIT_NAKED)
if(NOT HAVE_GETRLIMIT_NAKED)
# Try again with _ALL_SOURCE
set(CMAKE_REQUIRED_DEFINITIONS "-D_ALL_SOURCE")
check_c_source_compiles("${_pcre2_test_src}" HAVE_GETRLIMIT_ALLSOURCE)
unset(CMAKE_REQUIRED_DEFINITIONS)
if(HAVE_GETRLIMIT_ALLSOURCE)
add_compile_definitions(_ALL_SOURCE)
set(found_macro TRUE)
if(first_run)
message(STATUS "Detecting platform feature test macros - _ALL_SOURCE")
endif()
endif()
endif()
check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP_NAKED)
if(NOT HAVE_MKOSTEMP_NAKED)
# Try again with _GNU_SOURCE
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP_GNUSOURCE)
unset(CMAKE_REQUIRED_DEFINITIONS)
if(HAVE_MKOSTEMP_GNUSOURCE)
add_compile_definitions(_GNU_SOURCE)
set(found_macro TRUE)
if(first_run)
message(STATUS "Detecting platform feature test macros - _GNU_SOURCE")
endif()
endif()
endif()
if(first_run AND NOT found_macro)
message(STATUS "Detecting platform feature test macros - none")
endif()
cmake_pop_check_state()
endfunction()

View file

@ -0,0 +1,35 @@
# This file can be removed once the minimum CMake version is increased to 3.24
# or higher. Calls to pcre2_warning_as_error can be changed to the built in
# CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR.
function(pcre2_warning_as_error out_var)
set(${out_var} "" PARENT_SCOPE)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
# Since CMake 3.24, we should use the CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR
# variable for greatest compiler compatibility.
if(DEFINED CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR)
set(${out_var} "${CMAKE_C_COMPILE_OPTIONS_WARNING_AS_ERROR}" PARENT_SCOPE)
endif()
else()
# The fallback probes for support, trying a few common flags.
if(NOT MSVC)
include(CheckCCompilerFlag)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
check_c_compiler_flag("-Werror" HAVE_WERROR)
if(HAVE_WERROR)
set(${out_var} "-Werror" PARENT_SCOPE)
else()
check_c_compiler_flag("-errwarn=%all" HAVE_ERRWARN_ALL)
if(HAVE_ERRWARN_ALL)
set(${out_var} "-errwarn=%all" PARENT_SCOPE)
endif()
endif()
cmake_pop_check_state()
endif()
endif()
endfunction()

View file

@ -1,14 +0,0 @@
set(PACKAGE_VERSION_MAJOR @PCRE2_MAJOR@)
set(PACKAGE_VERSION_MINOR @PCRE2_MINOR@)
set(PACKAGE_VERSION_PATCH 0)
set(PACKAGE_VERSION @PCRE2_MAJOR@.@PCRE2_MINOR@.0)
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

View file

@ -5,11 +5,17 @@
#
# Static vs. shared
# -----------------
# To make use of the static library instead of the shared one, one needs
# To force using the static library instead of the shared one, one needs
# to set the variable PCRE2_USE_STATIC_LIBS to ON before calling find_package.
# If the variable is not set, the static library will be used if only that has
# been built, otherwise the shared library will be used.
#
# The following components are supported: 8BIT, 16BIT, 32BIT and POSIX.
# They used to be required but not anymore; all available targets will
# be defined regardless of the requested components.
# Example:
# set(PCRE2_USE_STATIC_LIBS ON)
# find_package(PCRE2 CONFIG COMPONENTS 8BIT)
# find_package(PCRE2 CONFIG)
#
# This will define the following variables:
#
@ -23,88 +29,42 @@
# PCRE2::32BIT - The 32 bit PCRE2 library.
# PCRE2::POSIX - The POSIX PCRE2 library.
set(PCRE2_NON_STANDARD_LIB_PREFIX @NON_STANDARD_LIB_PREFIX@)
set(PCRE2_NON_STANDARD_LIB_SUFFIX @NON_STANDARD_LIB_SUFFIX@)
set(PCRE2_8BIT_NAME pcre2-8)
set(PCRE2_16BIT_NAME pcre2-16)
set(PCRE2_32BIT_NAME pcre2-32)
set(PCRE2_POSIX_NAME pcre2-posix)
find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h DOC "PCRE2 include directory")
if(PCRE2_USE_STATIC_LIBS)
if(MSVC)
set(PCRE2_8BIT_NAME pcre2-8-static)
set(PCRE2_16BIT_NAME pcre2-16-static)
set(PCRE2_32BIT_NAME pcre2-32-static)
set(PCRE2_POSIX_NAME pcre2-posix-static)
endif()
@PACKAGE_INIT@
set(PCRE2_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(PCRE2_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
if(MINGW AND PCRE2_NON_STANDARD_LIB_PREFIX)
set(PCRE2_PREFIX "")
endif()
set(PCRE2_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
if(MINGW AND PCRE2_NON_STANDARD_LIB_SUFFIX)
set(PCRE2_SUFFIX "-0.dll")
elseif(MSVC)
set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
include(CMakeFindDependencyMacro)
if("@REQUIRE_PTHREAD@") # REQUIRE_PTHREAD
find_dependency(Threads)
endif()
find_library(
PCRE2_8BIT_LIBRARY
NAMES ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX}
DOC "8 bit PCRE2 library"
)
find_library(
PCRE2_16BIT_LIBRARY
NAMES ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}d${PCRE2_SUFFIX}
DOC "16 bit PCRE2 library"
)
find_library(
PCRE2_32BIT_LIBRARY
NAMES ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}d${PCRE2_SUFFIX}
DOC "32 bit PCRE2 library"
)
find_library(
PCRE2_POSIX_LIBRARY
NAMES ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}d${PCRE2_SUFFIX}
DOC "8 bit POSIX PCRE2 library"
)
unset(PCRE2_NON_STANDARD_LIB_PREFIX)
unset(PCRE2_NON_STANDARD_LIB_SUFFIX)
unset(PCRE2_8BIT_NAME)
unset(PCRE2_16BIT_NAME)
unset(PCRE2_32BIT_NAME)
unset(PCRE2_POSIX_NAME)
include("${CMAKE_CURRENT_LIST_DIR}/pcre2-targets.cmake")
# Set version
if(PCRE2_INCLUDE_DIR)
set(PCRE2_VERSION "@PCRE2_MAJOR@.@PCRE2_MINOR@.0")
endif()
set(PCRE2_VERSION "@PCRE2_MAJOR@.@PCRE2_MINOR@.0")
# Which components have been found.
if(PCRE2_8BIT_LIBRARY)
set(PCRE2_8BIT_FOUND TRUE)
endif()
if(PCRE2_16BIT_LIBRARY)
set(PCRE2_16BIT_FOUND TRUE)
endif()
if(PCRE2_32BIT_LIBRARY)
set(PCRE2_32BIT_FOUND TRUE)
endif()
if(PCRE2_POSIX_LIBRARY)
set(PCRE2_POSIX_FOUND TRUE)
endif()
# Check if at least one component has been specified.
list(LENGTH PCRE2_FIND_COMPONENTS PCRE2_NCOMPONENTS)
if(PCRE2_NCOMPONENTS LESS 1)
message(FATAL_ERROR "No components have been specified. This is not allowed. Please, specify at least one component.")
endif()
unset(PCRE2_NCOMPONENTS)
# Chooses the linkage of the library to expose in the
# unsuffixed edition of the target.
macro(_pcre2_add_component_target component target)
# If the static library exists and either PCRE2_USE_STATIC_LIBS
# is defined, or the dynamic library does not exist, use the static library.
if(NOT TARGET PCRE2::${component})
if(TARGET pcre2::pcre2-${target}-static AND (PCRE2_USE_STATIC_LIBS OR NOT TARGET pcre2::pcre2-${target}-shared))
add_library(PCRE2::${component} ALIAS pcre2::pcre2-${target}-static)
set(PCRE2_${component}_FOUND TRUE)
# Otherwise use the dynamic library if it exists.
elseif(TARGET pcre2::pcre2-${target}-shared AND NOT PCRE2_USE_STATIC_LIBS)
add_library(PCRE2::${component} ALIAS pcre2::pcre2-${target}-shared)
set(PCRE2_${component}_FOUND TRUE)
endif()
if(PCRE2_${component}_FOUND)
get_target_property(PCRE2_${component}_LIBRARY PCRE2::${component} IMPORTED_LOCATION)
set(PCRE2_LIBRARIES ${PCRE2_LIBRARIES} ${PCRE2_${component}_LIBRARY})
endif()
endif()
endmacro()
_pcre2_add_component_target(8BIT 8)
_pcre2_add_component_target(16BIT 16)
_pcre2_add_component_target(32BIT 32)
_pcre2_add_component_target(POSIX posix)
# When POSIX component has been specified make sure that also 8BIT component is specified.
set(PCRE2_8BIT_COMPONENT FALSE)
@ -126,43 +86,5 @@ endif()
unset(PCRE2_8BIT_COMPONENT)
unset(PCRE2_POSIX_COMPONENT)
include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(
PCRE2
FOUND_VAR PCRE2_FOUND
REQUIRED_VARS PCRE2_INCLUDE_DIR
HANDLE_COMPONENTS
VERSION_VAR PCRE2_VERSION
CONFIG_MODE
)
set(PCRE2_LIBRARIES)
if(PCRE2_FOUND)
foreach(component ${PCRE2_FIND_COMPONENTS})
if(PCRE2_USE_STATIC_LIBS)
add_library(PCRE2::${component} STATIC IMPORTED)
target_compile_definitions(PCRE2::${component} INTERFACE PCRE2_STATIC)
else()
add_library(PCRE2::${component} SHARED IMPORTED)
endif()
set_target_properties(
PCRE2::${component}
PROPERTIES
IMPORTED_LOCATION "${PCRE2_${component}_LIBRARY}"
IMPORTED_IMPLIB "${PCRE2_${component}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
)
if(component STREQUAL "POSIX")
set_target_properties(
PCRE2::${component}
PROPERTIES INTERFACE_LINK_LIBRARIES "PCRE2::8BIT" LINK_LIBRARIES "PCRE2::8BIT"
)
endif()
set(PCRE2_LIBRARIES ${PCRE2_LIBRARIES} ${PCRE2_${component}_LIBRARY})
mark_as_advanced(PCRE2_${component}_LIBRARY)
endforeach()
endif()
mark_as_advanced(PCRE2_INCLUDE_DIR)
# Check for required components.
check_required_components("PCRE2")

1405
libpcre/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -9,20 +9,20 @@ dnl The PCRE2_PRERELEASE feature is for identifying release candidates. It might
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre2_major, [10])
m4_define(pcre2_minor, [45])
m4_define(pcre2_minor, [47])
m4_define(pcre2_prerelease, [])
m4_define(pcre2_date, [2025-02-05])
m4_define(pcre2_date, [2025-10-21])
# Libtool shared library interface versions (current:revision:age)
m4_define(libpcre2_8_version, [14:0:14])
m4_define(libpcre2_16_version, [14:0:14])
m4_define(libpcre2_32_version, [14:0:14])
m4_define(libpcre2_posix_version, [3:6:0])
m4_define(libpcre2_8_version, [15:0:15])
m4_define(libpcre2_16_version, [15:0:15])
m4_define(libpcre2_32_version, [15:0:15])
m4_define(libpcre2_posix_version, [3:7:0])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
AC_PREREQ([2.60])
AC_PREREQ([2.69])
AC_INIT([PCRE2],pcre2_major.pcre2_minor[]pcre2_prerelease,[],[pcre2])
AC_CONFIG_SRCDIR([src/pcre2.h.in])
AM_INIT_AUTOMAKE([dist-bzip2 dist-zip foreign])
@ -72,6 +72,9 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Check for a 64-bit integer type
AC_TYPE_INT64_T
# Check for xlc which has some special (broken/non-standard) behaviour on z/OS.
PCRE2_ZOS_FIXES
AC_PROG_INSTALL
LT_INIT([win32-dll])
AC_PROG_LN_S
@ -82,6 +85,10 @@ AC_SYS_LARGEFILE
PCRE2_VISIBILITY
# Check for the availability of -Wl,--version-script (or -Wl,-M on Solaris)
AX_CHECK_VSCRIPT
# Check for Clang __attribute__((uninitialized)) feature
AC_MSG_CHECKING([for __attribute__((uninitialized))])
@ -279,7 +286,7 @@ AC_ARG_ENABLE(rebuild-chartables,
AC_ARG_ENABLE(unicode,
AS_HELP_STRING([--disable-unicode],
[disable Unicode support]),
, enable_unicode=no)
, enable_unicode=unset)
# Handle newline options
ac_pcre2_newline=lf
@ -324,7 +331,7 @@ AC_ARG_ENABLE(never-backslash-C,
# Handle --enable-ebcdic
AC_ARG_ENABLE(ebcdic,
AS_HELP_STRING([--enable-ebcdic],
[assume EBCDIC coding rather than ASCII; incompatible with --enable-unicode; use only in (uncommon) EBCDIC environments; it implies --enable-rebuild-chartables]),
[assume EBCDIC coding rather than ASCII; incompatible with --enable-unicode; use only in (uncommon) EBCDIC environments]),
, enable_ebcdic=no)
# Handle --enable-ebcdic-nl25
@ -333,6 +340,12 @@ AC_ARG_ENABLE(ebcdic-nl25,
[set EBCDIC code for NL to 0x25 instead of 0x15; it implies --enable-ebcdic]),
, enable_ebcdic_nl25=no)
# Handle --enable-ebcdic-ignoring-compiler
AC_ARG_ENABLE(ebcdic-ignoring-compiler,
AS_HELP_STRING([--enable-ebcdic-ignoring-compiler],
[force EBCDIC 1047 using numeric literals rather than C character literals; it implies --enable-ebcdic]),
, enable_ebcdic_ignoring_compiler=no)
# Handle --enable-pcre2grep-libz
AC_ARG_ENABLE(pcre2grep-libz,
AS_HELP_STRING([--enable-pcre2grep-libz],
@ -457,6 +470,16 @@ AC_ARG_ENABLE(percent-zt,
[disable the use of z and t formatting modifiers]),
, enable_percent_zt=auto)
# Handle --enable-Werror/errwarn
AC_ARG_ENABLE(Werror,
AS_HELP_STRING([--enable-Werror],
[Add -Werror to CFLAGS (GCC/Clang style); if -Werror is passed to ./configure via CFLAGS it interferes with feature detection]),
, enable_Werror=no)
AC_ARG_ENABLE(errwarn,
AS_HELP_STRING([--enable-errwarn],
[Add -errwarn=%all to CFLAGS (Sun cc style)]),
, enable_errwarn=no)
# Set the default value for pcre2-8
if test "x$enable_pcre2_8" = "xunset"
then
@ -502,19 +525,21 @@ case "$enable_newline" in
;;
esac
# --enable-ebcdic-nl25 implies --enable-ebcdic
if test "x$enable_ebcdic_nl25" = "xyes"; then
# --enable-ebcdic-nl25 and --enable-ebcdic-ignoring-compiler imply --enable-ebcdic
if test "x$enable_ebcdic_nl25" = "xyes" -o "x$enable_ebcdic_ignoring_compiler" = "xyes"; then
enable_ebcdic=yes
fi
# Make sure that if enable_ebcdic is set, rebuild_chartables is also enabled.
# Make sure that if enable_ebcdic is set (without
# enable_ebcdic_ignoring_compiler), rebuild_chartables is also enabled.
# Also check that UTF support is not requested, because PCRE2 cannot handle
# EBCDIC and UTF in the same build. To do so it would need to use different
# character constants depending on the mode. Also, EBCDIC cannot be used with
# 16-bit and 32-bit libraries.
#
# character constants depending on the mode.
# Also, EBCDIC cannot be used with 16-bit and 32-bit libraries.
if test "x$enable_ebcdic" = "xyes"; then
enable_rebuild_chartables=yes
if test "x$enable_ebcdic_ignoring_compiler" != "xyes"; then
enable_rebuild_chartables=yes
fi
if test "x$enable_unicode" = "xyes"; then
AC_MSG_ERROR([support for EBCDIC and Unicode cannot be enabled at the same time])
fi
@ -553,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)
@ -571,6 +592,8 @@ AM_CONDITIONAL(WITH_PCRE2_32, test "x$enable_pcre2_32" = "xyes")
AM_CONDITIONAL(WITH_REBUILD_CHARTABLES, test "x$enable_rebuild_chartables" = "xyes")
AM_CONDITIONAL(WITH_JIT, test "x$enable_jit" = "xyes")
AM_CONDITIONAL(WITH_UNICODE, test "x$enable_unicode" = "xyes")
AM_CONDITIONAL(WITH_EBCDIC, test "x$enable_ebcdic" = "xyes")
AM_CONDITIONAL(WITH_EBCDIC_NL25, test "x$enable_ebcdic_nl25" = "xyes")
AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
AM_CONDITIONAL(WITH_FUZZ_SUPPORT, test "x$enable_fuzz_support" = "xyes")
AM_CONDITIONAL(WITH_DIFF_FUZZ_SUPPORT, test "x$enable_diff_fuzz_support" = "xyes")
@ -600,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 <stdlib.h>
@ -654,7 +677,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_RESULT([no]))
LIBS="$OLD_LIBS"
# Check for the availabiity of libreadline
# Check for the availability of libreadline
if test "$enable_pcre2test_libreadline" = "yes"; then
AC_CHECK_HEADERS([readline/readline.h], [HAVE_READLINE_H=1])
@ -667,9 +690,9 @@ if test "$enable_pcre2test_libreadline" = "yes"; then
[unset ac_cv_lib_readline_readline;
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncurses"],
[unset ac_cv_lib_readline_readline;
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-lncursesw"],
[unset ac_cv_lib_readline_readline;
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
AC_CHECK_LIB([readline], [readline], [LIBREADLINE="-ltermcap"],
[LIBREADLINE=""],
[-ltermcap])],
[-lncursesw])],
@ -696,16 +719,31 @@ if test "$enable_pcre2test_libedit" = "yes"; then
AC_CHECK_LIB([edit], [readline], [LIBEDIT="-ledit"])
fi
# Set up shared/static library flags
PCRE2_STATIC_CFLAG=""
if test "x$enable_shared" = "xno" ; then
AC_DEFINE([PCRE2_STATIC], [1], [
Define to any value if linking statically (TODO: make nice with Libtool)])
Define to any value if linking statically. Ideally, if both static and
shared libraries are being built, then PCRE2_STATIC would be defined only
for the static build. Indeed, this is a requirement on Windows. With
Autoconf and libtool however, it is idiomatic to compile the sources once
to create both the static and shared library, so in this case, PCRE2_STATIC
should only be defined if no shared library is being built.])
PCRE2_STATIC_CFLAG="-DPCRE2_STATIC"
fi
AC_SUBST(PCRE2_STATIC_CFLAG)
PCRE2POSIX_CFLAG=""
if test "x$enable_shared" = "xyes" ; then
AC_DEFINE([PCRE2POSIX_SHARED], [1], [
Define to any value if linking libpcre2-posix dynamically. Ideally, if both
static and shared libraries are being built, then PCRE2POSIX_SHARED would be
defined only for the shared build. Indeed, this is a requirement on Windows.
However, when building with Autoconf and libtool, we compile the sources once
only to create both the static and shared library, so in this case,
PCRE2POSIX_SHARED should only be defined if the shared library is being built,
regardless of whether or not the static library is also being built.])
PCRE2POSIX_CFLAG="-DPCRE2POSIX_SHARED"
fi
AC_SUBST(PCRE2POSIX_CFLAG)
@ -944,6 +982,11 @@ AH_VERBATIM([PCRE2_EXP_DEFN], [
in the C sense, but which are internal to the library. */
#undef PCRE2_EXP_DEFN])
AH_VERBATIM([PCRE2POSIX_EXP_DEFN], [
/* See PCRE2_EXP_DEFN; but this is applied to functions in the libpcre2-posix
library. */
#undef PCRE2POSIX_EXP_DEFN])
if test "$enable_ebcdic" = "yes"; then
AC_DEFINE_UNQUOTED([EBCDIC], [], [
If you are compiling for a system that uses EBCDIC instead of ASCII
@ -951,7 +994,7 @@ if test "$enable_ebcdic" = "yes"; then
assumes that all input strings are in EBCDIC. If you do not define this
macro, PCRE2 will assume input strings are ASCII or UTF-8/16/32 Unicode. It
is not possible to build a version of PCRE2 that supports both EBCDIC and
UTF-8/16/32.])
ASCII or UTF-8/16/32.])
fi
if test "$enable_ebcdic_nl25" = "yes"; then
@ -961,6 +1004,13 @@ if test "$enable_ebcdic_nl25" = "yes"; then
that LF does in an ASCII/Unicode environment.])
fi
if test "$enable_ebcdic_ignoring_compiler" = "yes"; then
AC_DEFINE_UNQUOTED([EBCDIC_IGNORING_COMPILER], [], [
To force an EBCDIC environment, define this macro to make the core PCRE2
library functions use EBCDIC codepage 1047, regardless of whether the
compiler supports it using C character literals.])
fi
if test "$enable_valgrind" = "yes"; then
AC_DEFINE_UNQUOTED([SUPPORT_VALGRIND], [], [
Define to any value for valgrind support to find invalid memory reads.])
@ -968,12 +1018,10 @@ fi
# Platform specific issues
NO_UNDEFINED=
EXPORT_ALL_SYMBOLS=
case $host_os in
cygwin* | mingw* )
if test X"$enable_shared" = Xyes; then
NO_UNDEFINED="-no-undefined"
EXPORT_ALL_SYMBOLS="-Wl,--export-all-symbols"
fi
;;
esac
@ -993,6 +1041,22 @@ EXTRA_LIBPCRE2_32_LDFLAGS="$EXTRA_LIBPCRE2_32_LDFLAGS \
EXTRA_LIBPCRE2_POSIX_LDFLAGS="$EXTRA_LIBPCRE2_POSIX_LDFLAGS \
$NO_UNDEFINED -version-info libpcre2_posix_version"
# Append each library's version script, if the platform supports it.
if test x$ax_check_vscript_flag != x ; then
EXTRA_LIBPCRE2_8_LDFLAGS="$EXTRA_LIBPCRE2_8_LDFLAGS \
-Wl,$ax_check_vscript_flag,\$(srcdir)/src/libpcre2-8.sym"
EXTRA_LIBPCRE2_16_LDFLAGS="$EXTRA_LIBPCRE2_16_LDFLAGS \
-Wl,$ax_check_vscript_flag,\$(srcdir)/src/libpcre2-16.sym"
EXTRA_LIBPCRE2_32_LDFLAGS="$EXTRA_LIBPCRE2_32_LDFLAGS \
-Wl,$ax_check_vscript_flag,\$(srcdir)/src/libpcre2-32.sym"
EXTRA_LIBPCRE2_POSIX_LDFLAGS="$EXTRA_LIBPCRE2_POSIX_LDFLAGS \
-Wl,$ax_check_vscript_flag,\$(srcdir)/src/libpcre2-posix.sym"
fi
AC_SUBST(EXTRA_LIBPCRE2_8_LDFLAGS)
AC_SUBST(EXTRA_LIBPCRE2_16_LDFLAGS)
AC_SUBST(EXTRA_LIBPCRE2_32_LDFLAGS)
@ -1147,7 +1211,16 @@ AC_CONFIG_COMMANDS([script-chmod], [chmod a+x pcre2-config])
# Make sure that pcre2_chartables.c is removed in case the method for
# creating it was changed by reconfiguration.
AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f pcre2_chartables.c])
AC_CONFIG_COMMANDS([delete-old-chartables], [rm -f src/pcre2_chartables.c])
# Handle --enable-Werror/errwarn. This must come last, so that we don't mess
# with any of the library-detection tests (or similar).
if test "X$enable_Werror" = Xyes; then
CFLAGS="$CFLAGS -Werror"
fi
if test "X$enable_errwarn" = Xyes; then
CFLAGS="$CFLAGS -errwarn=%all"
fi
AC_OUTPUT
@ -1170,6 +1243,13 @@ elif test "$enable_ebcdic" = "yes"; then
ebcdic_nl_code=0x15
fi
with_symbol_versioning=n/a
if test x$want_symvers != xyes; then
with_symbol_versioning=no
elif test x$ax_check_vscript_flag != x; then
with_symbol_versioning=yes
fi
cat <<EOF
$PACKAGE-$VERSION configuration summary:
@ -1195,6 +1275,7 @@ $PACKAGE-$VERSION configuration summary:
\C is disabled ..................... : ${enable_never_backslash_C}
EBCDIC coding ...................... : ${enable_ebcdic}
EBCDIC code for NL ................. : ${ebcdic_nl_code}
EBCDIC coding ignoring compiler .... : ${enable_ebcdic_ignoring_compiler}
Rebuild char tables ................ : ${enable_rebuild_chartables}
Internal link size ................. : ${with_link_size}
Maximum variable lookbehind ........ : ${with_max_varlookbehind}
@ -1203,8 +1284,9 @@ $PACKAGE-$VERSION configuration summary:
Match limit ........................ : ${with_match_limit}
Match depth limit .................. : ${with_match_limit_depth}
Build shared libs .................. : ${enable_shared}
with symbol versioning ......... : ${with_symbol_versioning}
Build static libs .................. : ${enable_static}
Use JIT in pcre2grep ............... : ${enable_pcre2grep_jit}
Enable JIT in pcre2grep ............ : ${enable_pcre2grep_jit}
Enable callouts in pcre2grep ....... : ${enable_pcre2grep_callout}
Enable fork in pcre2grep callouts .. : ${enable_pcre2grep_callout_fork}
Initial buffer size for pcre2grep .. : ${with_pcre2grep_bufsize}
@ -1213,7 +1295,7 @@ $PACKAGE-$VERSION configuration summary:
Link pcre2grep with libbz2 ......... : ${enable_pcre2grep_libbz2}
Link pcre2test with libedit ........ : ${enable_pcre2test_libedit}
Link pcre2test with libreadline .... : ${enable_pcre2test_libreadline}
Valgrind support ................... : ${enable_valgrind}
Enable Valgrind support ............ : ${enable_valgrind}
Code coverage ...................... : ${enable_coverage}
Fuzzer support ..................... : ${enable_fuzz_support}
Differential fuzzer support ........ : ${enable_diff_fuzz_support}

View file

@ -0,0 +1,153 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_vscript.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_VSCRIPT
#
# DESCRIPTION
#
# Check whether the linker supports version scripts. Version scripts are
# used when building shared libraries to bind symbols to version nodes
# (helping to detect incompatibilities) or to limit the visibility of
# non-public symbols.
#
# Output:
#
# If version scripts are supported, VSCRIPT_LDFLAGS will contain the
# appropriate flag to pass to the linker. On GNU systems this would
# typically be "-Wl,--version-script", and on Solaris it would typically
# be "-Wl,-M".
#
# Two Automake conditionals are also set:
#
# HAVE_VSCRIPT is true if the linker supports version scripts with
# entries that use simple wildcards, like "local: *".
#
# HAVE_VSCRIPT_COMPLEX is true if the linker supports version scripts with
# pattern matching wildcards, like "global: Java_*".
#
# On systems that do not support symbol versioning, such as Mac OS X, both
# conditionals will be false. They will also be false if the user passes
# "--disable-symvers" on the configure command line.
#
# Example:
#
# configure.ac:
#
# AX_CHECK_VSCRIPT
#
# Makefile.am:
#
# if HAVE_VSCRIPT
# libfoo_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libfoo.map
# endif
#
# if HAVE_VSCRIPT_COMPLEX
# libbar_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libbar.map
# endif
#
# LICENSE
#
# Copyright (c) 2014 Kevin Cernekee <cernekee@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 2.99 PCRE2
# _AX_CHECK_VSCRIPT(flag, global-sym, action-if-link-succeeds, [junk-file=no])
AC_DEFUN([_AX_CHECK_VSCRIPT], [
AC_LANG_PUSH([C])
ax_check_vscript_save_flags="$LDFLAGS"
echo "V1 { global: $2; local: *; };" > conftest.map
AS_IF([test x$4 = xyes], [
echo "{" >> conftest.map
])
LDFLAGS="$LDFLAGS -Wl,$1,conftest.map"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[int show, hide;]], [])], [$3])
LDFLAGS="$ax_check_vscript_save_flags"
rm -f conftest.map
AC_LANG_POP([C])
]) dnl _AX_CHECK_VSCRIPT
AC_DEFUN([AX_CHECK_VSCRIPT], [
AC_ARG_ENABLE([symvers],
AS_HELP_STRING([--disable-symvers],
[disable library symbol versioning [default=auto]]),
[want_symvers=$enableval],
[want_symvers=yes]
)
AS_IF([test x$want_symvers = xyes], [
dnl First test --version-script and -M with a simple wildcard.
AC_CACHE_CHECK([linker version script flag], ax_cv_check_vscript_flag, [
ax_cv_check_vscript_flag=unsupported
_AX_CHECK_VSCRIPT([--version-script], [show], [
ax_cv_check_vscript_flag=--version-script
])
AS_IF([test x$ax_cv_check_vscript_flag = xunsupported], [
# PCRE2: Support for FreeBSD. Rather annoyingly, AC_LINK_IFELSE will
# only test linking executables, and in turn, on FreeBSD the main
# entrypoint will fail to link if you use "local: *" to hide the
# visibility of various shared symbols injected from /usr/lib/crt1.o.
# It's not at all pretty to hardcode those symbol names here, but I
# can't think of an obvious way to improve on this.
_AX_CHECK_VSCRIPT([--version-script], [show;environ;__progname], [
ax_cv_check_vscript_flag=--version-script
])
])
AS_IF([test x$ax_cv_check_vscript_flag = xunsupported], [
_AX_CHECK_VSCRIPT([-M], [show], [ax_cv_check_vscript_flag=-M])
])
dnl The linker may interpret -M (no argument) as "produce a load map."
dnl If "-M conftest.map" doesn't fail when conftest.map contains
dnl obvious syntax errors, assume this is the case.
AS_IF([test x$ax_cv_check_vscript_flag != xunsupported], [
_AX_CHECK_VSCRIPT([$ax_cv_check_vscript_flag], [show],
[ax_cv_check_vscript_flag=unsupported], [yes])
])
])
dnl If the simple wildcard worked, retest with a complex wildcard.
AS_IF([test x$ax_cv_check_vscript_flag != xunsupported], [
ax_check_vscript_flag=$ax_cv_check_vscript_flag
AC_CACHE_CHECK([if version scripts can use complex wildcards],
ax_cv_check_vscript_complex_wildcards, [
ax_cv_check_vscript_complex_wildcards=no
_AX_CHECK_VSCRIPT([$ax_cv_check_vscript_flag], [sh*], [
ax_cv_check_vscript_complex_wildcards=yes])
])
ax_check_vscript_complex_wildcards="$ax_cv_check_vscript_complex_wildcards"
], [
ax_check_vscript_flag=
ax_check_vscript_complex_wildcards=no
])
], [
AC_MSG_CHECKING([linker version script flag])
AC_MSG_RESULT([disabled])
ax_check_vscript_flag=
ax_check_vscript_complex_wildcards=no
])
AS_IF([test x$ax_check_vscript_flag != x], [
VSCRIPT_LDFLAGS="-Wl,$ax_check_vscript_flag"
AC_SUBST([VSCRIPT_LDFLAGS])
])
AM_CONDITIONAL([HAVE_VSCRIPT],
[test x$ax_check_vscript_flag != x])
AM_CONDITIONAL([HAVE_VSCRIPT_COMPLEX],
[test x$ax_check_vscript_complex_wildcards = xyes])
]) dnl AX_CHECK_VSCRIPT

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
@ -14,24 +14,28 @@
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
# needed for multi-threaded programs (defaults to the value of CC
# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
# special cc_r/CC_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# but also to link with them as well. For example, you might link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# If you are only building threaded programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
# CXX="$PTHREAD_CXX"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
@ -55,6 +59,7 @@
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@ -67,7 +72,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@ -82,35 +87,41 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 18
#serial 31
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_SED])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_CC="$CC"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
AC_MSG_RESULT($ax_pthread_ok)
if test x"$ax_pthread_ok" = xno; then
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = "xno"; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CC="$ax_pthread_save_CC"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
@ -118,12 +129,14 @@ fi
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
# Create a list of thread flags to try. Items with a "," contain both
# C compiler flags (before ",") and linker flags (after ","). Other items
# starting with a "-" are C compiler flags, and remaining items are
# library names, except for "none" which indicates that we try without
# any flags at all, and "pthread-config" which is a program returning
# the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
@ -132,68 +145,163 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
# (Note: HP C rejects this with "bad form for `-t' option")
# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# doesn't hurt to check since this sometimes defines pthreads and
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
# is present but should not be used directly; and before -mthreads,
# because the compiler interprets this as "-mt" + "-hreads")
# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
case $host_os in
freebsd*)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
;;
hpux*)
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
# multi-threading and also sets -lpthread."
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
;;
openedition*)
# IBM z/OS requires a feature-test macro to be defined in order to
# enable POSIX threads at all, so give the user a hint if this is
# not set. (We don't define these ourselves, as they can affect
# other portions of the system API in unpredictable ways.)
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
[
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
AX_PTHREAD_ZOS_MISSING
# endif
],
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
;;
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
# tests will erroneously succeed. (N.B.: The stubs are missing
# pthread_cleanup_push, or rather a function called by this macro,
# so we could check for that, but who knows whether they'll stub
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
# Are we compiling with Clang?
case $flag in
AC_CACHE_CHECK([whether $CC is Clang],
[ax_cv_PTHREAD_CLANG],
[ax_cv_PTHREAD_CLANG=no
# Note that Autoconf sets GCC=yes for Clang as well as GCC
if test "x$GCC" = "xyes"; then
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
# if defined(__clang__) && defined(__llvm__)
AX_PTHREAD_CC_IS_CLANG
# endif
],
[ax_cv_PTHREAD_CLANG=yes])
fi
])
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
# Note that for GCC and Clang -pthread generally implies -lpthread,
# except when -nostdlib is passed.
# This is problematic using libtool to build C++ shared libraries with pthread:
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
# To solve this, first try -pthread together with -lpthread for GCC
AS_IF([test "x$GCC" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
AS_IF([test "x$ax_pthread_clang" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread"])
# The presence of a feature test macro requesting re-entrant function
# definitions is, on some systems, a strong hint that pthreads support is
# correctly enabled
case $host_os in
darwin* | hpux* | linux* | osf* | solaris*)
ax_pthread_check_macro="_REENTRANT"
;;
aix*)
ax_pthread_check_macro="_THREAD_SAFE"
;;
*)
ax_pthread_check_macro="--"
;;
esac
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
[ax_pthread_check_cond=0],
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
case $ax_pthread_try_flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
*,*)
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
PTHREAD_CFLAGS="$ax_pthread_try_flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
PTHREAD_LIBS="-l$ax_pthread_try_flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
@ -204,8 +312,18 @@ for flag in $ax_pthread_flags; do
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
static void *some_global = NULL;
static void routine(void *a)
{
/* To avoid any unused-parameter or
unused-but-set-parameter warning. */
some_global = a;
}
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
@ -213,93 +331,188 @@ for flag in $ax_pthread_flags; do
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
AC_MSG_RESULT($ax_pthread_ok)
if test "x$ax_pthread_ok" = xyes; then
break;
fi
AC_MSG_RESULT([$ax_pthread_ok])
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Clang needs special handling, because older versions handle the -pthread
# option in a rather... idiosyncratic way
if test "x$ax_pthread_clang" = "xyes"; then
# Clang takes -pthread; it has never supported any other flag
# (Note 1: This will need to be revisited if a system that Clang
# supports has POSIX threads in a separate library. This tends not
# to be the way of modern systems, but it's conceivable.)
# (Note 2: On some systems, notably Darwin, -pthread is not needed
# to get POSIX threads support; the API is always present and
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
# -pthread does define _REENTRANT, and while the Darwin headers
# ignore this macro, third-party headers might not.)
# However, older versions of Clang make a point of warning the user
# that, in an invocation where only linking and no compilation is
# taking place, the -pthread option has no effect ("argument unused
# during compilation"). They expect -pthread to be passed in only
# when source code is being compiled.
#
# Problem is, this is at odds with the way Automake and most other
# C build frameworks function, which is that the same flags used in
# compilation (CFLAGS) are also used in linking. Many systems
# supported by AX_PTHREAD require exactly this for POSIX threads
# support, and in fact it is often not straightforward to specify a
# flag that is used only in the compilation phase and not in
# linking. Such a scenario is extremely rare in practice.
#
# Even though use of the -pthread flag in linking would only print
# a warning, this can be a nuisance for well-run software projects
# that build with -Werror. So if the active version of Clang has
# this misfeature, we search for an option to squash it.
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
# Create an alternate version of $ac_link that compiles and
# links in two steps (.c -> .o, .o -> exe) instead of one
# (.c -> exe), because the warning occurs only in the second
# step
ax_pthread_save_ac_link="$ac_link"
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
ax_pthread_save_CFLAGS="$CFLAGS"
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
ac_link="$ax_pthread_save_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[ac_link="$ax_pthread_2step_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[break])
])
done
ac_link="$ax_pthread_save_ac_link"
CFLAGS="$ax_pthread_save_CFLAGS"
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
])
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
no | unknown) ;;
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
esac
fi # $ax_pthread_clang = yes
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_CACHE_CHECK([for joinable pthread attribute],
[ax_cv_PTHREAD_JOINABLE_ATTR],
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $ax_pthread_attr; return attr /* ; */])],
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
[])
done
])
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
[$ax_cv_PTHREAD_JOINABLE_ATTR],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
ax_pthread_joinable_attr_defined=yes
])
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([whether more special flags are required for pthreads],
[ax_cv_PTHREAD_SPECIAL_FLAGS],
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
case $host_os in
solaris*)
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
;;
esac
])
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
test "x$ax_pthread_special_flags_added" != "xyes"],
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
ax_pthread_special_flags_added=yes])
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
[ax_cv_PTHREAD_PRIO_INHERIT],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;
return i;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
ax_pthread_prio_inherit_defined=yes
])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
# More AIX lossage: compile with *_r variant
if test "x$GCC" != "xyes"; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[
AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
],
[
AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
]
)
])
;;
esac
fi
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
AC_SUBST([PTHREAD_CXX])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
if test "x$ax_pthread_ok" = "xyes"; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=no

View file

@ -34,10 +34,10 @@ AC_DEFUN([PCRE2_VISIBILITY],
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[ #warning e ]])],
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[ #warning e ]])],
[], [pcre2_cv_cc_vis_werror=yes]
)
)
], [])
CFLAGS="$pcre2_save_CFLAGS"])
AC_MSG_RESULT([$pcre2_cv_cc_vis_werror])
@ -74,9 +74,9 @@ AC_DEFUN([PCRE2_VISIBILITY],
then
VISIBILITY_CFLAGS="-fvisibility=hidden"
HAVE_VISIBILITY=1
AC_DEFINE(PCRE2_EXPORT, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
AC_DEFINE(PCRE2_EXPORT, [__attribute__ ((visibility ("default")))], [Define to the annotation for making a symbol visible.])
else
AC_DEFINE(PCRE2_EXPORT, [], [to make a symbol visible])
AC_DEFINE(PCRE2_EXPORT, [], [Define to the annotation for making a symbol visible.])
fi
AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([HAVE_VISIBILITY])

50
libpcre/m4/pcre2_zos.m4 Normal file
View file

@ -0,0 +1,50 @@
dnl Tests whether the compiler requires an additional flag in order to fail on
dnl undefined headers.
dnl The concept of setting this commandline flag was learned from patches and
dnl mailing list discussions of the gnulib and gawk projects (credit to
dnl Bruno Haible).
AC_DEFUN([PCRE2_ZOS_FIXES],
[
AC_CACHE_CHECK([for OS/390 (z/OS)], [pcre2_cv_os390],
[if test "`uname`" = "OS/390"; then
pcre2_cv_os390=yes
else
pcre2_cv_os390=no
fi])
if test "$pcre2_cv_os390" = "yes"; then
AC_CACHE_CHECK([whether the compiler supports -qhaltonmsg=CCN3296], [pcre2_cv_xlc_qhaltonmsg_support],
[save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -qhaltonmsg=CCN3296"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[pcre2_cv_xlc_qhaltonmsg_support=yes],
[pcre2_cv_xlc_qhaltonmsg_support=no])
CFLAGS="$save_CFLAGS"
])
AC_CACHE_CHECK([whether non-existent headers fail the compile], [pcre2_cv_xlc_nonexistent_fatal],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thereshouldbenoheader.h>]])],
[pcre2_cv_xlc_nonexistent_fatal=no],
[pcre2_cv_xlc_nonexistent_fatal=yes])
])
if test "$pcre2_cv_xlc_nonexistent_fatal" = "no" && test "$pcre2_cv_xlc_qhaltonmsg_support" = "yes"; then
AC_CACHE_CHECK([whether -qhaltonmsg=CCN3296 fixes the non-existent-header issue], [pcre2_cv_xlc_qhaltonmsg_fixes],
[save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -qhaltonmsg=CCN3296"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thereshouldbenoheader.h>]])],
[pcre2_cv_xlc_qhaltonmsg_fixes=no],
[pcre2_cv_xlc_qhaltonmsg_fixes=yes])
CFLAGS="$save_CFLAGS"
])
if test "$pcre2_cv_xlc_qhaltonmsg_fixes" = "no"; then
AC_MSG_ERROR([-qhaltonmsg=CCN3296 not effective on non-existent headers])
fi
CFLAGS="$CFLAGS -qhaltonmsg=CCN3296"
fi
fi
])

View file

@ -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
@ -38,7 +35,7 @@
#cmakedefine BSR_ANYCRLF 1
#cmakedefine EBCDIC 1
#cmakedefine EBCDIC_NL25 1
#cmakedefine HEAP_MATCH_RECURSE 1
#cmakedefine EBCDIC_IGNORING_COMPILER 1
#cmakedefine NEVER_BACKSLASH_C 1
#define PCRE2_EXPORT @PCRE2_EXPORT@
@ -52,7 +49,7 @@
#define PCRE2GREP_BUFSIZE @PCRE2GREP_BUFSIZE@
#define PCRE2GREP_MAX_BUFSIZE @PCRE2GREP_MAX_BUFSIZE@
#define MAX_NAME_SIZE 128
#define MAX_NAME_COUNT 10000
#define MAX_NAME_SIZE 128
#define MAX_NAME_COUNT 10000
/* end config.h for CMake builds */

View file

@ -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
@ -44,9 +40,14 @@ sure both macros are undefined; an emulation function will then be used. */
assumes that all input strings are in EBCDIC. If you do not define this
macro, PCRE2 will assume input strings are ASCII or UTF-8/16/32 Unicode. It
is not possible to build a version of PCRE2 that supports both EBCDIC and
UTF-8/16/32. */
ASCII or UTF-8/16/32. */
/* #undef EBCDIC */
/* To force an EBCDIC environment, define this macro to make the core PCRE2
library functions use EBCDIC codepage 1047, regardless of whether the
compiler supports it using C character literals. */
/* #undef EBCDIC_IGNORING_COMPILER */
/* In an EBCDIC environment, define this macro to any value to arrange for the
NL character to be 0x25 instead of the default 0x15. NL plays the role that
LF does in an ASCII/Unicode environment. */
@ -58,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 */
@ -94,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 <minix/config.h> header file. */
/* #undef HAVE_MINIX_CONFIG_H */
@ -133,9 +128,6 @@ sure both macros are undefined; an emulation function will then be used. */
/* Define to 1 if you have the <stdlib.h> 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 <strings.h> header file. */
/* #undef HAVE_STRINGS_H */
@ -255,7 +247,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_NAME "PCRE2"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "PCRE2 10.45"
#define PACKAGE_STRING "PCRE2 10.47"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "pcre2"
@ -264,7 +256,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "10.45"
#define PACKAGE_VERSION "10.47"
/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
parentheses (of any kind) in a pattern. This limits the amount of system
@ -291,10 +283,24 @@ sure both macros are undefined; an emulation function will then be used. */
#define PCRE2GREP_MAX_BUFSIZE 1048576
#endif
/* See PCRE2_EXP_DEFN; but this is applied to functions in the libpcre2-posix
library. */
/* #undef PCRE2POSIX_EXP_DEFN */
/* Define to any value if linking libpcre2-posix dynamically. Ideally, if both
static and shared libraries are being built, then PCRE2POSIX_SHARED would
be defined only for the shared build. Indeed, this is a requirement on
Windows. However, when building with Autoconf and libtool, we compile the
sources once only to create both the static and shared library, so in this
case, PCRE2POSIX_SHARED should only be defined if the shared library is
being built, regardless of whether or not the static library is also being
built. */
/* #undef PCRE2POSIX_SHARED */
/* Define to any value to include debugging code. */
/* #undef PCRE2_DEBUG */
/* to make a symbol visible */
/* Define to the annotation for making a symbol visible. */
#define PCRE2_EXPORT
/* If you are compiling for a system other than a Unix-like system or
@ -309,7 +315,12 @@ sure both macros are undefined; an emulation function will then be used. */
in the C sense, but which are internal to the library. */
/* #undef PCRE2_EXP_DEFN */
/* Define to any value if linking statically (TODO: make nice with Libtool) */
/* Define to any value if linking statically. Ideally, if both static and
shared libraries are being built, then PCRE2_STATIC would be defined only
for the static build. Indeed, this is a requirement on Windows. With
Autoconf and libtool however, it is idiomatic to compile the sources once
to create both the static and shared library, so in this case, PCRE2_STATIC
should only be defined if no shared library is being built. */
/* #undef PCRE2_STATIC */
/* Define to necessary symbol if this constant uses a non-standard name on
@ -464,7 +475,7 @@ sure both macros are undefined; an emulation function will then be used. */
#endif
/* Version number of package */
#define VERSION "10.45"
#define VERSION "10.47"
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */

View file

@ -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
@ -44,9 +40,14 @@ sure both macros are undefined; an emulation function will then be used. */
assumes that all input strings are in EBCDIC. If you do not define this
macro, PCRE2 will assume input strings are ASCII or UTF-8/16/32 Unicode. It
is not possible to build a version of PCRE2 that supports both EBCDIC and
UTF-8/16/32. */
ASCII or UTF-8/16/32. */
#undef EBCDIC
/* To force an EBCDIC environment, define this macro to make the core PCRE2
library functions use EBCDIC codepage 1047, regardless of whether the
compiler supports it using C character literals. */
#undef EBCDIC_IGNORING_COMPILER
/* In an EBCDIC environment, define this macro to any value to arrange for the
NL character to be 0x25 instead of the default 0x15. NL plays the role that
LF does in an ASCII/Unicode environment. */
@ -58,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
@ -94,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 <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
@ -133,9 +128,6 @@ sure both macros are undefined; an emulation function will then be used. */
/* Define to 1 if you have the <stdlib.h> 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 <strings.h> header file. */
#undef HAVE_STRINGS_H
@ -266,10 +258,25 @@ sure both macros are undefined; an emulation function will then be used. */
allows for the buffering of "before" and "after" lines. */
#undef PCRE2GREP_MAX_BUFSIZE
/* See PCRE2_EXP_DEFN; but this is applied to functions in the libpcre2-posix
library. */
#undef PCRE2POSIX_EXP_DEFN
/* Define to any value if linking libpcre2-posix dynamically. Ideally, if both
static and shared libraries are being built, then PCRE2POSIX_SHARED would
be defined only for the shared build. Indeed, this is a requirement on
Windows. However, when building with Autoconf and libtool, we compile the
sources once only to create both the static and shared library, so in this
case, PCRE2POSIX_SHARED should only be defined if the shared library is
being built, regardless of whether or not the static library is also being
built. */
#undef PCRE2POSIX_SHARED
/* Define to any value to include debugging code. */
#undef PCRE2_DEBUG
/* to make a symbol visible */
/* Define to the annotation for making a symbol visible. */
#undef PCRE2_EXPORT
@ -285,7 +292,12 @@ sure both macros are undefined; an emulation function will then be used. */
in the C sense, but which are internal to the library. */
#undef PCRE2_EXP_DEFN
/* Define to any value if linking statically (TODO: make nice with Libtool) */
/* Define to any value if linking statically. Ideally, if both static and
shared libraries are being built, then PCRE2_STATIC would be defined only
for the static build. Indeed, this is a requirement on Windows. With
Autoconf and libtool however, it is idiomatic to compile the sources once
to create both the static and shared library, so in this case, PCRE2_STATIC
should only be defined if no shared library is being built. */
#undef PCRE2_STATIC
/* Define to necessary symbol if this constant uses a non-standard name on

View file

@ -0,0 +1,88 @@
# First version of PCRE2 in which symbols were assigned versions.
PCRE2_10.47 {
global:
pcre2_callout_enumerate_16;
pcre2_code_copy_16;
pcre2_code_copy_with_tables_16;
pcre2_code_free_16;
pcre2_compile_16;
pcre2_compile_context_copy_16;
pcre2_compile_context_create_16;
pcre2_compile_context_free_16;
pcre2_config_16;
pcre2_convert_context_copy_16;
pcre2_convert_context_create_16;
pcre2_convert_context_free_16;
pcre2_converted_pattern_free_16;
pcre2_dfa_match_16;
pcre2_general_context_copy_16;
pcre2_general_context_create_16;
pcre2_general_context_free_16;
pcre2_get_error_message_16;
pcre2_get_mark_16;
pcre2_get_match_data_heapframes_size_16;
pcre2_get_match_data_size_16;
pcre2_get_ovector_count_16;
pcre2_get_ovector_pointer_16;
pcre2_get_startchar_16;
pcre2_jit_compile_16;
pcre2_jit_free_unused_memory_16;
pcre2_jit_match_16;
pcre2_jit_stack_assign_16;
pcre2_jit_stack_create_16;
pcre2_jit_stack_free_16;
pcre2_maketables_16;
pcre2_maketables_free_16;
pcre2_match_16;
pcre2_match_context_copy_16;
pcre2_match_context_create_16;
pcre2_match_context_free_16;
pcre2_match_data_create_16;
pcre2_match_data_create_from_pattern_16;
pcre2_match_data_free_16;
pcre2_next_match_16;
pcre2_pattern_convert_16;
pcre2_pattern_info_16;
pcre2_serialize_decode_16;
pcre2_serialize_encode_16;
pcre2_serialize_free_16;
pcre2_serialize_get_number_of_codes_16;
pcre2_set_bsr_16;
pcre2_set_callout_16;
pcre2_set_character_tables_16;
pcre2_set_compile_extra_options_16;
pcre2_set_compile_recursion_guard_16;
pcre2_set_depth_limit_16;
pcre2_set_glob_escape_16;
pcre2_set_glob_separator_16;
pcre2_set_heap_limit_16;
pcre2_set_match_limit_16;
pcre2_set_max_pattern_compiled_length_16;
pcre2_set_max_pattern_length_16;
pcre2_set_max_varlookbehind_16;
pcre2_set_newline_16;
pcre2_set_offset_limit_16;
pcre2_set_optimize_16;
pcre2_set_parens_nest_limit_16;
pcre2_set_recursion_limit_16;
pcre2_set_recursion_memory_management_16;
pcre2_set_substitute_callout_16;
pcre2_set_substitute_case_callout_16;
pcre2_substitute_16;
pcre2_substring_copy_byname_16;
pcre2_substring_copy_bynumber_16;
pcre2_substring_free_16;
pcre2_substring_get_byname_16;
pcre2_substring_get_bynumber_16;
pcre2_substring_length_byname_16;
pcre2_substring_length_bynumber_16;
pcre2_substring_list_free_16;
pcre2_substring_list_get_16;
pcre2_substring_nametable_scan_16;
pcre2_substring_number_from_name_16;
local:
_fini;
_init;
};
# PCRE2_10.48 {} PCRE2_10.47;

View file

@ -0,0 +1,88 @@
# First version of PCRE2 in which symbols were assigned versions.
PCRE2_10.47 {
global:
pcre2_callout_enumerate_32;
pcre2_code_copy_32;
pcre2_code_copy_with_tables_32;
pcre2_code_free_32;
pcre2_compile_32;
pcre2_compile_context_copy_32;
pcre2_compile_context_create_32;
pcre2_compile_context_free_32;
pcre2_config_32;
pcre2_convert_context_copy_32;
pcre2_convert_context_create_32;
pcre2_convert_context_free_32;
pcre2_converted_pattern_free_32;
pcre2_dfa_match_32;
pcre2_general_context_copy_32;
pcre2_general_context_create_32;
pcre2_general_context_free_32;
pcre2_get_error_message_32;
pcre2_get_mark_32;
pcre2_get_match_data_heapframes_size_32;
pcre2_get_match_data_size_32;
pcre2_get_ovector_count_32;
pcre2_get_ovector_pointer_32;
pcre2_get_startchar_32;
pcre2_jit_compile_32;
pcre2_jit_free_unused_memory_32;
pcre2_jit_match_32;
pcre2_jit_stack_assign_32;
pcre2_jit_stack_create_32;
pcre2_jit_stack_free_32;
pcre2_maketables_32;
pcre2_maketables_free_32;
pcre2_match_32;
pcre2_match_context_copy_32;
pcre2_match_context_create_32;
pcre2_match_context_free_32;
pcre2_match_data_create_32;
pcre2_match_data_create_from_pattern_32;
pcre2_match_data_free_32;
pcre2_next_match_32;
pcre2_pattern_convert_32;
pcre2_pattern_info_32;
pcre2_serialize_decode_32;
pcre2_serialize_encode_32;
pcre2_serialize_free_32;
pcre2_serialize_get_number_of_codes_32;
pcre2_set_bsr_32;
pcre2_set_callout_32;
pcre2_set_character_tables_32;
pcre2_set_compile_extra_options_32;
pcre2_set_compile_recursion_guard_32;
pcre2_set_depth_limit_32;
pcre2_set_glob_escape_32;
pcre2_set_glob_separator_32;
pcre2_set_heap_limit_32;
pcre2_set_match_limit_32;
pcre2_set_max_pattern_compiled_length_32;
pcre2_set_max_pattern_length_32;
pcre2_set_max_varlookbehind_32;
pcre2_set_newline_32;
pcre2_set_offset_limit_32;
pcre2_set_optimize_32;
pcre2_set_parens_nest_limit_32;
pcre2_set_recursion_limit_32;
pcre2_set_recursion_memory_management_32;
pcre2_set_substitute_callout_32;
pcre2_set_substitute_case_callout_32;
pcre2_substitute_32;
pcre2_substring_copy_byname_32;
pcre2_substring_copy_bynumber_32;
pcre2_substring_free_32;
pcre2_substring_get_byname_32;
pcre2_substring_get_bynumber_32;
pcre2_substring_length_byname_32;
pcre2_substring_length_bynumber_32;
pcre2_substring_list_free_32;
pcre2_substring_list_get_32;
pcre2_substring_nametable_scan_32;
pcre2_substring_number_from_name_32;
local:
_fini;
_init;
};
# PCRE2_10.48 {} PCRE2_10.47;

View file

@ -0,0 +1,88 @@
# First version of PCRE2 in which symbols were assigned versions.
PCRE2_10.47 {
global:
pcre2_callout_enumerate_8;
pcre2_code_copy_8;
pcre2_code_copy_with_tables_8;
pcre2_code_free_8;
pcre2_compile_8;
pcre2_compile_context_copy_8;
pcre2_compile_context_create_8;
pcre2_compile_context_free_8;
pcre2_config_8;
pcre2_convert_context_copy_8;
pcre2_convert_context_create_8;
pcre2_convert_context_free_8;
pcre2_converted_pattern_free_8;
pcre2_dfa_match_8;
pcre2_general_context_copy_8;
pcre2_general_context_create_8;
pcre2_general_context_free_8;
pcre2_get_error_message_8;
pcre2_get_mark_8;
pcre2_get_match_data_heapframes_size_8;
pcre2_get_match_data_size_8;
pcre2_get_ovector_count_8;
pcre2_get_ovector_pointer_8;
pcre2_get_startchar_8;
pcre2_jit_compile_8;
pcre2_jit_free_unused_memory_8;
pcre2_jit_match_8;
pcre2_jit_stack_assign_8;
pcre2_jit_stack_create_8;
pcre2_jit_stack_free_8;
pcre2_maketables_8;
pcre2_maketables_free_8;
pcre2_match_8;
pcre2_match_context_copy_8;
pcre2_match_context_create_8;
pcre2_match_context_free_8;
pcre2_match_data_create_8;
pcre2_match_data_create_from_pattern_8;
pcre2_match_data_free_8;
pcre2_next_match_8;
pcre2_pattern_convert_8;
pcre2_pattern_info_8;
pcre2_serialize_decode_8;
pcre2_serialize_encode_8;
pcre2_serialize_free_8;
pcre2_serialize_get_number_of_codes_8;
pcre2_set_bsr_8;
pcre2_set_callout_8;
pcre2_set_character_tables_8;
pcre2_set_compile_extra_options_8;
pcre2_set_compile_recursion_guard_8;
pcre2_set_depth_limit_8;
pcre2_set_glob_escape_8;
pcre2_set_glob_separator_8;
pcre2_set_heap_limit_8;
pcre2_set_match_limit_8;
pcre2_set_max_pattern_compiled_length_8;
pcre2_set_max_pattern_length_8;
pcre2_set_max_varlookbehind_8;
pcre2_set_newline_8;
pcre2_set_offset_limit_8;
pcre2_set_optimize_8;
pcre2_set_parens_nest_limit_8;
pcre2_set_recursion_limit_8;
pcre2_set_recursion_memory_management_8;
pcre2_set_substitute_callout_8;
pcre2_set_substitute_case_callout_8;
pcre2_substitute_8;
pcre2_substring_copy_byname_8;
pcre2_substring_copy_bynumber_8;
pcre2_substring_free_8;
pcre2_substring_get_byname_8;
pcre2_substring_get_bynumber_8;
pcre2_substring_length_byname_8;
pcre2_substring_length_bynumber_8;
pcre2_substring_list_free_8;
pcre2_substring_list_get_8;
pcre2_substring_nametable_scan_8;
pcre2_substring_number_from_name_8;
local:
_fini;
_init;
};
# PCRE2_10.48 {} PCRE2_10.47;

View file

@ -0,0 +1,13 @@
# First version of PCRE2 in which symbols were assigned versions.
PCRE2_10.47 {
global:
pcre2_regcomp;
pcre2_regerror;
pcre2_regexec;
pcre2_regfree;
local:
_fini;
_init;
};
# PCRE2_10.48 {} PCRE2_10.47;

View file

@ -42,25 +42,21 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE2_MAJOR 10
#define PCRE2_MINOR 45
#define PCRE2_MINOR 47
#define PCRE2_PRERELEASE
#define PCRE2_DATE 2025-02-05
#define PCRE2_DATE 2025-10-21
/* When an application links to a PCRE DLL in Windows, the symbols that are
/* When an application links to a PCRE2 DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
export setting is defined in pcre2_internal.h, which includes this file. So we
don't change existing definitions of PCRE2_EXP_DECL. */
export setting is defined in pcre2_internal.h, which includes this file. So, we
don't change existing definitions of PCRE2_EXP_DECL.
#if defined(_WIN32) && !defined(PCRE2_STATIC)
# ifndef PCRE2_EXP_DECL
# define PCRE2_EXP_DECL extern __declspec(dllimport)
# endif
#endif
/* By default, we use the standard "extern" declarations. */
By default, we use the standard "extern" declarations. */
#ifndef PCRE2_EXP_DECL
# ifdef __cplusplus
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DECL extern __declspec(dllimport)
# elif defined __cplusplus
# define PCRE2_EXP_DECL extern "C"
# else
# define PCRE2_EXP_DECL extern
@ -68,14 +64,15 @@ don't change existing definitions of PCRE2_EXP_DECL. */
#endif
/* When compiling with the MSVC compiler, it is sometimes necessary to include
a "calling convention" before exported function names. (This is secondhand
information; I know nothing about MSVC myself). For example, something like
a "calling convention" before exported function names. For example:
void __cdecl function(....)
might be needed. In order so make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
set, we ensure here that it has no effect. */
might be needed. In order to make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names.
PCRE2 normally uses the platform's standard calling convention, so this should
not be set unless you know you need it. */
#ifndef PCRE2_CALL_CONVENTION
#define PCRE2_CALL_CONVENTION
@ -343,6 +340,10 @@ pcre2_pattern_convert(). */
#define PCRE2_ERROR_PERL_ECLASS_EMPTY_EXPR 214
#define PCRE2_ERROR_PERL_ECLASS_MISSING_CLOSE 215
#define PCRE2_ERROR_PERL_ECLASS_UNEXPECTED_CHAR 216
#define PCRE2_ERROR_EXPECTED_CAPTURE_GROUP 217
#define PCRE2_ERROR_MISSING_OPENING_PARENTHESIS 218
#define PCRE2_ERROR_MISSING_NUMBER_TERMINATOR 219
#define PCRE2_ERROR_NULL_ERROROFFSET 220
/* "Expected" matching error codes: no match and partial match. */
@ -432,6 +433,11 @@ released, the numbers must not be changed. */
#define PCRE2_ERROR_JIT_UNSUPPORTED (-68)
#define PCRE2_ERROR_REPLACECASE (-69)
#define PCRE2_ERROR_TOOLARGEREPLACE (-70)
#define PCRE2_ERROR_DIFFSUBSPATTERN (-71)
#define PCRE2_ERROR_DIFFSUBSSUBJECT (-72)
#define PCRE2_ERROR_DIFFSUBSOFFSET (-73)
#define PCRE2_ERROR_DIFFSUBSOPTIONS (-74)
#define PCRE2_ERROR_BAD_BACKSLASH_K (-75)
/* Request types for pcre2_pattern_info() */
@ -484,6 +490,7 @@ released, the numbers must not be changed. */
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
#define PCRE2_CONFIG_TABLES_LENGTH 15
#define PCRE2_CONFIG_EFFECTIVE_LINKSIZE 16
/* Optimization directives for pcre2_set_optimize().
For binary compatibility, only add to this list; do not renumber. */
@ -743,14 +750,14 @@ PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
pcre2_match_data_create_from_pattern(const pcre2_code *, \
pcre2_general_context *); \
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
uint32_t, pcre2_match_data *, pcre2_match_context *); \
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
pcre2_get_mark(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
@ -762,7 +769,9 @@ PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
pcre2_get_ovector_pointer(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
pcre2_get_startchar(pcre2_match_data *);
pcre2_get_startchar(pcre2_match_data *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_next_match(pcre2_match_data *, PCRE2_SIZE *, uint32_t *);
/* Convenience functions for handling matched substrings. */
@ -942,6 +951,7 @@ pcre2_compile are called by application code. */
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
#define pcre2_next_match PCRE2_SUFFIX(pcre2_next_match_)
#define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
#define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_)

View file

@ -46,21 +46,17 @@ POSSIBILITY OF SUCH DAMAGE.
#define PCRE2_PRERELEASE @PCRE2_PRERELEASE@
#define PCRE2_DATE @PCRE2_DATE@
/* When an application links to a PCRE DLL in Windows, the symbols that are
/* When an application links to a PCRE2 DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
export setting is defined in pcre2_internal.h, which includes this file. So we
don't change existing definitions of PCRE2_EXP_DECL. */
export setting is defined in pcre2_internal.h, which includes this file. So, we
don't change existing definitions of PCRE2_EXP_DECL.
#if defined(_WIN32) && !defined(PCRE2_STATIC)
# ifndef PCRE2_EXP_DECL
# define PCRE2_EXP_DECL extern __declspec(dllimport)
# endif
#endif
/* By default, we use the standard "extern" declarations. */
By default, we use the standard "extern" declarations. */
#ifndef PCRE2_EXP_DECL
# ifdef __cplusplus
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DECL extern __declspec(dllimport)
# elif defined __cplusplus
# define PCRE2_EXP_DECL extern "C"
# else
# define PCRE2_EXP_DECL extern
@ -68,14 +64,15 @@ don't change existing definitions of PCRE2_EXP_DECL. */
#endif
/* When compiling with the MSVC compiler, it is sometimes necessary to include
a "calling convention" before exported function names. (This is secondhand
information; I know nothing about MSVC myself). For example, something like
a "calling convention" before exported function names. For example:
void __cdecl function(....)
might be needed. In order so make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
set, we ensure here that it has no effect. */
might be needed. In order to make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names.
PCRE2 normally uses the platform's standard calling convention, so this should
not be set unless you know you need it. */
#ifndef PCRE2_CALL_CONVENTION
#define PCRE2_CALL_CONVENTION
@ -343,6 +340,10 @@ pcre2_pattern_convert(). */
#define PCRE2_ERROR_PERL_ECLASS_EMPTY_EXPR 214
#define PCRE2_ERROR_PERL_ECLASS_MISSING_CLOSE 215
#define PCRE2_ERROR_PERL_ECLASS_UNEXPECTED_CHAR 216
#define PCRE2_ERROR_EXPECTED_CAPTURE_GROUP 217
#define PCRE2_ERROR_MISSING_OPENING_PARENTHESIS 218
#define PCRE2_ERROR_MISSING_NUMBER_TERMINATOR 219
#define PCRE2_ERROR_NULL_ERROROFFSET 220
/* "Expected" matching error codes: no match and partial match. */
@ -432,6 +433,11 @@ released, the numbers must not be changed. */
#define PCRE2_ERROR_JIT_UNSUPPORTED (-68)
#define PCRE2_ERROR_REPLACECASE (-69)
#define PCRE2_ERROR_TOOLARGEREPLACE (-70)
#define PCRE2_ERROR_DIFFSUBSPATTERN (-71)
#define PCRE2_ERROR_DIFFSUBSSUBJECT (-72)
#define PCRE2_ERROR_DIFFSUBSOFFSET (-73)
#define PCRE2_ERROR_DIFFSUBSOPTIONS (-74)
#define PCRE2_ERROR_BAD_BACKSLASH_K (-75)
/* Request types for pcre2_pattern_info() */
@ -484,6 +490,7 @@ released, the numbers must not be changed. */
#define PCRE2_CONFIG_NEVER_BACKSLASH_C 13
#define PCRE2_CONFIG_COMPILED_WIDTHS 14
#define PCRE2_CONFIG_TABLES_LENGTH 15
#define PCRE2_CONFIG_EFFECTIVE_LINKSIZE 16
/* Optimization directives for pcre2_set_optimize().
For binary compatibility, only add to this list; do not renumber. */
@ -743,14 +750,14 @@ PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL pcre2_match_data *PCRE2_CALL_CONVENTION \
pcre2_match_data_create_from_pattern(const pcre2_code *, \
pcre2_general_context *); \
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
uint32_t, pcre2_match_data *, pcre2_match_context *, int *, PCRE2_SIZE); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
uint32_t, pcre2_match_data *, pcre2_match_context *); \
PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
pcre2_get_mark(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
@ -762,7 +769,9 @@ PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL PCRE2_SIZE *PCRE2_CALL_CONVENTION \
pcre2_get_ovector_pointer(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
pcre2_get_startchar(pcre2_match_data *);
pcre2_get_startchar(pcre2_match_data *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_next_match(pcre2_match_data *, PCRE2_SIZE *, uint32_t *);
/* Convenience functions for handling matched substrings. */
@ -942,6 +951,7 @@ pcre2_compile are called by application code. */
#define pcre2_match_data_create PCRE2_SUFFIX(pcre2_match_data_create_)
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
#define pcre2_next_match PCRE2_SUFFIX(pcre2_next_match_)
#define pcre2_pattern_convert PCRE2_SUFFIX(pcre2_pattern_convert_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
#define pcre2_serialize_decode PCRE2_SUFFIX(pcre2_serialize_decode_)

View file

@ -38,17 +38,15 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains functions that scan a compiled pattern and change
repeats into possessive repeats where possible. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/* This macro represents the max size of list[] and that is used to keep
track of UCD info in several places, it should be kept on sync with the
value used by GenerateUcd.py */
@ -264,8 +262,10 @@ switch(ptype)
if (c < *p) return !negated;
if (c == *p++) return negated;
}
/* LCOV_EXCL_START */
PCRE2_DEBUG_UNREACHABLE(); /* Control should never reach here */
break;
/* LCOV_EXCL_STOP */
/* Haven't yet thought these through. */
@ -806,21 +806,21 @@ for(;;)
case OP_NOT_DIGIT:
invert_bits = TRUE;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_DIGIT:
set2 = (const uint8_t *)(cb->cbits + cbit_digit);
break;
case OP_NOT_WHITESPACE:
invert_bits = TRUE;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_WHITESPACE:
set2 = (const uint8_t *)(cb->cbits + cbit_space);
break;
case OP_NOT_WORDCHAR:
invert_bits = TRUE;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_WORDCHAR:
set2 = (const uint8_t *)(cb->cbits + cbit_word);
break;
@ -1103,7 +1103,7 @@ for(;;)
case OP_NCLASS:
if (chr > 255) return FALSE;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_CLASS:
if (chr > 255) break;
@ -1141,8 +1141,10 @@ for(;;)
if (list[1] == 0) return TRUE;
}
/* LCOV_EXCL_START */
PCRE2_DEBUG_UNREACHABLE(); /* Control should never reach here */
return FALSE; /* Avoid compiler warnings */
/* LCOV_EXCL_STOP */
}
@ -1181,11 +1183,13 @@ for (;;)
{
c = *code;
/* LCOV_EXCL_START */
if (c >= OP_TABLE_LENGTH)
{
PCRE2_DEBUG_UNREACHABLE();
return -1; /* Something gone wrong */
}
/* LCOV_EXCL_STOP */
if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
{

View file

@ -19,10 +19,6 @@ PCRE2 is configured with --enable-rebuild-chartables. However, you can run
pcre2_dftables manually with the -L option to build tables using the LC_ALL
locale. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
const uint8_t PRIV(default_tables)[] = {

View file

@ -0,0 +1,196 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* This file was automatically written by the pcre2_dftables auxiliary
program. It contains character tables that are used when no external
tables are passed to PCRE2 by the application that calls it. The tables
are used only for characters whose code values are less than 256, and
only relevant if not in UCP mode. */
/* This set of tables was written in the EBCDIC 1047 (NL 0x15) locale. */
/* The pcre2_ftables program (which is distributed with PCRE2) can be used
to build alternative versions of this file. This is necessary if you are
running in an EBCDIC environment, or if you want to default to a different
encoding, for example ISO-8859-1. When pcre2_dftables is run, it creates
these tables in the "C" locale by default. This happens automatically if
PCRE2 is configured with --enable-rebuild-chartables. However, you can run
pcre2_dftables manually with the -L option to build tables using the LC_ALL
locale. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
const uint8_t PRIV(default_tables)[] = {
/* This table is a lower casing table. */
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,
104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,
136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,
152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,
168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,
184,185,186,187,188,189,190,191,
192,129,130,131,132,133,134,135,
136,137,202,203,204,205,206,207,
208,145,146,147,148,149,150,151,
152,153,218,219,220,221,222,223,
224,225,162,163,164,165,166,167,
168,169,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,
248,249,250,251,252,253,254,255,
/* This table is a case flipping table. */
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,
104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126,127,
128,193,194,195,196,197,198,199,
200,201,138,139,140,141,142,143,
144,209,210,211,212,213,214,215,
216,217,154,155,156,157,158,159,
160,161,226,227,228,229,230,231,
232,233,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,
184,185,186,187,188,189,190,191,
192,129,130,131,132,133,134,135,
136,137,202,203,204,205,206,207,
208,145,146,147,148,149,150,151,
152,153,218,219,220,221,222,223,
224,225,162,163,164,165,166,167,
168,169,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,
248,249,250,251,252,253,254,255,
/* This table contains bit maps for various character classes. Each map is 32
bytes long and the bits run from the least significant end of each byte. The
classes that have their own maps are: space, xdigit, digit, upper, lower, word,
graph, print, punct, and cntrl. Other classes are built from combinations. */
0x20,0x38,0x20,0x00,0x00,0x00,0x00,0x00, /* space */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* xdigit */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7e,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* digit */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* upper */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* lower */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* word */
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* graph */
0x00,0xf8,0x01,0xfc,0x03,0xf8,0x00,0xfe,
0xfe,0x03,0xfe,0x03,0xfe,0x23,0x00,0x20,
0xff,0x03,0xff,0x03,0xfd,0x03,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* print */
0x01,0xf8,0x01,0xfc,0x03,0xf8,0x00,0xfe,
0xfe,0x03,0xfe,0x03,0xfe,0x23,0x00,0x20,
0xff,0x03,0xff,0x03,0xfd,0x03,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* punct */
0x00,0xf8,0x01,0xfc,0x03,0xf8,0x00,0xfe,
0x00,0x00,0x00,0x00,0x02,0x20,0x00,0x20,
0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
0xaf,0xf8,0x6f,0xf3,0xc0,0xe0,0x84,0xb0, /* cntrl */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* This table identifies various classes of character by individual bits:
0x01 white space character
0x02 letter
0x04 lower case letter
0x08 decimal digit
0x10 word (alphanumeric or '_')
*/
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* 0- 7 */
0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* 16- 23 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* - ' */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* ( - / */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0 - 7 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 8 - ? */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* @ - G */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* H - O */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* P - W */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* X - _ */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* ` - g */
0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* h - o */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p - w */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* x -127 */
0x00,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /* 128-135 */
0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
0x00,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /* 144-151 */
0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
0x00,0x00,0x16,0x16,0x16,0x16,0x16,0x16, /* 160-167 */
0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
0x00,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* 192-199 */
0x12,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
0x00,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* 208-215 */
0x12,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
0x00,0x00,0x12,0x12,0x12,0x12,0x12,0x12, /* 224-231 */
0x12,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 240-247 */
0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
/* End of pcre2_chartables.c */

View file

@ -0,0 +1,196 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* This file was automatically written by the pcre2_dftables auxiliary
program. It contains character tables that are used when no external
tables are passed to PCRE2 by the application that calls it. The tables
are used only for characters whose code values are less than 256, and
only relevant if not in UCP mode. */
/* This set of tables was written in the EBCDIC 1047 (NL 0x25) locale. */
/* The pcre2_ftables program (which is distributed with PCRE2) can be used
to build alternative versions of this file. This is necessary if you are
running in an EBCDIC environment, or if you want to default to a different
encoding, for example ISO-8859-1. When pcre2_dftables is run, it creates
these tables in the "C" locale by default. This happens automatically if
PCRE2 is configured with --enable-rebuild-chartables. However, you can run
pcre2_dftables manually with the -L option to build tables using the LC_ALL
locale. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
const uint8_t PRIV(default_tables)[] = {
/* This table is a lower casing table. */
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,
104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,
136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,
152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,
168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,
184,185,186,187,188,189,190,191,
192,129,130,131,132,133,134,135,
136,137,202,203,204,205,206,207,
208,145,146,147,148,149,150,151,
152,153,218,219,220,221,222,223,
224,225,162,163,164,165,166,167,
168,169,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,
248,249,250,251,252,253,254,255,
/* This table is a case flipping table. */
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,
104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,
120,121,122,123,124,125,126,127,
128,193,194,195,196,197,198,199,
200,201,138,139,140,141,142,143,
144,209,210,211,212,213,214,215,
216,217,154,155,156,157,158,159,
160,161,226,227,228,229,230,231,
232,233,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,
184,185,186,187,188,189,190,191,
192,129,130,131,132,133,134,135,
136,137,202,203,204,205,206,207,
208,145,146,147,148,149,150,151,
152,153,218,219,220,221,222,223,
224,225,162,163,164,165,166,167,
168,169,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,
248,249,250,251,252,253,254,255,
/* This table contains bit maps for various character classes. Each map is 32
bytes long and the bits run from the least significant end of each byte. The
classes that have their own maps are: space, xdigit, digit, upper, lower, word,
graph, print, punct, and cntrl. Other classes are built from combinations. */
0x20,0x38,0x00,0x00,0x20,0x00,0x00,0x00, /* space */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* xdigit */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x7e,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* digit */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* upper */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* lower */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* word */
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0x00,0x00,
0xfe,0x03,0xfe,0x03,0xfc,0x03,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* graph */
0x00,0xf8,0x01,0xfc,0x03,0xf8,0x00,0xfe,
0xfe,0x03,0xfe,0x03,0xfe,0x23,0x00,0x20,
0xff,0x03,0xff,0x03,0xfd,0x03,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* print */
0x01,0xf8,0x01,0xfc,0x03,0xf8,0x00,0xfe,
0xfe,0x03,0xfe,0x03,0xfe,0x23,0x00,0x20,
0xff,0x03,0xff,0x03,0xfd,0x03,0xff,0x03,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* punct */
0x00,0xf8,0x01,0xfc,0x03,0xf8,0x00,0xfe,
0x00,0x00,0x00,0x00,0x02,0x20,0x00,0x20,
0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
0xaf,0xf8,0x4f,0xf3,0xe0,0xe0,0x84,0xb0, /* cntrl */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* This table identifies various classes of character by individual bits:
0x01 white space character
0x02 letter
0x04 lower case letter
0x08 decimal digit
0x10 word (alphanumeric or '_')
*/
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* 0- 7 */
0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* - ' */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* ( - / */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0 - 7 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 8 - ? */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* @ - G */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* H - O */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* P - W */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* X - _ */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* ` - g */
0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* h - o */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* p - w */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* x -127 */
0x00,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /* 128-135 */
0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
0x00,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /* 144-151 */
0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
0x00,0x00,0x16,0x16,0x16,0x16,0x16,0x16, /* 160-167 */
0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
0x00,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* 192-199 */
0x12,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
0x00,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* 208-215 */
0x12,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
0x00,0x00,0x12,0x12,0x12,0x12,0x12,0x12, /* 224-231 */
0x12,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 240-247 */
0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
/* End of pcre2_chartables.c */

View file

@ -37,16 +37,16 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This file contains functions to implement checked integer operation */
#ifndef PCRE2_PCRE2TEST
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef PCRE2_PCRE2TEST
#include "pcre2_internal.h"
#endif
/*************************************************
* Checked Integer Multiplication *
*************************************************/

File diff suppressed because it is too large Load diff

View file

@ -51,18 +51,18 @@ pcre2.h.in must be updated - their values are exactly 100 greater than these
values. */
enum { ERR0 = COMPILE_ERROR_BASE,
ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10,
ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29, ERR30,
ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, ERR40,
ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49, ERR50,
ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59, ERR60,
ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70,
ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, ERR80,
ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90,
ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98, ERR99, ERR100,
ERR101,ERR102,ERR103,ERR104,ERR105,ERR106,ERR107,ERR108,ERR109,ERR110,
ERR111,ERR112,ERR113,ERR114,ERR115,ERR116 };
ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10,
ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29, ERR30,
ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, ERR40,
ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49, ERR50,
ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59, ERR60,
ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70,
ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, ERR80,
ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90,
ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98, ERR99, ERR100,
ERR101, ERR102, ERR103, ERR104, ERR105, ERR106, ERR107, ERR108, ERR109, ERR110,
ERR111, ERR112, ERR113, ERR114, ERR115, ERR116, ERR117, ERR118, ERR119, ERR120 };
/* Code values for parsed patterns, which are stored in a vector of 32-bit
unsigned ints. Values less than META_END are literal data values. The coding
@ -96,11 +96,11 @@ code (meta_extra_lengths) must be updated to remain in step. */
#define META_COND_RNAME 0x80130000u /* (?(R&name)... */
#define META_COND_RNUMBER 0x80140000u /* (?(Rdigits)... */
#define META_COND_VERSION 0x80150000u /* (?(VERSION<op>x.y)... */
#define META_OFFSET 0x80160000u /* Setting offset for various
META codes (e.g. META_SCS_NAME) */
#define META_OFFSET 0x80160000u /* Setting offset for various META
codes (e.g. META_CAPTURE_NAME) */
#define META_SCS 0x80170000u /* (*scan_substring:... */
#define META_SCS_NAME 0x80180000u /* Next <name> of scan_substring */
#define META_SCS_NUMBER 0x80190000u /* Next digits of scan_substring */
#define META_CAPTURE_NAME 0x80180000u /* Next <name> in capture lists */
#define META_CAPTURE_NUMBER 0x80190000u /* Next digits in capture lists */
#define META_DOLLAR 0x801a0000u /* $ metacharacter */
#define META_DOT 0x801b0000u /* . metacharacter */
#define META_ESCAPE 0x801c0000u /* \d and friends */
@ -186,6 +186,36 @@ therefore no need for it to have a length entry, so use a high value. */
#define META_DATA(x) (x & 0x0000ffffu)
#define META_DIFF(x,y) ((x-y)>>16)
/* Macros to store and retrieve a PCRE2_SIZE value in the parsed pattern, which
consists of uint32_t elements. Assume that if uint32_t can't hold it, two of
them will be able to (i.e. assume a 64-bit world). */
#if PCRE2_SIZE_MAX <= UINT32_MAX
#define PUTOFFSET(s,p) *p++ = s
#define GETOFFSET(s,p) s = *p++
#define GETPLUSOFFSET(s,p) s = *(++p)
#define READPLUSOFFSET(s,p) s = p[1]
#define SKIPOFFSET(p) p++
#define SIZEOFFSET 1
#else
#define PUTOFFSET(s,p) \
{ *p++ = (uint32_t)(s >> 32); *p++ = (uint32_t)(s & 0xffffffff); }
#define GETOFFSET(s,p) \
{ s = ((PCRE2_SIZE)p[0] << 32) | (PCRE2_SIZE)p[1]; p += 2; }
#define GETPLUSOFFSET(s,p) \
{ s = ((PCRE2_SIZE)p[1] << 32) | (PCRE2_SIZE)p[2]; p += 2; }
#define READPLUSOFFSET(s,p) \
{ s = ((PCRE2_SIZE)p[1] << 32) | (PCRE2_SIZE)p[2]; }
#define SKIPOFFSET(p) p += 2
#define SIZEOFFSET 2
#endif
#ifdef PCRE2_DEBUG
/* Compile data types. */
#define CDATA_RECURSE_ARGS 0 /* Argument list for recurse */
#define CDATA_CRANGE 1 /* Character range list */
#endif
/* Extended class management flags. */
#define CLASS_IS_ECLASS 0x1
@ -236,10 +266,16 @@ typedef struct {
/* Macros for the definitions below, to prevent name collisions. */
#define _pcre2_posix_class_maps PCRE2_SUFFIX(_pcre2_posix_class_maps)
#define _pcre2_update_classbits PCRE2_SUFFIX(_pcre2_update_classbits_)
#define _pcre2_compile_class_nested PCRE2_SUFFIX(_pcre2_compile_class_nested_)
#define _pcre2_compile_class_not_nested PCRE2_SUFFIX(_pcre2_compile_class_not_nested_)
#define _pcre2_posix_class_maps PCRE2_SUFFIX(_pcre2_posix_class_maps)
#define _pcre2_update_classbits PCRE2_SUFFIX(_pcre2_update_classbits_)
#define _pcre2_compile_class_nested PCRE2_SUFFIX(_pcre2_compile_class_nested_)
#define _pcre2_compile_class_not_nested PCRE2_SUFFIX(_pcre2_compile_class_not_nested_)
#define _pcre2_compile_get_hash_from_name PCRE2_SUFFIX(_pcre2_compile_get_hash_from_name)
#define _pcre2_compile_find_named_group PCRE2_SUFFIX(_pcre2_compile_find_named_group)
#define _pcre2_compile_find_dupname_details PCRE2_SUFFIX(_pcre2_compile_find_dupname_details)
#define _pcre2_compile_add_name_to_table PCRE2_SUFFIX(_pcre2_compile_add_name_to_table)
#define _pcre2_compile_parse_scan_substr_args PCRE2_SUFFIX(_pcre2_compile_parse_scan_substr_args)
#define _pcre2_compile_parse_recurse_args PCRE2_SUFFIX(_pcre2_compile_parse_recurse_args)
/* Indices of the POSIX classes in posix_names, posix_name_lengths,
@ -253,6 +289,14 @@ posix_class_maps, and posix_substitutes. They must be kept in sync. */
extern const int PRIV(posix_class_maps)[];
/* Defines for hash_dup member in named_group structure. */
#define NAMED_GROUP_HASH_MASK ((uint16_t)0x7fff)
#define NAMED_GROUP_IS_DUPNAME ((uint16_t)0x8000)
#define NAMED_GROUP_GET_HASH(ng) ((ng)->hash_dup & NAMED_GROUP_HASH_MASK)
/* Exported functions from pcre2_compile_class.c file: */
/* Set bits in classbits according to the property type */
@ -275,6 +319,38 @@ BOOL PRIV(compile_class_nested)(uint32_t options, uint32_t xoptions,
uint32_t **pptr, PCRE2_UCHAR **pcode, int *errorcodeptr,
compile_block *cb, PCRE2_SIZE *lengthptr);
/* Exported functions from pcre2_compile_cgroup.c file: */
/* Compute hash from a capture name. */
uint16_t PRIV(compile_get_hash_from_name)(PCRE2_SPTR name, uint32_t length);
/* Get the descriptor of a known named capture. */
named_group *PRIV(compile_find_named_group)(PCRE2_SPTR name,
uint32_t length, compile_block *cb);
/* Add entires to name table in alphabetical order. */
uint32_t PRIV(compile_add_name_to_table)(compile_block *cb,
named_group *ng, uint32_t tablecount);
/* Searches the properties of duplicated names, and returns them
in indexptr and countptr. */
BOOL PRIV(compile_find_dupname_details)(PCRE2_SPTR name, uint32_t length,
int *indexptr, int *countptr, int *errorcodeptr, compile_block *cb);
/* Parse the arguments of recurse operations. */
uint32_t * PRIV(compile_parse_scan_substr_args)(uint32_t *pptr,
int *errorcodeptr, compile_block *cb, PCRE2_SIZE *lengthptr);
/* Parse the arguments of recurse operations. */
BOOL PRIV(compile_parse_recurse_args)(uint32_t *pptr_start,
PCRE2_SIZE offset, int *errorcodeptr, compile_block *cb);
#endif /* PCRE2_COMPILE_H_IDEMPOTENT_GUARD */
/* End of pcre2_compile.h */

View file

@ -0,0 +1,632 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
#include "pcre2_compile.h"
/*************************************************
* Compute the hash code from a capture name *
*************************************************/
/* This function returns with a simple hash code
computed from the name of a capture group.
Arguments:
name name of the capture group
length the length of the name
Returns: hash code
*/
uint16_t
PRIV(compile_get_hash_from_name)(PCRE2_SPTR name, uint32_t length)
{
uint16_t hash;
PCRE2_ASSERT(length > 0);
hash = (uint16_t)((name[0] & 0x7f) | ((name[length - 1] & 0xff) << 7));
PCRE2_ASSERT(hash <= NAMED_GROUP_HASH_MASK);
return hash;
}
/*************************************************
* Get the descriptor of a known named capture *
*************************************************/
/* This function returns the descriptor in the
named group list of a known capture group.
Arguments:
name name of the capture group
length the length of the name
Returns: pointer to the descriptor when found,
NULL otherwise
*/
named_group *
PRIV(compile_find_named_group)(PCRE2_SPTR name,
uint32_t length, compile_block *cb)
{
uint16_t hash = PRIV(compile_get_hash_from_name)(name, length);
named_group *ng;
named_group *end = cb->named_groups + cb->names_found;
for (ng = cb->named_groups; ng < end; ng++)
if (length == ng->length && hash == NAMED_GROUP_GET_HASH(ng) &&
PRIV(strncmp)(name, ng->name, length) == 0) return ng;
return NULL;
}
/*************************************************
* Add an entry to the name/number table *
*************************************************/
/* This function is called between compiling passes to add an entry to the
name/number table, maintaining alphabetical order. Checking for permitted
and forbidden duplicates has already been done.
Arguments:
cb the compile data block
nb named group entry
tablecount the count of names in the table so far
Returns: new tablecount
*/
uint32_t
PRIV(compile_add_name_to_table)(compile_block *cb,
named_group *ng, uint32_t tablecount)
{
uint32_t i;
PCRE2_SPTR name = ng->name;
int length = ng->length;
uint32_t duplicate_count = 1;
PCRE2_UCHAR *slot = cb->name_table;
PCRE2_ASSERT(length > 0);
if ((ng->hash_dup & NAMED_GROUP_IS_DUPNAME) != 0)
{
named_group *ng_it;
named_group *end = cb->named_groups + cb->names_found;
for (ng_it = ng + 1; ng_it < end; ng_it++)
if (ng_it->name == name) duplicate_count++;
}
for (i = 0; i < tablecount; i++)
{
int crc = memcmp(name, slot + IMM2_SIZE, CU2BYTES(length));
if (crc == 0 && slot[IMM2_SIZE + length] != 0)
crc = -1; /* Current name is a substring */
/* Make space in the table and break the loop for an earlier name. For a
duplicate or later name, carry on. We do this for duplicates so that in the
simple case (when ?(| is not used) they are in order of their numbers. In all
cases they are in the order in which they appear in the pattern. */
if (crc < 0)
{
(void)memmove(slot + cb->name_entry_size * duplicate_count, slot,
CU2BYTES((tablecount - i) * cb->name_entry_size));
break;
}
/* Continue the loop for a later or duplicate name */
slot += cb->name_entry_size;
}
tablecount += duplicate_count;
while (TRUE)
{
PUT2(slot, 0, ng->number);
memcpy(slot + IMM2_SIZE, name, CU2BYTES(length));
/* Add a terminating zero and fill the rest of the slot with zeroes so that
the memory is all initialized. Otherwise valgrind moans about uninitialized
memory when saving serialized compiled patterns. */
memset(slot + IMM2_SIZE + length, 0,
CU2BYTES(cb->name_entry_size - length - IMM2_SIZE));
if (--duplicate_count == 0) break;
while (TRUE)
{
++ng;
if (ng->name == name) break;
}
slot += cb->name_entry_size;
}
return tablecount;
}
/*************************************************
* Find details of duplicate group names *
*************************************************/
/* This is called from compile_branch() when it needs to know the index and
count of duplicates in the names table when processing named backreferences,
either directly, or as conditions.
Arguments:
name points to the name
length the length of the name
indexptr where to put the index
countptr where to put the count of duplicates
errorcodeptr where to put an error code
cb the compile block
Returns: TRUE if OK, FALSE if not, error code set
*/
BOOL
PRIV(compile_find_dupname_details)(PCRE2_SPTR name, uint32_t length,
int *indexptr, int *countptr, int *errorcodeptr, compile_block *cb)
{
uint32_t i, groupnumber;
int count;
PCRE2_UCHAR *slot = cb->name_table;
/* Find the first entry in the table */
for (i = 0; i < cb->names_found; i++)
{
if (PRIV(strncmp)(name, slot + IMM2_SIZE, length) == 0 &&
slot[IMM2_SIZE + length] == 0) break;
slot += cb->name_entry_size;
}
/* This should not occur, because this function is called only when we know we
have duplicate names. Give an internal error. */
/* LCOV_EXCL_START */
if (i >= cb->names_found)
{
PCRE2_DEBUG_UNREACHABLE();
*errorcodeptr = ERR53;
cb->erroroffset = name - cb->start_pattern;
return FALSE;
}
/* LCOV_EXCL_STOP */
/* Record the index and then see how many duplicates there are, updating the
backref map and maximum back reference as we do. */
*indexptr = i;
count = 0;
for (;;)
{
count++;
groupnumber = GET2(slot, 0);
cb->backref_map |= (groupnumber < 32)? (1u << groupnumber) : 1;
if (groupnumber > cb->top_backref) cb->top_backref = groupnumber;
if (++i >= cb->names_found) break;
slot += cb->name_entry_size;
if (PRIV(strncmp)(name, slot + IMM2_SIZE, length) != 0 ||
(slot + IMM2_SIZE)[length] != 0) break;
}
*countptr = count;
return TRUE;
}
/* Process the capture list of scan substring and recurse
operations. Since at least one argument must be present,
a 0 return value represents error. */
static size_t
PRIV(compile_process_capture_list)(uint32_t *pptr, PCRE2_SIZE offset,
int *errorcodeptr, compile_block *cb)
{
size_t i, size = 0;
named_group *ng;
PCRE2_SPTR name;
uint32_t length;
named_group *end = cb->named_groups + cb->names_found;
while (TRUE)
{
++pptr;
switch (META_CODE(*pptr))
{
case META_OFFSET:
GETPLUSOFFSET(offset, pptr);
continue;
case META_CAPTURE_NAME:
offset += META_DATA(*pptr);
length = *(++pptr);
name = cb->start_pattern + offset;
ng = PRIV(compile_find_named_group)(name, length, cb);
if (ng == NULL)
{
*errorcodeptr = ERR15;
cb->erroroffset = offset;
return 0;
}
if ((ng->hash_dup & NAMED_GROUP_IS_DUPNAME) == 0)
{
pptr[-1] = META_CAPTURE_NUMBER;
pptr[0] = ng->number;
size++;
continue;
}
/* Remains only for duplicated names. */
pptr[-1] = META_CAPTURE_NAME;
pptr[0] = (uint32_t)(ng - cb->named_groups);
size++;
name = ng->name;
while (++ng < end)
if (ng->name == name) size++;
continue;
case META_CAPTURE_NUMBER:
offset += META_DATA(*pptr);
i = *(++pptr);
if (i > cb->bracount)
{
*errorcodeptr = ERR15;
cb->erroroffset = offset;
return 0;
}
if (i > cb->top_backref) cb->top_backref = (uint16_t)i;
size++;
continue;
default:
break;
}
PCRE2_ASSERT(size > 0);
return size;
}
}
/*******************************************************
* Parse the arguments of scan substring operations *
********************************************************/
/* This function parses the arguments of scan substring operations.
Arguments:
pptr_start points to the current parsed pattern pointer
offset argument starting offset in the pattern
errorcodeptr where to put an error code
cb the compile block
lengthptr NULL during the real compile phase
points to length accumulator during pre-compile phase
Returns: TRUE if OK, FALSE if not, error code set
*/
uint32_t *
PRIV(compile_parse_scan_substr_args)(uint32_t *pptr,
int *errorcodeptr, compile_block *cb, PCRE2_SIZE *lengthptr)
{
uint8_t *captures;
uint8_t *capture_ptr;
uint8_t bit;
PCRE2_SPTR name;
named_group *ng;
named_group *end = cb->named_groups + cb->names_found;
BOOL all_found;
size_t size;
PCRE2_ASSERT(*pptr == META_OFFSET);
if (PRIV(compile_process_capture_list)(pptr - 1, 0, errorcodeptr, cb) == 0)
return NULL;
/* Align to bytes. Since the highest capture can
be equal to bracount, +1 is added before the aligning. */
size = (cb->bracount + 1 + 7) >> 3;
captures = (uint8_t*)cb->cx->memctl.malloc(size, cb->cx->memctl.memory_data);
if (captures == NULL)
{
*errorcodeptr = ERR21;
READPLUSOFFSET(cb->erroroffset, pptr);
return NULL;
}
memset(captures, 0, size);
while (TRUE)
{
switch (META_CODE(*pptr))
{
case META_OFFSET:
pptr++;
SKIPOFFSET(pptr);
continue;
case META_CAPTURE_NAME:
ng = cb->named_groups + pptr[1];
PCRE2_ASSERT((ng->hash_dup & NAMED_GROUP_IS_DUPNAME) != 0);
pptr += 2;
name = ng->name;
all_found = TRUE;
do
{
if (ng->name != name) continue;
capture_ptr = captures + (ng->number >> 3);
PCRE2_ASSERT(capture_ptr < captures + size);
bit = (uint8_t)(1 << (ng->number & 0x7));
if ((*capture_ptr & bit) == 0)
{
*capture_ptr |= bit;
all_found = FALSE;
}
}
while (++ng < end);
if (!all_found)
{
*lengthptr += 1 + 2 * IMM2_SIZE;
continue;
}
pptr[-2] = META_CAPTURE_NUMBER;
pptr[-1] = 0;
continue;
case META_CAPTURE_NUMBER:
pptr += 2;
capture_ptr = captures + (pptr[-1] >> 3);
PCRE2_ASSERT(capture_ptr < captures + size);
bit = (uint8_t)(1 << (pptr[-1] & 0x7));
if ((*capture_ptr & bit) != 0)
{
pptr[-1] = 0;
continue;
}
*capture_ptr |= bit;
*lengthptr += 1 + IMM2_SIZE;
continue;
default:
break;
}
break;
}
cb->cx->memctl.free(captures, cb->cx->memctl.memory_data);
return pptr - 1;
}
/* Implement heapsort heapify algorithm. */
static void do_heapify_u16(uint16_t *captures, size_t size, size_t i)
{
size_t max;
size_t left;
size_t right;
uint16_t tmp;
while (TRUE)
{
max = i;
left = (i << 1) + 1;
right = left + 1;
if (left < size && captures[left] > captures[max]) max = left;
if (right < size && captures[right] > captures[max]) max = right;
if (i == max) return;
tmp = captures[i];
captures[i] = captures[max];
captures[max] = tmp;
i = max;
}
}
/*************************************************
* Parse the arguments of recurse operations *
*************************************************/
/* This function parses the arguments of recurse operations.
Arguments:
pptr_start the current parsed pattern pointer
offset argument starting offset in the pattern
errorcodeptr where to put an error code
cb the compile block
lengthptr NULL during the real compile phase
points to length accumulator during pre-compile phase
Returns: TRUE if OK, FALSE if not, error code set
*/
BOOL
PRIV(compile_parse_recurse_args)(uint32_t *pptr_start,
PCRE2_SIZE offset, int *errorcodeptr, compile_block *cb)
{
uint32_t *pptr = pptr_start;
size_t i, size;
PCRE2_SPTR name;
named_group *ng;
named_group *end = cb->named_groups + cb->names_found;
recurse_arguments *args;
uint16_t *captures;
uint16_t *current;
uint16_t *captures_end;
uint16_t tmp;
/* Process all arguments, compute the required size. */
size = PRIV(compile_process_capture_list)(pptr, offset, errorcodeptr, cb);
if (size == 0) return FALSE;
args = cb->cx->memctl.malloc(
sizeof(recurse_arguments) + size * sizeof(uint16_t), cb->cx->memctl.memory_data);
if (args == NULL)
{
*errorcodeptr = ERR21;
cb->erroroffset = offset;
return FALSE;
}
args->header.next = NULL;
#ifdef PCRE2_DEBUG
args->header.type = CDATA_RECURSE_ARGS;
#endif
args->size = size;
/* Caching the pre-processed capture list. */
if (cb->last_data != NULL)
cb->last_data->next = &args->header;
else
cb->first_data = &args->header;
cb->last_data = &args->header;
/* Create the capture list size. */
captures = (uint16_t*)(args + 1);
while (TRUE)
{
++pptr;
switch (META_CODE(*pptr))
{
case META_OFFSET:
SKIPOFFSET(pptr);
continue;
case META_CAPTURE_NAME:
ng = cb->named_groups + *(++pptr);
PCRE2_ASSERT((ng->hash_dup & NAMED_GROUP_IS_DUPNAME) != 0);
*captures++ = (uint16_t)(ng->number);
name = ng->name;
while (++ng < end)
if (ng->name == name) *captures++ = (uint16_t)(ng->number);
continue;
case META_CAPTURE_NUMBER:
*captures++ = *(++pptr);
continue;
default:
break;
}
break;
}
PCRE2_ASSERT(size == (size_t)(captures - (uint16_t*)(args + 1)));
args->skip_size = (size_t)(pptr - pptr_start) - 1;
if (size == 1) return TRUE;
/* Sort captures. */
captures = (uint16_t*)(args + 1);
i = (size >> 1) - 1;
while (TRUE)
{
do_heapify_u16(captures, size, i);
if (i == 0) break;
i--;
}
for (i = size - 1; i > 0; i--)
{
tmp = captures[0];
captures[0] = captures[i];
captures[i] = tmp;
do_heapify_u16(captures, i, 0);
}
/* Remove duplicates. */
captures_end = captures + size;
tmp = *captures++;
current = captures;
while (current < captures_end)
{
if (*current != tmp)
{
tmp = *current;
*captures++ = tmp;
}
current++;
}
args->size = (size_t)(captures - (uint16_t*)(args + 1));
return TRUE;
}
/* End of pcre2_compile_cgroup.c */

View file

@ -38,12 +38,11 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_compile.h"
typedef struct {
/* Option bits for eclass. */
uint32_t options;
@ -66,7 +65,7 @@ b) none of the cases here:
#define CLASS_END_CASES(meta) \
default: \
PCRE2_ASSERT((meta) <= META_END); \
/* Fall through */ \
PCRE2_FALLTHROUGH /* Fall through */ \
case META_CLASS: \
case META_CLASS_NOT: \
case META_CLASS_EMPTY: \
@ -525,6 +524,9 @@ if (xoptions & PCRE2_EXTRA_CASELESS_RESTRICT)
if (xoptions & PCRE2_EXTRA_TURKISH_CASING)
class_options |= PARSE_CLASS_TURKISH_UTF;
#else
(void)options; /* Avoid compiler warning. */
(void)xoptions; /* Avoid compiler warning. */
#endif
/* Compute required space for the range. */
@ -543,7 +545,10 @@ cranges = cb->cx->memctl.malloc(
if (cranges == NULL) return NULL;
cranges->next = NULL;
cranges->header.next = NULL;
#ifdef PCRE2_DEBUG
cranges->header.type = CDATA_CRANGE;
#endif
cranges->range_list_size = (uint16_t)range_list_size;
cranges->char_lists_types = 0;
cranges->char_lists_size = 0;
@ -905,6 +910,10 @@ uint8_t *classbits = cb->classbits.classbits;
uint32_t c, byte_start, byte_end;
uint32_t classbits_end = (end <= 0xff ? end : 0xff);
#ifndef SUPPORT_UNICODE
(void)xoptions; /* Avoid compiler warning. */
#endif
/* If caseless matching is required, scan the range and process alternate
cases. In Unicode, there are 8-bit characters that have alternate cases that
are greater than 255 and vice-versa (though these may be ignored if caseless
@ -1080,6 +1089,10 @@ BOOL utf = FALSE;
uint32_t xclass_props;
PCRE2_UCHAR *class_uchardata;
class_ranges* cranges;
#else
(void)has_bitmap; /* Avoid compiler warning. */
(void)errorcodeptr; /* Avoid compiler warning. */
(void)lengthptr; /* Avoid compiler warning. */
#endif
/* If an XClass contains a negative special such as \S, we need to flip the
@ -1112,19 +1125,19 @@ if (utf)
}
/* Caching the pre-processed character ranges. */
if (cb->next_cranges != NULL)
cb->next_cranges->next = cranges;
if (cb->last_data != NULL)
cb->last_data->next = &cranges->header;
else
cb->cranges = cranges;
cb->first_data = &cranges->header;
cb->next_cranges = cranges;
cb->last_data = &cranges->header;
}
else
{
/* Reuse the pre-processed character ranges. */
cranges = cb->cranges;
PCRE2_ASSERT(cranges != NULL);
cb->cranges = cranges->next;
cranges = (class_ranges*)cb->first_data;
PCRE2_ASSERT(cranges != NULL && cranges->header.type == CDATA_CRANGE);
cb->first_data = cranges->header.next;
}
if (cranges->range_list_size > 0)
@ -1270,8 +1283,23 @@ while (TRUE)
value of 1 removes vertical space and 2 removes underscore. */
if (tabopt < 0) tabopt = -tabopt;
#ifdef EBCDIC
{
uint8_t posix_vertical[4] = { CHAR_LF, CHAR_VT, CHAR_FF, CHAR_CR };
uint8_t posix_underscore = CHAR_UNDERSCORE;
uint8_t *chars = NULL;
int n = 0;
if (tabopt == 1) { chars = posix_vertical; n = 4; }
else if (tabopt == 2) { chars = &posix_underscore; n = 1; }
for (; n > 0; ++chars, --n)
pbits.classbits[*chars/8] &= ~(1u << (*chars&7));
}
#else
if (tabopt == 1) pbits.classbits[1] &= ~0x3c;
else if (tabopt == 2) pbits.classbits[11] &= 0x7f;
else if (tabopt == 2) pbits.classbits[11] &= 0x7f;
#endif
/* Add the POSIX table or its complement into the main table that is
being built and we are done. */
@ -2079,9 +2107,11 @@ switch (op)
lhs_op_info->bits.classwords[i] ^= rhs_op_info->bits.classwords[i];
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
break;
/* LCOV_EXCL_STOP */
}
}
@ -2141,7 +2171,7 @@ switch (meta)
}
ptr++;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
default:
/* Scan forward characters, ranges, and properties.
@ -2158,11 +2188,13 @@ switch (meta)
/* We must have a 100% guarantee that ptr increases when
compile_class_operand() returns, even on Release builds, so that we can
statically prove our loops terminate. */
/* LCOV_EXCL_START */
if (ptr <= prev_ptr)
{
PCRE2_DEBUG_UNREACHABLE();
return FALSE;
}
/* LCOV_EXCL_STOP */
/* If we fell through above, consume the closing ']'. */
if (meta == META_CLASS || meta == META_CLASS_NOT)

View file

@ -38,18 +38,11 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Save the configured link size, which is in bytes. In 16-bit and 32-bit modes
its value gets changed by pcre2_intmodedep.h (included by pcre2_internal.h) to
be in code units. */
static int configured_link_size = LINK_SIZE;
#include "pcre2_internal.h"
/* These macros are the standard way of turning unquoted text into C strings.
They allow macros like PCRE2_MAJOR to be defined without quotes, which is
convenient for user programs that want to test their values. */
@ -79,7 +72,7 @@ pcre2_config(uint32_t what, void *where)
{
if (where == NULL) /* Requests a length */
{
switch(what)
switch (what)
{
default:
return PCRE2_ERROR_BADOPTION;
@ -87,6 +80,7 @@ if (where == NULL) /* Requests a length */
case PCRE2_CONFIG_BSR:
case PCRE2_CONFIG_COMPILED_WIDTHS:
case PCRE2_CONFIG_DEPTHLIMIT:
case PCRE2_CONFIG_EFFECTIVE_LINKSIZE:
case PCRE2_CONFIG_HEAPLIMIT:
case PCRE2_CONFIG_JIT:
case PCRE2_CONFIG_LINKSIZE:
@ -124,13 +118,13 @@ switch (what)
case PCRE2_CONFIG_COMPILED_WIDTHS:
*((uint32_t *)where) = 0
#ifdef SUPPORT_PCRE2_8
+ 1
+ (1 << 0)
#endif
#ifdef SUPPORT_PCRE2_16
+ 2
+ (1 << 1)
#endif
#ifdef SUPPORT_PCRE2_32
+ 4
+ (1 << 2)
#endif
;
break;
@ -139,6 +133,10 @@ switch (what)
*((uint32_t *)where) = MATCH_LIMIT_DEPTH;
break;
case PCRE2_CONFIG_EFFECTIVE_LINKSIZE:
*((uint32_t *)where) = LINK_SIZE * sizeof(PCRE2_UCHAR);
break;
case PCRE2_CONFIG_HEAPLIMIT:
*((uint32_t *)where) = HEAP_LIMIT;
break;
@ -163,7 +161,7 @@ switch (what)
#endif
case PCRE2_CONFIG_LINKSIZE:
*((uint32_t *)where) = (uint32_t)configured_link_size;
*((uint32_t *)where) = (uint32_t)CONFIGURED_LINK_SIZE;
break;
case PCRE2_CONFIG_MATCHLIMIT:
@ -206,8 +204,7 @@ switch (what)
#endif
return (int)(1 + ((where == NULL)?
strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
}
break;
}
case PCRE2_CONFIG_UNICODE:
#if defined SUPPORT_UNICODE
@ -244,6 +241,7 @@ switch (what)
return (int)(1 + ((where == NULL)?
strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v)));
}
}
return 0;

View file

@ -39,10 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
@ -506,10 +502,7 @@ return 0;
}
/* These functions became obsolete at release 10.30. The first is kept as a
synonym for backwards compatibility. The second now does nothing. Exclude both
from coverage reports. */
/* LCOV_EXCL_START */
synonym for backwards compatibility. The second now does nothing. */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_recursion_limit(pcre2_match_context *mcontext, uint32_t limit)
@ -529,8 +522,6 @@ pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
return 0;
}
/* LCOV_EXCL_STOP */
/* ------------ Convert context ------------ */
@ -543,10 +534,20 @@ ccontext->glob_separator = separator;
return 0;
}
static const char *globpunct =
STR_EXCLAMATION_MARK STR_QUOTATION_MARK STR_NUMBER_SIGN STR_DOLLAR_SIGN
STR_PERCENT_SIGN STR_AMPERSAND STR_APOSTROPHE STR_LEFT_PARENTHESIS
STR_RIGHT_PARENTHESIS STR_ASTERISK STR_PLUS STR_COMMA STR_MINUS STR_DOT
STR_SLASH STR_COLON STR_SEMICOLON STR_LESS_THAN_SIGN STR_EQUALS_SIGN
STR_GREATER_THAN_SIGN STR_QUESTION_MARK STR_COMMERCIAL_AT
STR_LEFT_SQUARE_BRACKET STR_BACKSLASH STR_RIGHT_SQUARE_BRACKET
STR_CIRCUMFLEX_ACCENT STR_UNDERSCORE STR_GRAVE_ACCENT STR_LEFT_CURLY_BRACKET
STR_VERTICAL_LINE STR_RIGHT_CURLY_BRACKET STR_TILDE;
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_glob_escape(pcre2_convert_context *ccontext, uint32_t escape)
{
if (escape > 255 || (escape != 0 && !ispunct(escape)))
if (escape > 255 || (escape != 0 && strchr(globpunct, escape) == NULL))
return PCRE2_ERROR_BADDATA;
ccontext->glob_escape = escape;
return 0;

View file

@ -39,12 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#define TYPE_OPTIONS (PCRE2_CONVERT_GLOB| \
PCRE2_CONVERT_POSIX_BASIC|PCRE2_CONVERT_POSIX_EXTENDED)
@ -81,6 +79,16 @@ enum { POSIX_START_REGEX, POSIX_ANCHORED, POSIX_NOT_BRACKET,
} \
}
/* Macro to check for lowercase characters. */
#ifdef EBCDIC
#define ISLOWER(c) (((c) >= CHAR_a && (c) <= CHAR_i) || \
((c) >= CHAR_j && (c) <= CHAR_r) || \
((c) >= CHAR_s && (c) <= CHAR_z))
#else
#define ISLOWER(c) ((c) >= CHAR_a && (c) <= CHAR_z)
#endif
/* Literals that must be escaped: \ ? * + | . ^ $ { } [ ] ( ) */
static const char *pcre2_escaped_literals =
@ -97,6 +105,24 @@ static const char *posix_meta_escapes =
STR_LEFT_CURLY_BRACKET STR_RIGHT_CURLY_BRACKET
STR_1 STR_2 STR_3 STR_4 STR_5 STR_6 STR_7 STR_8 STR_9;
/* Recognized POSIX classes, colon-separated. */
static const char *posix_classes =
STR_a STR_l STR_p STR_h STR_a STR_COLON
STR_l STR_o STR_w STR_e STR_r STR_COLON
STR_u STR_p STR_p STR_e STR_r STR_COLON
STR_a STR_l STR_n STR_u STR_m STR_COLON
STR_a STR_s STR_c STR_i STR_i STR_COLON
STR_b STR_l STR_a STR_n STR_k STR_COLON
STR_c STR_n STR_t STR_r STR_l STR_COLON
STR_d STR_i STR_g STR_i STR_t STR_COLON
STR_g STR_r STR_a STR_p STR_h STR_COLON
STR_p STR_r STR_i STR_n STR_t STR_COLON
STR_p STR_u STR_n STR_c STR_t STR_COLON
STR_s STR_p STR_a STR_c STR_e STR_COLON
STR_w STR_o STR_r STR_d STR_COLON
STR_x STR_d STR_i STR_g STR_i STR_t STR_COLON;
/*************************************************
@ -190,7 +216,7 @@ while (plength > 0)
switch (posix_state)
{
case POSIX_CLASS_STARTED:
if (c <= 127 && islower(c)) break; /* Remain in started state */
if (ISLOWER(c)) break; /* Remain in started state */
posix_state = POSIX_CLASS_NOT_STARTED;
if (c == CHAR_COLON && plength > 0 &&
*posix == CHAR_RIGHT_SQUARE_BRACKET)
@ -200,7 +226,7 @@ while (plength > 0)
posix++;
continue; /* With next character after :] */
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case POSIX_CLASS_NOT_STARTED:
if (c == CHAR_LEFT_SQUARE_BRACKET)
@ -277,9 +303,9 @@ while (plength > 0)
if (plength == 0) return PCRE2_ERROR_END_BACKSLASH;
if (extended) nextisliteral = TRUE; else
{
if (*posix < 127 && strchr(posix_meta_escapes, *posix) != NULL)
if (*posix < 255 && strchr(posix_meta_escapes, *posix) != NULL)
{
if (isdigit(*posix)) PUTCHARS(STR_BACKSLASH);
if (*posix >= CHAR_0 && *posix <= CHAR_9) PUTCHARS(STR_BACKSLASH);
if (p + 1 > endp) return PCRE2_ERROR_NOMEMORY;
lastspecial = *p++ = *posix++;
plength--;
@ -295,7 +321,7 @@ while (plength > 0)
case CHAR_LEFT_PARENTHESIS:
bracount++;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case CHAR_QUESTION_MARK:
case CHAR_PLUS:
@ -303,7 +329,7 @@ while (plength > 0)
case CHAR_RIGHT_CURLY_BRACKET:
case CHAR_VERTICAL_LINE:
if (!extended) goto ESCAPE_LITERAL;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case CHAR_DOT:
case CHAR_DOLLAR_SIGN:
@ -332,10 +358,10 @@ while (plength > 0)
posix_state = POSIX_ANCHORED;
goto COPY_SPECIAL;
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
default:
if (c < 128 && strchr(pcre2_escaped_literals, c) != NULL)
if (c < 255 && strchr(pcre2_escaped_literals, c) != NULL)
{
ESCAPE_LITERAL:
PUTCHARS(STR_BACKSLASH);
@ -474,8 +500,6 @@ static int
convert_glob_parse_class(PCRE2_SPTR *from, PCRE2_SPTR pattern_end,
pcre2_output_context *out)
{
static const char *posix_classes = "alnum:alpha:ascii:blank:cntrl:digit:"
"graph:lower:print:punct:space:upper:word:xdigit:";
PCRE2_SPTR start = *from + 1;
PCRE2_SPTR pattern = start;
const char *class_ptr;
@ -500,7 +524,7 @@ class_index = 1;
while (TRUE)
{
if (*class_ptr == CHAR_NUL) return 0;
if (*class_ptr == 0) return 0;
pattern = start;
@ -539,31 +563,61 @@ Returns: !0 => character is found in the class
static BOOL
convert_glob_char_in_class(int class_index, PCRE2_UCHAR c)
{
const uint8_t *cbits = PRIV(default_tables) + cbits_offset;
int cbit;
#if PCRE2_CODE_UNIT_WIDTH != 8
if (c > 0xff)
{
/* ctype functions are not sane for c > 0xff */
return 0;
/* Can't access the character tables for c > 0xff */
return FALSE;
}
#endif
/* See posix_class_maps. This is a small local clone of that.
Note that we don't know exactly what character tables will be used at
match time, but, for the purposes of pattern conversion, it should be
sufficient to use PCRE2's built-in default tables. */
switch (class_index)
{
case 1: return isalnum(c);
case 2: return isalpha(c);
case 3: return 1;
case 4: return c == CHAR_HT || c == CHAR_SPACE;
case 5: return iscntrl(c);
case 6: return isdigit(c);
case 7: return isgraph(c);
case 8: return islower(c);
case 9: return isprint(c);
case 10: return ispunct(c);
case 11: return isspace(c);
case 12: return isupper(c);
case 13: return isalnum(c) || c == CHAR_UNDERSCORE;
default: return isxdigit(c);
case 1: /* alpha */
if (c == CHAR_UNDERSCORE) return FALSE;
if (((cbits + cbit_digit)[c/8] & (1u << (c&7))) != 0) return FALSE;
cbit = cbit_word;
break;
case 2: cbit = cbit_lower; break; /* lower */
case 3: cbit = cbit_upper; break; /* upper */
case 4: /* alnum */
if (c == CHAR_UNDERSCORE) return FALSE;
cbit = cbit_word;
break;
case 5: /* ascii */
if (((cbits + cbit_cntrl)[c/8] & (1u << (c&7))) != 0) return TRUE;
cbit = cbit_print;
break;
case 6: /* blank */
if (c == CHAR_LF || c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
return FALSE;
cbit = cbit_space;
break;
case 7: cbit = cbit_cntrl; break; /* cntrl */
case 8: cbit = cbit_digit; break; /* digit */
case 9: cbit = cbit_graph; break; /* graph */
case 10: cbit = cbit_print; break; /* print */
case 11: cbit = cbit_punct; break; /* punct */
case 12: cbit = cbit_space; break; /* space */
case 13: cbit = cbit_word; break; /* word */
case 14: cbit = cbit_xdigit; break; /* xdigit */
default: return FALSE;
}
return ((cbits + cbit)[c/8] & (1u << (c&7))) != 0;
}
/* Parse a range of characters.
@ -1005,7 +1059,7 @@ while (pattern < pattern_end)
c = *pattern++;
}
if (c < 128 && strchr(pcre2_escaped_literals, c) != NULL)
if (c < 255 && strchr(pcre2_escaped_literals, c) != NULL)
convert_glob_write(&out, CHAR_BACKSLASH);
convert_glob_write(&out, c);
@ -1065,13 +1119,21 @@ pcre2_pattern_convert(PCRE2_SPTR pattern, PCRE2_SIZE plength, uint32_t options,
pcre2_convert_context *ccontext)
{
int rc;
PCRE2_UCHAR null_str[1] = { 0xcd };
PCRE2_UCHAR dummy_buffer[DUMMY_BUFFER_SIZE];
PCRE2_UCHAR *use_buffer = dummy_buffer;
PCRE2_SIZE use_length = DUMMY_BUFFER_SIZE;
BOOL utf = (options & PCRE2_CONVERT_UTF) != 0;
uint32_t pattype = options & TYPE_OPTIONS;
if (pattern == NULL || bufflenptr == NULL) return PCRE2_ERROR_NULL;
if (pattern == NULL && plength == 0)
pattern = null_str;
if (pattern == NULL || bufflenptr == NULL)
{
if (bufflenptr != NULL) *bufflenptr = 0; /* Error offset */
return PCRE2_ERROR_NULL;
}
if ((options & ~ALL_OPTIONS) != 0 || /* Undefined bit set */
(pattype & (~pattype+1)) != pattype || /* More than one type set */
@ -1136,8 +1198,13 @@ for (int i = 0; i < 2; i++)
bufflenptr, dummyrun, ccontext);
break;
/* We have already validated pattype. */
/* LCOV_EXCL_START */
default:
goto EXIT;
PCRE2_DEBUG_UNREACHABLE();
*bufflenptr = 0; /* Error offset */
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
if (rc != 0 || /* Error */
@ -1150,20 +1217,23 @@ for (int i = 0; i < 2; i++)
allocated = PRIV(memctl_malloc)(sizeof(pcre2_memctl) +
(*bufflenptr + 1)*PCRE2_CODE_UNIT_WIDTH, (pcre2_memctl *)ccontext);
if (allocated == NULL) return PCRE2_ERROR_NOMEMORY;
if (allocated == NULL)
{
*bufflenptr = 0; /* Error offset */
return PCRE2_ERROR_NOMEMORY;
}
*buffptr = (PCRE2_UCHAR *)(((char *)allocated) + sizeof(pcre2_memctl));
use_buffer = *buffptr;
use_length = *bufflenptr + 1;
}
/* Something went terribly wrong. Trigger an assert and return an error */
/* Running the loop above ought to have succeeded the second time. */
/* LCOV_EXCL_START */
PCRE2_DEBUG_UNREACHABLE();
EXIT:
*bufflenptr = 0; /* Error offset */
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}

View file

@ -72,16 +72,14 @@ Overall, I concluded that the gains in some cases did not outweigh the losses
in others, so I abandoned this code. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#define NLBLOCK mb /* Block containing newline information */
#define PSSTART start_subject /* Field containing processed string start */
#define PSEND end_subject /* Field containing processed string end */
#include "pcre2_internal.h"
#define PUBLIC_DFA_MATCH_OPTIONS \
(PCRE2_ANCHORED|PCRE2_ENDANCHORED|PCRE2_NOTBOL|PCRE2_NOTEOL|PCRE2_NOTEMPTY| \
PCRE2_NOTEMPTY_ATSTART|PCRE2_NO_UTF_CHECK|PCRE2_PARTIAL_HARD| \
@ -2330,7 +2328,7 @@ for (;;)
case 0x2029:
#endif /* Not EBCDIC */
if (mb->bsr_convention == PCRE2_BSR_ANYCRLF) break;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case CHAR_LF:
ADD_NEW(state_offset + 1, 0);
@ -2442,7 +2440,7 @@ for (;;)
caseless = TRUE;
codevalue -= OP_STARI - OP_STAR;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_PLUS:
case OP_MINPLUS:
case OP_POSPLUS:
@ -2486,7 +2484,7 @@ for (;;)
case OP_NOTPOSQUERYI:
caseless = TRUE;
codevalue -= OP_STARI - OP_STAR;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_QUERY:
case OP_MINQUERY:
case OP_POSQUERY:
@ -2527,7 +2525,7 @@ for (;;)
case OP_NOTPOSSTARI:
caseless = TRUE;
codevalue -= OP_STARI - OP_STAR;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_STAR:
case OP_MINSTAR:
case OP_POSSTAR:
@ -2564,7 +2562,7 @@ for (;;)
case OP_NOTEXACTI:
caseless = TRUE;
codevalue -= OP_STARI - OP_STAR;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_EXACT:
case OP_NOTEXACT:
count = current_state->count; /* Number already matched */
@ -2599,7 +2597,7 @@ for (;;)
case OP_NOTPOSUPTOI:
caseless = TRUE;
codevalue -= OP_STARI - OP_STAR;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_UPTO:
case OP_MINUPTO:
case OP_POSUPTO:
@ -2941,6 +2939,9 @@ for (;;)
uint32_t recno = (callpat == mb->start_code)? 0 :
GET2(callpat, 1 + LINK_SIZE);
/* Argument list has not been supported yet. */
if (code[1 + LINK_SIZE] == OP_CREF) return PCRE2_ERROR_DFA_UITEM;
if (rws->free < RWS_RSIZE + RWS_OVEC_RSIZE)
{
rc = more_workspace(&rws, RWS_OVEC_RSIZE, mb);
@ -3341,10 +3342,12 @@ pcre2_dfa_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length,
pcre2_match_context *mcontext, int *workspace, PCRE2_SIZE wscount)
{
int rc;
int was_zero_terminated = 0;
const pcre2_real_code *re = (const pcre2_real_code *)code;
uint32_t original_options = options;
PCRE2_UCHAR null_str[1] = { 0xcd };
PCRE2_SPTR original_subject = subject;
PCRE2_SPTR start_match;
PCRE2_SPTR end_subject;
PCRE2_SPTR bumpalong_limit;
@ -3386,44 +3389,46 @@ rws->free = RWS_BASE_SIZE - RWS_ANCHOR_SIZE;
/* Recognize NULL, length 0 as an empty string. */
if (subject == NULL && length == 0) subject = (PCRE2_SPTR)"";
if (subject == NULL && length == 0) subject = null_str;
/* Plausibility checks */
if ((options & ~PUBLIC_DFA_MATCH_OPTIONS) != 0) return PCRE2_ERROR_BADOPTION;
if (re == NULL || subject == NULL || workspace == NULL || match_data == NULL)
return PCRE2_ERROR_NULL;
if (match_data == NULL) return PCRE2_ERROR_NULL;
if (re == NULL || subject == NULL || workspace == NULL)
{ rc = PCRE2_ERROR_NULL; goto EXIT; }
if ((options & ~PUBLIC_DFA_MATCH_OPTIONS) != 0)
{ rc = PCRE2_ERROR_BADOPTION; goto EXIT; }
if (length == PCRE2_ZERO_TERMINATED)
{
length = PRIV(strlen)(subject);
was_zero_terminated = 1;
}
if (wscount < 20) return PCRE2_ERROR_DFA_WSSIZE;
if (start_offset > length) return PCRE2_ERROR_BADOFFSET;
if (wscount < 20) { rc = PCRE2_ERROR_DFA_WSSIZE; goto EXIT; }
if (start_offset > length) { rc = PCRE2_ERROR_BADOFFSET; goto EXIT; }
/* Partial matching and PCRE2_ENDANCHORED are currently not allowed at the same
time. */
if ((options & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) != 0 &&
((re->overall_options | options) & PCRE2_ENDANCHORED) != 0)
return PCRE2_ERROR_BADOPTION;
{ rc = PCRE2_ERROR_BADOPTION; goto EXIT; }
/* Invalid UTF support is not available for DFA matching. */
if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0)
return PCRE2_ERROR_DFA_UINVALID_UTF;
{ rc = PCRE2_ERROR_DFA_UINVALID_UTF; goto EXIT; }
/* Check that the first field in the block is the magic number. If it is not,
return with PCRE2_ERROR_BADMAGIC. */
if (re->magic_number != MAGIC_NUMBER) return PCRE2_ERROR_BADMAGIC;
if (re->magic_number != MAGIC_NUMBER)
{ rc = PCRE2_ERROR_BADMAGIC; goto EXIT; }
/* Check the code unit width. */
if ((re->flags & PCRE2_MODE_MASK) != PCRE2_CODE_UNIT_WIDTH/8)
return PCRE2_ERROR_BADMODE;
{ rc = PCRE2_ERROR_BADMODE; goto EXIT; }
/* PCRE2_NOTEMPTY and PCRE2_NOTEMPTY_ATSTART are match-time flags in the
options variable for this function. Users of PCRE2 who are not calling the
@ -3449,8 +3454,8 @@ of the workspace. */
if ((options & PCRE2_DFA_RESTART) != 0)
{
if ((workspace[0] & (-2)) != 0 || workspace[1] < 1 ||
workspace[1] > (int)((wscount - 2)/INTS_PER_STATEBLOCK))
return PCRE2_ERROR_DFA_BADRESTART;
workspace[1] > (int)((wscount - 2)/INTS_PER_STATEBLOCK))
{ rc = PCRE2_ERROR_DFA_BADRESTART; goto EXIT; }
}
/* Set some local values */
@ -3498,7 +3503,7 @@ else
if (mcontext->offset_limit != PCRE2_UNSET)
{
if ((re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0)
return PCRE2_ERROR_BADOFFSETLIMIT;
{ rc = PCRE2_ERROR_BADOFFSETLIMIT; goto EXIT; }
bumpalong_limit = subject + mcontext->offset_limit;
}
mb->callout = mcontext->callout;
@ -3565,9 +3570,12 @@ switch(re->newline_convention)
mb->nltype = NLTYPE_ANYCRLF;
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
rc = PCRE2_ERROR_INTERNAL;
goto EXIT;
/* LCOV_EXCL_STOP */
}
/* Check a UTF string for validity if required. For 8-bit and 16-bit strings,
@ -3588,7 +3596,7 @@ if (utf && (options & PCRE2_NO_UTF_CHECK) == 0)
#if PCRE2_CODE_UNIT_WIDTH != 32
unsigned int i;
if (start_match < end_subject && NOT_FIRSTCU(*start_match))
return PCRE2_ERROR_BADUTFOFFSET;
{ rc = PCRE2_ERROR_BADUTFOFFSET; goto EXIT; }
for (i = re->max_lookbehind; i > 0 && check_subject > subject; i--)
{
check_subject--;
@ -3609,12 +3617,12 @@ if (utf && (options & PCRE2_NO_UTF_CHECK) == 0)
/* Validate the relevant portion of the subject. After an error, adjust the
offset to be an absolute offset in the whole string. */
match_data->rc = PRIV(valid_utf)(check_subject,
rc = PRIV(valid_utf)(check_subject,
length - (PCRE2_SIZE)(check_subject - subject), &(match_data->startchar));
if (match_data->rc != 0)
if (rc != 0)
{
match_data->startchar += (PCRE2_SIZE)(check_subject - subject);
return match_data->rc;
goto EXIT;
}
}
#endif /* SUPPORT_UNICODE */
@ -3678,9 +3686,10 @@ if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0)
/* Fill in fields that are always returned in the match data. */
match_data->code = re;
match_data->subject = NULL; /* Default for no match */
match_data->subject = NULL; /* Default for match error */
match_data->mark = NULL;
match_data->matchedby = PCRE2_MATCHEDBY_DFA_INTERPRETER;
match_data->options = original_options;
/* Call the main matching function, looping for a non-anchored regex after a
failed match. If not restarting, perform certain optimizations at the start of
@ -4032,29 +4041,40 @@ for (;;)
if (rc != PCRE2_ERROR_NOMATCH || anchored)
{
if (rc == PCRE2_ERROR_NOMATCH) goto NOMATCH_EXIT;
if (rc == PCRE2_ERROR_PARTIAL && match_data->oveccount > 0)
{
match_data->ovector[0] = (PCRE2_SIZE)(start_match - subject);
match_data->ovector[1] = (PCRE2_SIZE)(end_subject - subject);
}
match_data->subject_length = length;
match_data->leftchar = (PCRE2_SIZE)(mb->start_used_ptr - subject);
match_data->rightchar = (PCRE2_SIZE)(mb->last_used_ptr - subject);
match_data->startchar = (PCRE2_SIZE)(start_match - subject);
match_data->rc = rc;
if (rc >= 0 &&(options & PCRE2_COPY_MATCHED_SUBJECT) != 0)
if (rc >= 0 || rc == PCRE2_ERROR_PARTIAL)
{
length = CU2BYTES(length + was_zero_terminated);
match_data->subject = match_data->memctl.malloc(length,
match_data->memctl.memory_data);
if (match_data->subject == NULL) return PCRE2_ERROR_NOMEMORY;
memcpy((void *)match_data->subject, subject, length);
match_data->subject_length = length;
match_data->start_offset = start_offset;
match_data->leftchar = (PCRE2_SIZE)(mb->start_used_ptr - subject);
match_data->rightchar = (PCRE2_SIZE)(mb->last_used_ptr - subject);
match_data->startchar = (PCRE2_SIZE)(start_match - subject);
}
if (rc >= 0 && (options & PCRE2_COPY_MATCHED_SUBJECT) != 0)
{
if (length != 0)
{
match_data->subject = match_data->memctl.malloc(CU2BYTES(length),
match_data->memctl.memory_data);
if (match_data->subject == NULL)
{ rc = PCRE2_ERROR_NOMEMORY; goto EXIT; }
memcpy((void *)match_data->subject, subject, CU2BYTES(length));
}
else
match_data->subject = NULL;
match_data->flags |= PCRE2_MD_COPIED_SUBJECT;
}
else
else if (rc >= 0 || rc == PCRE2_ERROR_PARTIAL)
{
if (rc >= 0 || rc == PCRE2_ERROR_PARTIAL) match_data->subject = subject;
match_data->subject = original_subject;
}
goto EXIT;
}
@ -4088,6 +4108,9 @@ for (;;)
} /* "Bumpalong" loop */
NOMATCH_EXIT:
match_data->subject = original_subject;
match_data->subject_length = length;
match_data->start_offset = start_offset;
rc = PCRE2_ERROR_NOMATCH;
EXIT:
@ -4098,6 +4121,7 @@ while (rws->next != NULL)
mb->memctl.free(next, mb->memctl.memory_data);
}
match_data->rc = rc;
return rc;
}

View file

@ -47,21 +47,23 @@ option can be used to select the current locale from the LC_ALL environment
variable. By default, the tables are written in source form, but if -b is
given, they are written in binary. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#define PCRE2_DFTABLES /* for pcre2_internal.h, pcre2_maketables.c */
/* For pcre2_internal.h, pcre2_maketables.c, pcre2_tables.c */
#define PCRE2_DFTABLES
/* For pcre2_tables.c */
#define PRIV(name) name
#define PCRE2_CODE_UNIT_WIDTH 0 /* Must be set, but not relevant here */
#include "pcre2_internal.h"
#include "pcre2_maketables.c"
#include "pcre2_tables.c"
static const char *classlist[] =
@ -70,6 +72,23 @@ static const char *classlist[] =
"word", "graph", "print", "punct", "cntrl"
};
static int identity(int c) { return c; }
#ifdef EBCDIC
static int ebcdic_to_unicode(int c)
{
if (c < 0 || c > 255) abort();
return ebcdic_1047_to_ascii[c];
}
static int unicode_to_ebcdic(int c)
{
if (c < 0 || c > 255) abort();
return ascii_to_ebcdic_1047[c];
}
#endif
/*************************************************
@ -83,6 +102,9 @@ usage(void)
"Usage: pcre2_dftables [options] <output file>\n"
" -b Write output in binary (default is source code)\n"
" -L Use locale from LC_ALL (default is \"C\" locale)\n"
#ifdef EBCDIC
" -E Use EBCDIC 1047 via locale C.UTF-8\n"
#endif
);
}
@ -101,6 +123,8 @@ BOOL binary = FALSE;
char *env = (char *)"C";
const uint8_t *tables;
const uint8_t *base_of_tables;
int (*charfn_to)(int) = identity;
int (*charfn_from)(int) = identity;
/* Process options */
@ -125,6 +149,24 @@ for (i = 1; i < argc; i++)
env = getenv("LC_ALL");
}
#ifdef EBCDIC
else if (strcmp(arg, "-E") == 0)
{
if (setlocale(LC_ALL, "C.UTF-8") == NULL)
{
(void)fprintf(stderr, "pcre2_dftables: setlocale() failed\n");
return 1;
}
#ifdef EBCDIC_NL25
env = "EBCDIC 1047 (NL 0x25)";
#else
env = "EBCDIC 1047 (NL 0x15)";
#endif
charfn_to = ebcdic_to_unicode;
charfn_from = unicode_to_ebcdic;
}
#endif
else if (strcmp(arg, "-b") == 0)
binary = TRUE;
@ -143,7 +185,7 @@ if (i != argc - 1)
/* Make the tables */
tables = maketables();
tables = maketables(charfn_to, charfn_from);
base_of_tables = tables;
f = fopen(argv[i], "wb");
@ -197,20 +239,7 @@ the very long string otherwise. */
"pcre2_dftables manually with the -L option to build tables using the LC_ALL\n"
"locale. */\n\n");
/* Force config.h in z/OS */
#if defined NATIVE_ZOS
(void)fprintf(f,
"/* For z/OS, config.h is forced */\n"
"#ifndef HAVE_CONFIG_H\n"
"#define HAVE_CONFIG_H 1\n"
"#endif\n\n");
#endif
(void)fprintf(f,
"#ifdef HAVE_CONFIG_H\n"
"#include \"config.h\"\n"
"#endif\n\n"
"#include \"pcre2_internal.h\"\n\n");
(void)fprintf(f,

View file

@ -39,12 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#define STRING(a) # a
#define XSTRING(s) STRING(s)
@ -97,7 +95,7 @@ static const unsigned char compile_error_texts[] =
"a relative value of zero is not allowed\0"
"conditional subpattern contains more than two branches\0"
"atomic assertion expected after (?( or (?(?C)\0"
"digit expected after (?+ or (?-\0"
"digit expected after (?+\0"
/* 30 */
"unknown POSIX class name\0"
"internal error in pcre2_study(): should not occur\0"
@ -148,7 +146,7 @@ static const unsigned char compile_error_texts[] =
#ifndef EBCDIC
"\\c must be followed by a printable ASCII character\0"
#else
"\\c must be followed by a letter or one of [\\]^_?\0"
"\\c must be followed by a letter or one of @[\\]^_?\0"
#endif
"\\k is not followed by a braced, angle-bracketed, or quoted name\0"
/* 70 */
@ -208,6 +206,11 @@ static const unsigned char compile_error_texts[] =
/* 115 */
"terminating ] with no following closing parenthesis in (?[...]\0"
"unexpected character in (?[...]) extended character class\0"
"expected capture group number or name\0"
"missing opening parenthesis\0"
"syntax error in subpattern number (missing terminator?)\0"
/* 120 */
"erroroffset passed as NULL\0"
;
/* Match-time and UTF error texts are in the same format. */
@ -291,13 +294,18 @@ static const unsigned char match_error_texts[] =
"heap limit exceeded\0"
"invalid syntax\0"
/* 65 */
"internal error - duplicate substitution match\0"
"internal error: duplicate substitution match\0"
"PCRE2_MATCH_INVALID_UTF is not supported for DFA matching\0"
"INTERNAL ERROR: invalid substring offset\0"
"internal error: invalid substring offset\0"
"feature is not supported by the JIT compiler\0"
"error performing replacement case transformation\0"
/* 70 */
"replacement too large (longer than PCRE2_SIZE)\0"
"substitute pattern differs from prior match call\0"
"substitute subject differs from prior match call\0"
"substitute start offset differs from prior match call\0"
"substitute options differ from prior match call\0"
"disallowed use of \\K in lookaround\0"
;
@ -324,7 +332,7 @@ pcre2_get_error_message(int enumber, PCRE2_UCHAR *buffer, PCRE2_SIZE size)
{
const unsigned char *message;
PCRE2_SIZE i;
int n;
int n, rc = 0;
if (size == 0) return PCRE2_ERROR_NOMEMORY;
@ -346,7 +354,7 @@ else /* Invalid error number */
for (; n > 0; n--)
{
while (*message++ != CHAR_NUL) {};
while (*message++ != CHAR_NUL) {}
if (*message == CHAR_NUL) return PCRE2_ERROR_BADDATA;
}
@ -354,14 +362,23 @@ for (i = 0; *message != 0; i++)
{
if (i >= size - 1)
{
buffer[i] = 0; /* Terminate partial message */
return PCRE2_ERROR_NOMEMORY;
rc = PCRE2_ERROR_NOMEMORY;
break;
}
buffer[i] = *message++;
}
buffer[i] = 0;
return (int)i;
#if defined EBCDIC && 'a' != 0x81
/* If compiling for EBCDIC, but the compiler's string literals are not EBCDIC,
then we are in the "force EBCDIC 1047" mode. I have chosen to add a few lines
here to translate the error strings on the fly, rather than require the string
literals above to be written out arduously using the "STR_XYZ" macros. */
for (PCRE2_SIZE j = 0; j < i; ++j)
buffer[j] = PRIV(ascii_to_ebcdic_1047)[buffer[j]];
#endif
buffer[i] = 0; /* Terminate message, even if truncated. */
return rc? rc : (int)i;
}
/* End of pcre2_error.c */

View file

@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains an internal function that is used to match a Unicode
extended grapheme sequence. It is used by both pcre2_match() and
pcre2_dfa_match(). However, it is called only when Unicode support is being
@ -45,14 +46,10 @@ compiled. Nevertheless, we provide a dummy function when there is no Unicode
support, because some compilers do not like functionless source files. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/* Dummy function */
#ifndef SUPPORT_UNICODE

View file

@ -46,13 +46,10 @@ function is called from pcre2_compile.c and also from pcre2_study.c when
finding the minimum matching length. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/*************************************************
* Scan compiled regex for specific bracket *
*************************************************/

View file

@ -41,6 +41,15 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef PCRE2_INTERNAL_H_IDEMPOTENT_GUARD
#define PCRE2_INTERNAL_H_IDEMPOTENT_GUARD
/* We do not assume that the config.h file has an idempotent include guard,
since it may well be written by clients. The standard Autoheader config.h does
not have an include guard (although we could customise that). */
#if defined HAVE_CONFIG_H && !defined PCRE2_CONFIG_H_IDEMPOTENT_GUARD
#define PCRE2_CONFIG_H_IDEMPOTENT_GUARD
#include "config.h"
#endif
/* We do not support both EBCDIC and Unicode at the same time. The "configure"
script prevents both being selected, but not everybody uses "configure". EBCDIC
is only supported for the 8-bit library, but the check for this has to be later
@ -59,13 +68,12 @@ be including this file. There is no explicit way of forcing a compile to be
abandoned, but trying to include a non-existent file seems cleanest. Otherwise
there will be many irrelevant consequential errors. */
#if (!defined PCRE2_BUILDING_PCRE2TEST && !defined PCRE2_DFTABLES) && \
#if (!defined PCRE2_PCRE2TEST && !defined PCRE2_DFTABLES) && \
(!defined PCRE2_CODE_UNIT_WIDTH || \
(PCRE2_CODE_UNIT_WIDTH != 8 && \
PCRE2_CODE_UNIT_WIDTH != 16 && \
PCRE2_CODE_UNIT_WIDTH != 32))
#error PCRE2_CODE_UNIT_WIDTH must be defined as 8, 16, or 32.
#include <AbandonCompile>
#endif
@ -120,13 +128,12 @@ MSVC 10/2010. Except for VC6 (which is missing some fundamentals and fails). */
#endif
/* When compiling a DLL for Windows, the exported symbols have to be declared
using some MS magic. I found some useful information on this web page:
http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the
information there, using __declspec(dllexport) without "extern" we have a
definition; with "extern" we have a declaration. The settings here override the
setting in pcre2.h (which is included below); it defines only PCRE2_EXP_DECL,
which is all that is needed for applications (they just import the symbols). We
use:
using some MS magic, as documented here:
https://learn.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-declspec-dllexport
In pcre2.h (which is included below), we define only PCRE2_EXP_DECL,
which is all that is needed for applications (they just import the symbols). To
compile the library, we use:
PCRE2_EXP_DECL for declarations
PCRE2_EXP_DEFN for definitions
@ -140,24 +147,23 @@ special-purpose environments) might want to stick other stuff in front of
exported symbols. That's why, in the non-Windows case, we set PCRE2_EXP_DEFN
only if it is not already set. */
#if defined __cplusplus
#error This project uses C99. C++ is not supported.
#endif
#ifndef PCRE2_EXP_DECL
# ifdef _WIN32
# ifndef PCRE2_STATIC
# define PCRE2_EXP_DECL extern __declspec(dllexport)
# define PCRE2_EXP_DEFN __declspec(dllexport)
# else
# define PCRE2_EXP_DECL extern PCRE2_EXPORT
# define PCRE2_EXP_DEFN
# endif
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DECL extern __declspec(dllexport)
# else
# ifdef __cplusplus
# define PCRE2_EXP_DECL extern "C" PCRE2_EXPORT
# else
# define PCRE2_EXP_DECL extern PCRE2_EXPORT
# endif
# ifndef PCRE2_EXP_DEFN
# define PCRE2_EXP_DEFN PCRE2_EXP_DECL
# endif
# define PCRE2_EXP_DECL extern PCRE2_EXPORT
# endif
#endif
#ifndef PCRE2_EXP_DEFN
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DEFN extern __declspec(dllexport)
# else
# define PCRE2_EXP_DEFN extern PCRE2_EXPORT
# endif
#endif
@ -167,19 +173,6 @@ property values. This must follow the setting of PCRE2_EXP_DECL above. */
#include "pcre2.h"
#include "pcre2_ucp.h"
/* When PCRE2 is compiled as a C++ library, the subject pointer can be replaced
with a custom type. This makes it possible, for example, to allow pcre2_match()
to process subject strings that are discontinuous by using a smart pointer
class. It must always be possible to inspect all of the subject string in
pcre2_match() because of the way it backtracks. */
/* WARNING: This is as yet untested for PCRE2. */
#ifdef CUSTOM_SUBJECT_PTR
#undef PCRE2_SPTR
#define PCRE2_SPTR CUSTOM_SUBJECT_PTR
#endif
/* When checking for integer overflow, we need to handle large integers.
If a 64-bit integer type is available, we can use that.
Otherwise we have to cast to double, which of course requires floating point
@ -201,28 +194,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. */
@ -406,7 +377,7 @@ PCRE (both APIs) for a long time. */
#define HSPACE_LIST \
CHAR_HT, CHAR_SPACE, CHAR_NBSP, \
0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, \
0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202f, 0x205f, 0x3000, \
0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f, 0x205f, 0x3000, \
NOTACHAR
#define HSPACE_MULTIBYTE_CASES \
@ -422,7 +393,7 @@ PCRE (both APIs) for a long time. */
case 0x2007: /* FIGURE SPACE */ \
case 0x2008: /* PUNCTUATION SPACE */ \
case 0x2009: /* THIN SPACE */ \
case 0x200A: /* HAIR SPACE */ \
case 0x200a: /* HAIR SPACE */ \
case 0x202f: /* NARROW NO-BREAK SPACE */ \
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */ \
case 0x3000 /* IDEOGRAPHIC SPACE */
@ -552,6 +523,7 @@ bytes in a code unit in that mode. */
#define PCRE2_DUPCAPUSED 0x00200000u /* contains (?| */
#define PCRE2_HASBKC 0x00400000u /* contains \C */
#define PCRE2_HASACCEPT 0x00800000u /* contains (*ACCEPT) */
#define PCRE2_HASBSK 0x01000000u /* contains \K */
#define PCRE2_MODE_MASK (PCRE2_MODE8 | PCRE2_MODE16 | PCRE2_MODE32)
@ -698,6 +670,10 @@ same code point. */
compatibility. NEL is the Unicode newline character; make sure it is
a positive value. */
#if '\n' != 0x0a
#error "ASCII character '\n' is not 0x0a"
#endif
#define CHAR_LF '\n'
#define CHAR_NL CHAR_LF
#define CHAR_NEL ((unsigned char)'\x85')
@ -713,7 +689,232 @@ a positive value. */
#endif /* EBCDIC */
/* The remaining definitions work in both environments. */
/* When we want to use EBCDIC with an ASCII compiler, for testing EBCDIC on
ASCII platforms, then we can hardcode an EBCDIC codepage (IBM-1047). */
#ifdef EBCDIC_IGNORING_COMPILER
#define CHAR_NUL '\000'
#define CHAR_HT '\005'
#define CHAR_VT '\013'
#define CHAR_FF '\014'
#define CHAR_CR '\015'
#define CHAR_BS '\026'
#define CHAR_BEL '\057'
#define CHAR_SPACE '\100'
#define CHAR_EXCLAMATION_MARK '\132'
#define CHAR_QUOTATION_MARK '\177'
#define CHAR_NUMBER_SIGN '\173'
#define CHAR_DOLLAR_SIGN '\133'
#define CHAR_PERCENT_SIGN '\154'
#define CHAR_AMPERSAND '\120'
#define CHAR_APOSTROPHE '\175'
#define CHAR_LEFT_PARENTHESIS '\115'
#define CHAR_RIGHT_PARENTHESIS '\135'
#define CHAR_ASTERISK '\134'
#define CHAR_PLUS '\116'
#define CHAR_COMMA '\153'
#define CHAR_MINUS '\140'
#define CHAR_DOT '\113'
#define CHAR_SLASH '\141'
#define CHAR_0 ((unsigned char)'\xf0')
#define CHAR_1 ((unsigned char)'\xf1')
#define CHAR_2 ((unsigned char)'\xf2')
#define CHAR_3 ((unsigned char)'\xf3')
#define CHAR_4 ((unsigned char)'\xf4')
#define CHAR_5 ((unsigned char)'\xf5')
#define CHAR_6 ((unsigned char)'\xf6')
#define CHAR_7 ((unsigned char)'\xf7')
#define CHAR_8 ((unsigned char)'\xf8')
#define CHAR_9 ((unsigned char)'\xf9')
#define CHAR_COLON '\172'
#define CHAR_SEMICOLON '\136'
#define CHAR_LESS_THAN_SIGN '\114'
#define CHAR_EQUALS_SIGN '\176'
#define CHAR_GREATER_THAN_SIGN '\156'
#define CHAR_QUESTION_MARK '\157'
#define CHAR_COMMERCIAL_AT '\174'
#define CHAR_A ((unsigned char)'\xc1')
#define CHAR_B ((unsigned char)'\xc2')
#define CHAR_C ((unsigned char)'\xc3')
#define CHAR_D ((unsigned char)'\xc4')
#define CHAR_E ((unsigned char)'\xc5')
#define CHAR_F ((unsigned char)'\xc6')
#define CHAR_G ((unsigned char)'\xc7')
#define CHAR_H ((unsigned char)'\xc8')
#define CHAR_I ((unsigned char)'\xc9')
#define CHAR_J ((unsigned char)'\xd1')
#define CHAR_K ((unsigned char)'\xd2')
#define CHAR_L ((unsigned char)'\xd3')
#define CHAR_M ((unsigned char)'\xd4')
#define CHAR_N ((unsigned char)'\xd5')
#define CHAR_O ((unsigned char)'\xd6')
#define CHAR_P ((unsigned char)'\xd7')
#define CHAR_Q ((unsigned char)'\xd8')
#define CHAR_R ((unsigned char)'\xd9')
#define CHAR_S ((unsigned char)'\xe2')
#define CHAR_T ((unsigned char)'\xe3')
#define CHAR_U ((unsigned char)'\xe4')
#define CHAR_V ((unsigned char)'\xe5')
#define CHAR_W ((unsigned char)'\xe6')
#define CHAR_X ((unsigned char)'\xe7')
#define CHAR_Y ((unsigned char)'\xe8')
#define CHAR_Z ((unsigned char)'\xe9')
#define CHAR_LEFT_SQUARE_BRACKET ((unsigned char)'\xad')
#define CHAR_BACKSLASH ((unsigned char)'\xe0')
#define CHAR_RIGHT_SQUARE_BRACKET ((unsigned char)'\xbd')
#define CHAR_CIRCUMFLEX_ACCENT '\137'
#define CHAR_UNDERSCORE '\155'
#define CHAR_GRAVE_ACCENT '\171'
#define CHAR_a ((unsigned char)'\x81')
#define CHAR_b ((unsigned char)'\x82')
#define CHAR_c ((unsigned char)'\x83')
#define CHAR_d ((unsigned char)'\x84')
#define CHAR_e ((unsigned char)'\x85')
#define CHAR_f ((unsigned char)'\x86')
#define CHAR_g ((unsigned char)'\x87')
#define CHAR_h ((unsigned char)'\x88')
#define CHAR_i ((unsigned char)'\x89')
#define CHAR_j ((unsigned char)'\x91')
#define CHAR_k ((unsigned char)'\x92')
#define CHAR_l ((unsigned char)'\x93')
#define CHAR_m ((unsigned char)'\x94')
#define CHAR_n ((unsigned char)'\x95')
#define CHAR_o ((unsigned char)'\x96')
#define CHAR_p ((unsigned char)'\x97')
#define CHAR_q ((unsigned char)'\x98')
#define CHAR_r ((unsigned char)'\x99')
#define CHAR_s ((unsigned char)'\xa2')
#define CHAR_t ((unsigned char)'\xa3')
#define CHAR_u ((unsigned char)'\xa4')
#define CHAR_v ((unsigned char)'\xa5')
#define CHAR_w ((unsigned char)'\xa6')
#define CHAR_x ((unsigned char)'\xa7')
#define CHAR_y ((unsigned char)'\xa8')
#define CHAR_z ((unsigned char)'\xa9')
#define CHAR_LEFT_CURLY_BRACKET ((unsigned char)'\xc0')
#define CHAR_VERTICAL_LINE '\117'
#define CHAR_RIGHT_CURLY_BRACKET ((unsigned char)'\xd0')
#define CHAR_TILDE ((unsigned char)'\xa1')
#define STR_HT "\005"
#define STR_VT "\013"
#define STR_FF "\014"
#define STR_CR "\015"
#define STR_BS "\026"
#define STR_BEL "\057"
#define STR_SPACE "\100"
#define STR_EXCLAMATION_MARK "\132"
#define STR_QUOTATION_MARK "\177"
#define STR_NUMBER_SIGN "\173"
#define STR_DOLLAR_SIGN "\133"
#define STR_PERCENT_SIGN "\154"
#define STR_AMPERSAND "\120"
#define STR_APOSTROPHE "\175"
#define STR_LEFT_PARENTHESIS "\115"
#define STR_RIGHT_PARENTHESIS "\135"
#define STR_ASTERISK "\134"
#define STR_PLUS "\116"
#define STR_COMMA "\153"
#define STR_MINUS "\140"
#define STR_DOT "\113"
#define STR_SLASH "\141"
#define STR_0 "\360"
#define STR_1 "\361"
#define STR_2 "\362"
#define STR_3 "\363"
#define STR_4 "\364"
#define STR_5 "\365"
#define STR_6 "\366"
#define STR_7 "\367"
#define STR_8 "\370"
#define STR_9 "\371"
#define STR_COLON "\172"
#define STR_SEMICOLON "\136"
#define STR_LESS_THAN_SIGN "\114"
#define STR_EQUALS_SIGN "\176"
#define STR_GREATER_THAN_SIGN "\156"
#define STR_QUESTION_MARK "\157"
#define STR_COMMERCIAL_AT "\174"
#define STR_A "\301"
#define STR_B "\302"
#define STR_C "\303"
#define STR_D "\304"
#define STR_E "\305"
#define STR_F "\306"
#define STR_G "\307"
#define STR_H "\310"
#define STR_I "\311"
#define STR_J "\321"
#define STR_K "\322"
#define STR_L "\323"
#define STR_M "\324"
#define STR_N "\325"
#define STR_O "\326"
#define STR_P "\327"
#define STR_Q "\330"
#define STR_R "\331"
#define STR_S "\342"
#define STR_T "\343"
#define STR_U "\344"
#define STR_V "\345"
#define STR_W "\346"
#define STR_X "\347"
#define STR_Y "\350"
#define STR_Z "\351"
#define STR_LEFT_SQUARE_BRACKET "\255"
#define STR_BACKSLASH "\340"
#define STR_RIGHT_SQUARE_BRACKET "\275"
#define STR_CIRCUMFLEX_ACCENT "\137"
#define STR_UNDERSCORE "\155"
#define STR_GRAVE_ACCENT "\171"
#define STR_a "\201"
#define STR_b "\202"
#define STR_c "\203"
#define STR_d "\204"
#define STR_e "\205"
#define STR_f "\206"
#define STR_g "\207"
#define STR_h "\210"
#define STR_i "\211"
#define STR_j "\221"
#define STR_k "\222"
#define STR_l "\223"
#define STR_m "\224"
#define STR_n "\225"
#define STR_o "\226"
#define STR_p "\227"
#define STR_q "\230"
#define STR_r "\231"
#define STR_s "\242"
#define STR_t "\243"
#define STR_u "\244"
#define STR_v "\245"
#define STR_w "\246"
#define STR_x "\247"
#define STR_y "\250"
#define STR_z "\251"
#define STR_LEFT_CURLY_BRACKET "\300"
#define STR_VERTICAL_LINE "\117"
#define STR_RIGHT_CURLY_BRACKET "\320"
#define STR_TILDE "\241"
#else /* EBCDIC_IGNORING_COMPILER */
/* Otherwise, on a real EBCDIC compiler or an ASCII compiler, we can use simple
string and character literals. */
#ifdef EBCDIC
#if 'a' != 0x81
#error "EBCDIC character 'a' is not 0x81"
#endif
#else
#if 'a' != 0x61
#error "ASCII character 'a' is not 0x61"
#endif
#endif
#define CHAR_NUL '\0'
#define CHAR_HT '\t'
@ -922,88 +1123,7 @@ a positive value. */
#define STR_RIGHT_CURLY_BRACKET "}"
#define STR_TILDE "~"
#define STRING_ACCEPT0 "ACCEPT\0"
#define STRING_COMMIT0 "COMMIT\0"
#define STRING_F0 "F\0"
#define STRING_FAIL0 "FAIL\0"
#define STRING_MARK0 "MARK\0"
#define STRING_PRUNE0 "PRUNE\0"
#define STRING_SKIP0 "SKIP\0"
#define STRING_THEN "THEN"
#define STRING_atomic0 "atomic\0"
#define STRING_pla0 "pla\0"
#define STRING_plb0 "plb\0"
#define STRING_napla0 "napla\0"
#define STRING_naplb0 "naplb\0"
#define STRING_nla0 "nla\0"
#define STRING_nlb0 "nlb\0"
#define STRING_scs0 "scs\0"
#define STRING_sr0 "sr\0"
#define STRING_asr0 "asr\0"
#define STRING_positive_lookahead0 "positive_lookahead\0"
#define STRING_positive_lookbehind0 "positive_lookbehind\0"
#define STRING_non_atomic_positive_lookahead0 "non_atomic_positive_lookahead\0"
#define STRING_non_atomic_positive_lookbehind0 "non_atomic_positive_lookbehind\0"
#define STRING_negative_lookahead0 "negative_lookahead\0"
#define STRING_negative_lookbehind0 "negative_lookbehind\0"
#define STRING_script_run0 "script_run\0"
#define STRING_atomic_script_run "atomic_script_run"
#define STRING_scan_substring0 "scan_substring\0"
#define STRING_alpha0 "alpha\0"
#define STRING_lower0 "lower\0"
#define STRING_upper0 "upper\0"
#define STRING_alnum0 "alnum\0"
#define STRING_ascii0 "ascii\0"
#define STRING_blank0 "blank\0"
#define STRING_cntrl0 "cntrl\0"
#define STRING_digit0 "digit\0"
#define STRING_graph0 "graph\0"
#define STRING_print0 "print\0"
#define STRING_punct0 "punct\0"
#define STRING_space0 "space\0"
#define STRING_word0 "word\0"
#define STRING_xdigit "xdigit"
#define STRING_DEFINE "DEFINE"
#define STRING_VERSION "VERSION"
#define STRING_WEIRD_STARTWORD "[:<:]]"
#define STRING_WEIRD_ENDWORD "[:>:]]"
#define STRING_CR_RIGHTPAR "CR)"
#define STRING_LF_RIGHTPAR "LF)"
#define STRING_CRLF_RIGHTPAR "CRLF)"
#define STRING_ANY_RIGHTPAR "ANY)"
#define STRING_ANYCRLF_RIGHTPAR "ANYCRLF)"
#define STRING_NUL_RIGHTPAR "NUL)"
#define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
#define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
#define STRING_UTF8_RIGHTPAR "UTF8)"
#define STRING_UTF16_RIGHTPAR "UTF16)"
#define STRING_UTF32_RIGHTPAR "UTF32)"
#define STRING_UTF_RIGHTPAR "UTF)"
#define STRING_UCP_RIGHTPAR "UCP)"
#define STRING_NO_AUTO_POSSESS_RIGHTPAR "NO_AUTO_POSSESS)"
#define STRING_NO_DOTSTAR_ANCHOR_RIGHTPAR "NO_DOTSTAR_ANCHOR)"
#define STRING_NO_JIT_RIGHTPAR "NO_JIT)"
#define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
#define STRING_NOTEMPTY_RIGHTPAR "NOTEMPTY)"
#define STRING_NOTEMPTY_ATSTART_RIGHTPAR "NOTEMPTY_ATSTART)"
#define STRING_CASELESS_RESTRICT_RIGHTPAR "CASELESS_RESTRICT)"
#define STRING_TURKISH_CASING_RIGHTPAR "TURKISH_CASING)"
#define STRING_LIMIT_HEAP_EQ "LIMIT_HEAP="
#define STRING_LIMIT_MATCH_EQ "LIMIT_MATCH="
#define STRING_LIMIT_DEPTH_EQ "LIMIT_DEPTH="
#define STRING_LIMIT_RECURSION_EQ "LIMIT_RECURSION="
#define STRING_MARK "MARK"
#define STRING_bc "bc"
#define STRING_bidiclass "bidiclass"
#define STRING_sc "sc"
#define STRING_script "script"
#define STRING_scriptextensions "scriptextensions"
#define STRING_scx "scx"
#endif /* EBCDIC_WITH_ASCII_COMPILER */
#else /* SUPPORT_UNICODE */
@ -1227,6 +1347,9 @@ only. */
#define STR_RIGHT_CURLY_BRACKET "\175"
#define STR_TILDE "\176"
#endif /* SUPPORT_UNICODE */
#define STRING_ACCEPT0 STR_A STR_C STR_C STR_E STR_P STR_T "\0"
#define STRING_COMMIT0 STR_C STR_O STR_M STR_M STR_I STR_T "\0"
#define STRING_F0 STR_F "\0"
@ -1311,8 +1434,6 @@ only. */
#define STRING_scx STR_s STR_c STR_x
#endif /* SUPPORT_UNICODE */
/* -------------------- End of character and string names -------------------*/
/* -------------------- Definitions for compiled patterns -------------------*/
@ -1791,7 +1912,7 @@ pcre2_dfa_match.c that must be updated. */
/* This macro defines textual names for all the opcodes. These are used only
for debugging, and some of them are only partial names. The macro is referenced
only in pcre2_printint.c, which fills out the full names in many cases (and in
only in pcre2_printint_inc.h, which fills out the full names in many cases (and in
some cases doesn't actually use these names at all). */
#define OP_NAME_LIST \
@ -2075,7 +2196,7 @@ tables are needed only when compiling the 8-bit library. */
#if PCRE2_CODE_UNIT_WIDTH == 8
extern const int PRIV(utf8_table1)[];
extern const int PRIV(utf8_table1_size);
extern const unsigned PRIV(utf8_table1_size);
extern const int PRIV(utf8_table2)[];
extern const int PRIV(utf8_table3)[];
extern const uint8_t PRIV(utf8_table4)[];
@ -2110,6 +2231,8 @@ extern const uint8_t PRIV(utf8_table4)[];
#define _pcre2_utt PCRE2_SUFFIX(_pcre2_utt_)
#define _pcre2_utt_names PCRE2_SUFFIX(_pcre2_utt_names_)
#define _pcre2_utt_size PCRE2_SUFFIX(_pcre2_utt_size_)
#define _pcre2_ebcdic_1047_to_ascii PCRE2_SUFFIX(_pcre2_ebcdic_1047_to_ascii_)
#define _pcre2_ascii_to_ebcdic_1047 PCRE2_SUFFIX(_pcre2_ascii_to_ebcdic_1047_)
extern const uint8_t PRIV(OP_lengths)[];
extern const uint32_t PRIV(callout_end_delims)[];
@ -2142,6 +2265,8 @@ extern const char *PRIV(unicode_version);
extern const ucp_type_table PRIV(utt)[];
extern const char PRIV(utt_names)[];
extern const size_t PRIV(utt_size);
extern const uint8_t PRIV(ebcdic_1047_to_ascii)[];
extern const uint8_t PRIV(ascii_to_ebcdic_1047)[];
/* Mode-dependent macros and hidden and private structures are defined in a
separate file so that pcre2test can include them at all supported widths. When
@ -2165,6 +2290,7 @@ is available. */
#define _pcre2_auto_possessify PCRE2_SUFFIX(_pcre2_auto_possessify_)
#define _pcre2_check_escape PCRE2_SUFFIX(_pcre2_check_escape_)
#define _pcre2_ckd_smul PCRE2_SUFFIX(_pcre2_ckd_smul_)
#define _pcre2_extuni PCRE2_SUFFIX(_pcre2_extuni_)
#define _pcre2_find_bracket PCRE2_SUFFIX(_pcre2_find_bracket_)
#define _pcre2_is_newline PCRE2_SUFFIX(_pcre2_is_newline_)
@ -2191,6 +2317,7 @@ extern int _pcre2_auto_possessify(PCRE2_UCHAR *,
const compile_block *);
extern int _pcre2_check_escape(PCRE2_SPTR *, PCRE2_SPTR, uint32_t *,
int *, uint32_t, uint32_t, uint32_t, BOOL, compile_block *);
extern BOOL _pcre2_ckd_smul(PCRE2_SIZE *, int, int);
extern PCRE2_SPTR _pcre2_extuni(uint32_t, PCRE2_SPTR, PCRE2_SPTR, PCRE2_SPTR,
BOOL, int *);
extern PCRE2_SPTR _pcre2_find_bracket(PCRE2_SPTR, BOOL, int);
@ -2217,17 +2344,8 @@ 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 */
extern BOOL PRIV(ckd_smul)(PCRE2_SIZE *, int, int);
#include "pcre2_util.h"
#endif /* PCRE2_INTERNAL_H_IDEMPOTENT_GUARD */

View file

@ -47,9 +47,16 @@ to have access to the hidden structures at all supported widths.
Some of the mode-dependent macros are required at different widths for
different parts of the pcre2test code (in particular, the included
pcre2_printint.c file). We undefine them here so that they can be re-defined for
multiple inclusions. Not all of these are used in pcre2test, but it's easier
just to undefine them all. */
pcre2_printint_inc.h file). We undefine them here so that they can be re-defined
for multiple inclusions. Not all of these are used in pcre2test, but it's easier
just to undefine them all.
You can also include pcre2_intmodedep.h with PCRE2_CODE_UNIT_WIDTH defined to
zero in order to simply clear the previous macros. */
#ifndef PCRE2_CODE_UNIT_WIDTH
#error PCRE2_CODE_UNIT_WIDTH must be defined
#endif
#undef ACROSSCHAR
#undef BACKCHAR
@ -81,9 +88,14 @@ just to undefine them all. */
#undef PUTINC
#undef TABLE_GET
/*************************************************
* MACROS *
*************************************************/
/* Macros may be undefined and re-defined if the same file handles multiple
bit-widths. */
/* -------------------------- MACROS ----------------------------- */
#if PCRE2_CODE_UNIT_WIDTH != 0
/* PCRE keeps offsets in its compiled code as at least 16-bit quantities
(always stored in big-endian order in 8-bit mode) by default. These are used,
@ -97,11 +109,23 @@ unit string is now handled by the macros that are defined here.
The macros are controlled by the value of LINK_SIZE. This defaults to 2, but
values of 3 or 4 are also supported. */
#ifndef CONFIGURED_LINK_SIZE
#if LINK_SIZE == 2
#define CONFIGURED_LINK_SIZE 2
#elif LINK_SIZE == 3
#define CONFIGURED_LINK_SIZE 3
#elif LINK_SIZE == 4
#define CONFIGURED_LINK_SIZE 4
#else
#error LINK_SIZE must be 2, 3, or 4
#endif
#endif /* CONFIGURED_LINK_SIZE */
/* ------------------- 8-bit support ------------------ */
#if PCRE2_CODE_UNIT_WIDTH == 8
#if LINK_SIZE == 2
#if CONFIGURED_LINK_SIZE == 2
#define PUT(a,n,d) \
(a[n] = (PCRE2_UCHAR)((d) >> 8)), \
(a[(n)+1] = (PCRE2_UCHAR)((d) & 255))
@ -109,7 +133,7 @@ values of 3 or 4 are also supported. */
(unsigned int)(((a)[n] << 8) | (a)[(n)+1])
#define MAX_PATTERN_SIZE (1 << 16)
#elif LINK_SIZE == 3
#elif CONFIGURED_LINK_SIZE == 3
#define PUT(a,n,d) \
(a[n] = (PCRE2_UCHAR)((d) >> 16)), \
(a[(n)+1] = (PCRE2_UCHAR)((d) >> 8)), \
@ -118,7 +142,7 @@ values of 3 or 4 are also supported. */
(unsigned int)(((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
#define MAX_PATTERN_SIZE (1 << 24)
#elif LINK_SIZE == 4
#elif CONFIGURED_LINK_SIZE == 4
#define PUT(a,n,d) \
(a[n] = (PCRE2_UCHAR)((d) >> 24)), \
(a[(n)+1] = (PCRE2_UCHAR)((d) >> 16)), \
@ -128,8 +152,6 @@ values of 3 or 4 are also supported. */
(unsigned int)(((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
#define MAX_PATTERN_SIZE (1 << 30) /* Keep it positive */
#else
#error LINK_SIZE must be 2, 3, or 4
#endif
@ -137,7 +159,7 @@ values of 3 or 4 are also supported. */
#elif PCRE2_CODE_UNIT_WIDTH == 16
#if LINK_SIZE == 2
#if CONFIGURED_LINK_SIZE == 2
#undef LINK_SIZE
#define LINK_SIZE 1
#define PUT(a,n,d) \
@ -146,7 +168,7 @@ values of 3 or 4 are also supported. */
(a[n])
#define MAX_PATTERN_SIZE (1 << 16)
#elif LINK_SIZE == 3 || LINK_SIZE == 4
#elif CONFIGURED_LINK_SIZE == 3 || CONFIGURED_LINK_SIZE == 4
#undef LINK_SIZE
#define LINK_SIZE 2
#define PUT(a,n,d) \
@ -156,8 +178,6 @@ values of 3 or 4 are also supported. */
(unsigned int)(((a)[n] << 16) | (a)[(n)+1])
#define MAX_PATTERN_SIZE (1 << 30) /* Keep it positive */
#else
#error LINK_SIZE must be 2, 3, or 4
#endif
@ -194,7 +214,7 @@ arithmetic results in a signed value. Hence the cast. */
#define GET2(a,n) (unsigned int)(((a)[n] << 8) | (a)[(n)+1])
#define PUT2(a,n,d) a[n] = (d) >> 8, a[(n)+1] = (d) & 255
#else /* Code units are 16 or 32 bits */
#elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
#define IMM2_SIZE 1
#define GET2(a,n) a[n]
#define PUT2(a,n,d) a[n] = d
@ -219,7 +239,7 @@ check is needed before accessing these tables. */
#define CHMAX_255(c) TRUE
#endif /* SUPPORT_UNICODE */
#else /* Code units are 16 or 32 bits */
#elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
#define CHMAX_255(c) ((c) <= 255u)
#define MAX_255(c) ((c) <= 255u)
#define MAX_MARK ((1u << 16) - 1)
@ -285,7 +305,7 @@ UTF support is omitted, we don't even define them. */
#define HAS_EXTRALEN(c) HASUTF8EXTRALEN(c)
/* Returns with the additional number of characters if IS_MULTICHAR(c) is TRUE.
/* Returns with the additional number of characters if HAS_EXTRALEN(c) is TRUE.
Otherwise it has an undefined behaviour. */
#define GET_EXTRALEN(c) (PRIV(utf8_table4)[(c) & 0x3fu])
@ -371,7 +391,7 @@ because almost all calls are already within a block of UTF-8 only code. */
#define HAS_EXTRALEN(c) (((c) & 0xfc00u) == 0xd800u)
/* Returns with the additional number of characters if IS_MULTICHAR(c) is TRUE.
/* Returns with the additional number of characters if HAS_EXTRALEN(c) is TRUE.
Otherwise it has an undefined behaviour. */
#define GET_EXTRALEN(c) 1
@ -466,7 +486,7 @@ code. */
/* ------------------- 32-bit support ------------------ */
#else
#elif PCRE2_CODE_UNIT_WIDTH == 32
/* These are trivial for the 32-bit library, since all UTF-32 characters fit
into one PCRE2_UCHAR unit. */
@ -547,6 +567,32 @@ These are all no-ops since all UTF-32 characters fit into one PCRE2_UCHAR. */
#define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
#define PUT2INC(a,n,d) PUT2(a,n,d), a += IMM2_SIZE
#endif /* PCRE2_CODE_UNIT_WIDTH != 0 */
/*************************************************
* STRUCTURES *
*************************************************/
/* We need a more complex include guard than usual, because the file can be
included once for each bit-width to define the various structures. */
#if PCRE2_CODE_UNIT_WIDTH == 8 && !defined PCRE2_INTMODEDEP_IDEMPOTENT_GUARD_8
#define PCRE2_INTMODEDEP_IDEMPOTENT_GUARD_8
#define PCRE2_INTMODEDEP_CAN_DEFINE
#endif
#if PCRE2_CODE_UNIT_WIDTH == 16 && !defined PCRE2_INTMODEDEP_IDEMPOTENT_GUARD_16
#define PCRE2_INTMODEDEP_IDEMPOTENT_GUARD_16
#define PCRE2_INTMODEDEP_CAN_DEFINE
#endif
#if PCRE2_CODE_UNIT_WIDTH == 32 && !defined PCRE2_INTMODEDEP_IDEMPOTENT_GUARD_32
#define PCRE2_INTMODEDEP_IDEMPOTENT_GUARD_32
#define PCRE2_INTMODEDEP_CAN_DEFINE
#endif
#ifdef PCRE2_INTMODEDEP_CAN_DEFINE
#undef PCRE2_INTMODEDEP_CAN_DEFINE
/* ----------------------- HIDDEN STRUCTURES ----------------------------- */
@ -624,7 +670,7 @@ have 16-bit arguments in 8-bit and 16-bit modes, so we need no more than a
#define CODE_BLOCKSIZE_TYPE PCRE2_SIZE
#undef LOOKBEHIND_MAX
#define LOOKBEHIND_MAX UINT16_MAX
#define LOOKBEHIND_MAX ((int)UINT16_MAX)
typedef struct pcre2_real_code {
pcre2_memctl memctl; /* Memory control fields */
@ -672,12 +718,14 @@ typedef struct pcre2_real_match_data {
struct heapframe *heapframes; /* Backtracking frames heap memory */
PCRE2_SIZE heapframes_size; /* Malloc-ed size */
PCRE2_SIZE subject_length; /* Subject length */
PCRE2_SIZE start_offset; /* Offset to start of search */
PCRE2_SIZE leftchar; /* Offset to leftmost code unit */
PCRE2_SIZE rightchar; /* Offset to rightmost code unit */
PCRE2_SIZE startchar; /* Offset to starting code unit */
uint8_t matchedby; /* Type of match (normal, JIT, DFA) */
uint8_t flags; /* Various flags */
uint16_t oveccount; /* Number of pairs */
uint32_t options; /* Options passed in to the match call */
int rc; /* The return code from the match */
PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
} pcre2_real_match_data;
@ -718,20 +766,31 @@ typedef struct branch_chain {
} branch_chain;
/* Structure for building a list of named groups during the first pass of
compiling. */
compiling. When a duplicate name is stored in the list, its name is set to
the name of the first entry with the same name, and its length is set to 0. */
typedef struct named_group {
PCRE2_SPTR name; /* Points to the name in the pattern */
uint32_t number; /* Group number */
uint16_t length; /* Length of the name */
uint16_t isdup; /* TRUE if a duplicate */
uint16_t hash_dup; /* A concatenation of a 15 bit hash code and
a singe bit which represents duplication */
} named_group;
/* Structure for storing compile time data. */
typedef struct compile_data {
struct compile_data *next; /* Next compile data */
#ifdef PCRE2_DEBUG
uint8_t type; /* Debug only type of the data */
#endif
} compile_data;
/* Structure for caching sorted ranges. This improves the performance
of translating META code to byte code. */
typedef struct class_ranges {
struct class_ranges *next; /* Next class ranges */
compile_data header; /* Common header */
size_t char_lists_size; /* Total size of encoded char lists */
size_t char_lists_start; /* Start offset of encoded char lists */
uint16_t range_list_size; /* Size of ranges array */
@ -739,6 +798,14 @@ typedef struct class_ranges {
/* Followed by the list of ranges (start/end pairs) */
} class_ranges;
/* Structure for sorted recurse arguments. */
typedef struct recurse_arguments {
compile_data header; /* Common header */
size_t size; /* Total size */
size_t skip_size; /* Space consumed by arguments */
} recurse_arguments;
typedef union class_bits_storage {
uint8_t classbits[32];
uint32_t classwords[8];
@ -789,9 +856,9 @@ typedef struct compile_block {
BOOL had_pruneorskip; /* (*PRUNE) or (*SKIP) encountered */
BOOL had_recurse; /* Had a pattern recursion or subroutine call */
BOOL dupnames; /* Duplicate names exist */
compile_data *first_data; /* First item in the compile data list */
compile_data *last_data; /* Last item in the compile data list */
#ifdef SUPPORT_WIDE_CHARS
class_ranges *cranges; /* First class range. */
class_ranges *next_cranges; /* Next class range. */
size_t char_lists_size; /* Current size of character lists */
#endif
} compile_block;
@ -902,7 +969,9 @@ typedef struct match_block {
uint32_t match_call_count; /* Number of times a new frame is created */
BOOL hitend; /* Hit the end of the subject at some point */
BOOL hasthen; /* Pattern contains (*THEN) */
BOOL hasbsk; /* Pattern contains \K */
BOOL allowemptypartial; /* Allow empty hard partial */
BOOL allowlookaroundbsk; /* Allow \K within lookarounds */
const uint8_t *lcc; /* Points to lower casing table */
const uint8_t *fcc; /* Points to case-flipping table */
const uint8_t *ctypes; /* Points to table of type maps */
@ -970,4 +1039,6 @@ typedef struct dfa_match_block {
#endif /* PCRE2_PCRE2TEST */
#endif /* PCRE2_INTMODEDEP_CAN_DEFINE */
/* End of pcre2_intmodedep.h */

File diff suppressed because it is too large Load diff

View file

@ -45,13 +45,13 @@ own as part of the PCRE2 library. It is also included in the compilation of
pcre2_dftables.c as a freestanding program, in which case the macro
PCRE2_DFTABLES is defined. */
#ifndef PCRE2_DFTABLES /* Compiling the library */
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "pcre2_internal.h"
#include "pcre2_internal.h"
#endif
/*************************************************
* Create PCRE2 character tables *
*************************************************/
@ -64,14 +64,15 @@ supplied, but when PCRE2_DFTABLES is defined (when compiling the pcre2_dftables
freestanding auxiliary program) malloc() is used, and the function has a
different name so as not to clash with the prototype in pcre2.h.
Arguments: none when PCRE2_DFTABLES is defined
Arguments: pointers to character-transforming functions when PCRE2_DFTABLES is
defined;
else a PCRE2 general context or NULL
Returns: pointer to the contiguous block of data
Returns: pointer to the contiguous block of data;
else NULL if memory allocation failed
*/
#ifdef PCRE2_DFTABLES /* Included in freestanding pcre2_dftables program */
static const uint8_t *maketables(void)
static const uint8_t *maketables(int (*charfn_to)(int), int (*charfn_from)(int))
{
uint8_t *yield = (uint8_t *)malloc(TABLES_LENGTH);
@ -82,6 +83,9 @@ pcre2_maketables(pcre2_general_context *gcontext)
uint8_t *yield = (uint8_t *)((gcontext != NULL)?
gcontext->memctl.malloc(TABLES_LENGTH, gcontext->memctl.memory_data) :
malloc(TABLES_LENGTH));
#define charfn_to(c) (c)
#define charfn_from(c) (c)
#endif /* PCRE2_DFTABLES */
int i;
@ -92,13 +96,18 @@ p = yield;
/* First comes the lower casing table */
for (i = 0; i < 256; i++) *p++ = tolower(i);
for (i = 0; i < 256; i++)
{
int c = charfn_from(tolower(charfn_to(i)));
*p++ = (c < 256)? c : i;
}
/* Next the case-flipping table */
for (i = 0; i < 256; i++)
{
int c = islower(i)? toupper(i) : tolower(i);
int c = charfn_from(islower(charfn_to(i))? toupper(charfn_to(i))
: tolower(charfn_to(i)));
*p++ = (c < 256)? c : i;
}
@ -118,17 +127,17 @@ test for alnum specially. */
memset(p, 0, cbit_length);
for (i = 0; i < 256; i++)
{
if (isdigit(i)) p[cbit_digit + i/8] |= 1u << (i&7);
if (isupper(i)) p[cbit_upper + i/8] |= 1u << (i&7);
if (islower(i)) p[cbit_lower + i/8] |= 1u << (i&7);
if (isalnum(i)) p[cbit_word + i/8] |= 1u << (i&7);
if (i == '_') p[cbit_word + i/8] |= 1u << (i&7);
if (isspace(i)) p[cbit_space + i/8] |= 1u << (i&7);
if (isxdigit(i)) p[cbit_xdigit + i/8] |= 1u << (i&7);
if (isgraph(i)) p[cbit_graph + i/8] |= 1u << (i&7);
if (isprint(i)) p[cbit_print + i/8] |= 1u << (i&7);
if (ispunct(i)) p[cbit_punct + i/8] |= 1u << (i&7);
if (iscntrl(i)) p[cbit_cntrl + i/8] |= 1u << (i&7);
if (isdigit(charfn_to(i))) p[cbit_digit + i/8] |= 1u << (i&7);
if (isupper(charfn_to(i))) p[cbit_upper + i/8] |= 1u << (i&7);
if (islower(charfn_to(i))) p[cbit_lower + i/8] |= 1u << (i&7);
if (isalnum(charfn_to(i))) p[cbit_word + i/8] |= 1u << (i&7);
if (i == CHAR_UNDERSCORE) p[cbit_word + i/8] |= 1u << (i&7);
if (isspace(charfn_to(i))) p[cbit_space + i/8] |= 1u << (i&7);
if (isxdigit(charfn_to(i))) p[cbit_xdigit + i/8] |= 1u << (i&7);
if (isgraph(charfn_to(i))) p[cbit_graph + i/8] |= 1u << (i&7);
if (isprint(charfn_to(i))) p[cbit_print + i/8] |= 1u << (i&7);
if (ispunct(charfn_to(i))) p[cbit_punct + i/8] |= 1u << (i&7);
if (iscntrl(charfn_to(i))) p[cbit_cntrl + i/8] |= 1u << (i&7);
}
p += cbit_length;
@ -140,11 +149,11 @@ changed at release 8.34 and it's always been this way for PCRE2. */
for (i = 0; i < 256; i++)
{
int x = 0;
if (isspace(i)) x += ctype_space;
if (isalpha(i)) x += ctype_letter;
if (islower(i)) x += ctype_lcletter;
if (isdigit(i)) x += ctype_digit;
if (isalnum(i) || i == '_') x += ctype_word;
if (isspace(charfn_to(i))) x += ctype_space;
if (isalpha(charfn_to(i))) x += ctype_letter;
if (islower(charfn_to(i))) x += ctype_lcletter;
if (isdigit(charfn_to(i))) x += ctype_digit;
if (isalnum(charfn_to(i)) || i == CHAR_UNDERSCORE) x += ctype_word;
*p++ = x;
}
@ -152,6 +161,9 @@ return yield;
}
#ifndef PCRE2_DFTABLES /* Compiling the library */
#undef charfn_to
#undef charfn_from
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_maketables_free(pcre2_general_context *gcontext, const uint8_t *tables)
{

View file

@ -39,12 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/* These defines enable debugging code */
/* #define DEBUG_FRAMES_DISPLAY */
@ -367,6 +365,10 @@ PCRE2_SIZE length;
PCRE2_SPTR eptr;
PCRE2_SPTR eptr_start;
#ifndef SUPPORT_UNICODE
(void)caseopts; /* Avoid compiler warning. */
#endif
/* Deal with an unset group. The default is no match, but there is an option to
match an empty string. */
@ -385,6 +387,7 @@ if (offset >= Foffset_top || Fovector[offset] == PCRE2_UNSET)
eptr = eptr_start = Feptr;
p = mb->start_subject + Fovector[offset];
length = Fovector[offset+1] - Fovector[offset];
PCRE2_ASSERT(eptr <= mb->end_subject);
if (caseless)
{
@ -404,7 +407,7 @@ if (caseless)
bytes in UTF-8); a sequence of 3 of the former uses 6 bytes, as does a
sequence of two of the latter. It is important, therefore, to check the
length along the reference, not along the subject (earlier code did this
wrong). UCP without uses Unicode properties but without UTF encoding. */
wrong). UCP uses Unicode properties but without UTF encoding. */
while (p < endptr)
{
@ -483,8 +486,8 @@ else
else
{
if ((PCRE2_SIZE)(mb->end_subject - eptr) < length) return 1; /* Partial */
if (memcmp(p, eptr, CU2BYTES(length)) != 0) return -1; /* No match */
if ((PCRE2_SIZE)(mb->end_subject - eptr) < length ||
memcmp(p, eptr, CU2BYTES(length)) != 0) return -1; /* No match */
eptr += length;
}
}
@ -495,6 +498,75 @@ return 0; /* Match */
/*************************************************
* Restore offsets after a recurse *
*************************************************/
/* This function restores the ovector values when
a recursive block reaches its end, and the triggering
recurse has and argument list.
Arguments:
F the current backtracking frame pointer
P the previous backtracking frame pointer
*/
static void
recurse_update_offsets(heapframe *F, heapframe *P)
{
PCRE2_SIZE *dst = F->ovector;
PCRE2_SIZE *src = P->ovector;
/* The first bracket has offset 2, because
offset 0 is reserved for the full match. */
PCRE2_SIZE offset = 2;
PCRE2_SIZE offset_top = Foffset_top + 2;
PCRE2_SIZE diff;
PCRE2_SPTR ecode = Fecode;
do
{
diff = (GET2(ecode, 1) << 1) - offset;
ecode += 1 + IMM2_SIZE;
if (offset + diff >= offset_top)
{
/* Some OP_CREF opcodes are not
processed, they must be skipped. */
while (*ecode == OP_CREF) ecode += 1 + IMM2_SIZE;
break;
}
if (diff == 2)
{
dst[0] = src[0];
dst[1] = src[1];
}
else if (diff >= 4)
memcpy(dst, src, diff * sizeof(PCRE2_SIZE));
/* Skip the unmodified entry. */
diff += 2;
offset += diff;
dst += diff;
src += diff;
}
while (*ecode == OP_CREF);
diff = offset_top - offset;
if (diff == 2)
{
dst[0] = src[0];
dst[1] = src[1];
}
else if (diff >= 4)
memcpy(dst, src, diff * sizeof(PCRE2_SIZE));
Fecode = ecode;
Foffset_top = (offset <= P->offset_top) ? P->offset_top : (offset - 2);
}
/******************************************************************************
*******************************************************************************
"Recursion" in the match() function
@ -898,7 +970,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
Fecode += 1 + LINK_SIZE;
continue;
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* OP_END itself can never be reached within a recursion because that is
picked up when the OP_KET that always precedes OP_END is reached. */
@ -938,11 +1010,28 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
}
#ifdef DEBUG_SHOW_OPS
fprintf(stderr, "++ Failed ACCEPT not at end (endanchnored set)\n");
fprintf(stderr, "++ Failed ACCEPT not at end (endanchored set)\n");
#endif
return MATCH_NOMATCH; /* (*ACCEPT) */
}
/* Fail if we detect that the start position was moved to be either after
the end position (\K in lookahead) or before the start offset (\K in
lookbehind). If this occurs, the pattern must have used \K in a somewhat
sneaky way (e.g. by pattern recursion), because if the \K is actually
syntactically inside the lookaround, it's blocked at compile-time. */
if (Fstart_match < mb->start_subject + mb->start_offset ||
Fstart_match > Feptr)
{
/* The \K expression is fairly rare. We assert it was used so that we
catch any unexpected invalid data in start_match. */
PCRE2_ASSERT(mb->hasbsk);
if (!mb->allowlookaroundbsk)
return PCRE2_ERROR_BAD_BACKSLASH_K;
}
/* We have a successful match of the whole pattern. Record the result and
then do a direct return from the function. If there is space in the offset
vector, set any pairs that follow the highest-numbered captured string but
@ -982,7 +1071,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
mb->hitend = TRUE;
if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* Match any single character whatsoever. */
@ -2779,9 +2868,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
/* This should never occur */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
Fecode += 3;
@ -3130,9 +3221,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
/* This should not occur */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
}
@ -3406,9 +3499,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
}
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
} /* End switch(Lctype) */
else
@ -3659,9 +3754,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
}
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
}
@ -3945,9 +4042,12 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
PCRE2_UNREACHABLE(); /* Control never reaches here */
/* This should never occur */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
}
@ -4100,9 +4200,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
RRETURN(MATCH_NOMATCH);
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
}
}
@ -4245,9 +4347,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
RRETURN(MATCH_NOMATCH);
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
}
}
@ -4514,9 +4618,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
}
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
/* Feptr is now past the end of the maximum run */
@ -4833,9 +4939,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
}
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
if (reptype == REPTYPE_POS) continue; /* No backtracking */
@ -5091,9 +5199,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
}
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
if (reptype == REPTYPE_POS) continue; /* No backtracking */
@ -5824,6 +5934,9 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
assert_accept_frame->offset_top * sizeof(PCRE2_SIZE));
Foffset_top = assert_accept_frame->offset_top;
Fmark = assert_accept_frame->mark;
mb->end_subject = Lsaved_end_subject;
mb->true_end_subject = mb->end_subject + Ltrue_end_extra;
mb->moptions = Lsaved_moptions;
break;
}
@ -5987,7 +6100,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
assert_accept_frame->offset_top * sizeof(PCRE2_SIZE));
Foffset_top = assert_accept_frame->offset_top;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* In the case of a match, the captures have already been put into
the current frame. */
@ -6260,12 +6373,18 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
/* Reinstate the previous set of captures and then carry on after the
recursion call. */
memcpy((char *)F + offsetof(heapframe, ovector), P->ovector,
Foffset_top * sizeof(PCRE2_SIZE));
Foffset_top = P->offset_top;
Fecode = P->ecode + 1 + LINK_SIZE;
if (*Fecode != OP_CREF)
{
memcpy(F->ovector, P->ovector, Foffset_top * sizeof(PCRE2_SIZE));
Foffset_top = P->offset_top;
}
else
recurse_update_offsets(F, P);
Fcapture_last = P->capture_last;
Fcurrent_recurse = P->current_recurse;
Fecode = P->ecode + 1 + LINK_SIZE;
continue; /* With next opcode */
case OP_COND: /* No need to do anything for these */
@ -6279,7 +6398,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
case OP_ASSERTBACK_NA:
if (branch_start[1 + LINK_SIZE] == OP_VREVERSE && Feptr != P->eptr)
RRETURN(MATCH_NOMATCH);
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_ASSERT_NA:
if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
@ -6293,12 +6412,12 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
case OP_ASSERTBACK:
if (branch_start[1 + LINK_SIZE] == OP_VREVERSE && Feptr != P->eptr)
RRETURN(MATCH_NOMATCH);
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_ASSERT:
if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
Feptr = P->eptr;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* For an atomic group, discard internal backtracking points. We must
also ensure that any remaining branches within the top-level of the group
@ -6322,7 +6441,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
case OP_ASSERTBACK_NOT:
if (branch_start[1 + LINK_SIZE] == OP_VREVERSE && Feptr != P->eptr)
RRETURN(MATCH_NOMATCH);
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_ASSERT_NOT:
RRETURN(MATCH_MATCH);
@ -6367,12 +6486,18 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
if (Fcurrent_recurse == number)
{
P = (heapframe *)((char *)N - frame_size);
memcpy((char *)F + offsetof(heapframe, ovector), P->ovector,
Foffset_top * sizeof(PCRE2_SIZE));
Foffset_top = P->offset_top;
Fecode = P->ecode + 1 + LINK_SIZE;
if (*Fecode != OP_CREF)
{
memcpy(F->ovector, P->ovector, Foffset_top * sizeof(PCRE2_SIZE));
Foffset_top = P->offset_top;
}
else
recurse_update_offsets(F, P);
Fcapture_last = P->capture_last;
Fcurrent_recurse = P->current_recurse;
Fecode = P->ecode + 1 + LINK_SIZE;
continue; /* With next opcode */
}
@ -6450,7 +6575,7 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
if ((mb->moptions & PCRE2_NOTEOL) != 0) RRETURN(MATCH_NOMATCH);
if ((mb->poptions & PCRE2_DOLLAR_ENDONLY) == 0) goto ASSERT_NL_OR_EOS;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* Unconditional end of subject assertion (\z). */
case OP_EOD:
@ -6748,9 +6873,11 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
/* There's been some horrible disaster. Arrival here can only mean there is
something seriously wrong in the code above or the OP_xxx definitions. */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
/* Do not insert any code in here without much thought; it is assumed
@ -6798,9 +6925,11 @@ switch (Freturn_id)
LBL(221) LBL(222) LBL(223) LBL(224)
#endif
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
#undef LBL
}
@ -6836,9 +6965,9 @@ pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length,
pcre2_match_context *mcontext)
{
int rc;
int was_zero_terminated = 0;
const uint8_t *start_bits = NULL;
const pcre2_real_code *re = (const pcre2_real_code *)code;
uint32_t original_options = options;
BOOL anchored;
BOOL firstline;
@ -6856,6 +6985,8 @@ PCRE2_UCHAR first_cu2 = 0;
PCRE2_UCHAR req_cu = 0;
PCRE2_UCHAR req_cu2 = 0;
PCRE2_UCHAR null_str[1] = { 0xcd };
PCRE2_SPTR original_subject = subject;
PCRE2_SPTR bumpalong_limit;
PCRE2_SPTR end_subject;
PCRE2_SPTR true_end_subject;
@ -6894,33 +7025,35 @@ match_block *mb = &actual_match_block;
/* Recognize NULL, length 0 as an empty string. */
if (subject == NULL && length == 0) subject = (PCRE2_SPTR)"";
if (subject == NULL && length == 0) subject = null_str;
/* Plausibility checks */
if ((options & ~PUBLIC_MATCH_OPTIONS) != 0) return PCRE2_ERROR_BADOPTION;
if (code == NULL || subject == NULL || match_data == NULL)
return PCRE2_ERROR_NULL;
if (match_data == NULL) return PCRE2_ERROR_NULL;
if (code == NULL || subject == NULL)
return match_data->rc = PCRE2_ERROR_NULL;
if ((options & ~PUBLIC_MATCH_OPTIONS) != 0)
return match_data->rc = PCRE2_ERROR_BADOPTION;
start_match = subject + start_offset;
req_cu_ptr = start_match - 1;
if (length == PCRE2_ZERO_TERMINATED)
{
length = PRIV(strlen)(subject);
was_zero_terminated = 1;
}
true_end_subject = end_subject = subject + length;
if (start_offset > length) return PCRE2_ERROR_BADOFFSET;
if (start_offset > length) return match_data->rc = PCRE2_ERROR_BADOFFSET;
/* Check that the first field in the block is the magic number. */
if (re->magic_number != MAGIC_NUMBER) return PCRE2_ERROR_BADMAGIC;
if (re->magic_number != MAGIC_NUMBER)
return match_data->rc = PCRE2_ERROR_BADMAGIC;
/* Check the code unit width. */
if ((re->flags & PCRE2_MODE_MASK) != PCRE2_CODE_UNIT_WIDTH/8)
return PCRE2_ERROR_BADMODE;
return match_data->rc = PCRE2_ERROR_BADMODE;
/* PCRE2_NOTEMPTY and PCRE2_NOTEMPTY_ATSTART are match-time flags in the
options variable for this function. Users of PCRE2 who are not calling the
@ -6967,17 +7100,18 @@ time. */
if (mb->partial != 0 &&
((re->overall_options | options) & PCRE2_ENDANCHORED) != 0)
return PCRE2_ERROR_BADOPTION;
return match_data->rc = PCRE2_ERROR_BADOPTION;
/* It is an error to set an offset limit without setting the flag at compile
time. */
if (mcontext != NULL && mcontext->offset_limit != PCRE2_UNSET &&
(re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0)
return PCRE2_ERROR_BADOFFSETLIMIT;
return match_data->rc = PCRE2_ERROR_BADOFFSETLIMIT;
/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT,
free the memory that was obtained. Set the field to NULL for no match cases. */
free the memory that was obtained. Set the field to NULL for match error
cases. */
if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0)
{
@ -7014,11 +7148,11 @@ if (use_jit)
#if PCRE2_CODE_UNIT_WIDTH != 32
if (start_match < end_subject && NOT_FIRSTCU(*start_match))
{
if (start_offset > 0) return PCRE2_ERROR_BADUTFOFFSET;
if (start_offset > 0) return match_data->rc = PCRE2_ERROR_BADUTFOFFSET;
#if PCRE2_CODE_UNIT_WIDTH == 8
return PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */
return match_data->rc = PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */
#else
return PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */
return match_data->rc = PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */
#endif
}
#endif /* WIDTH != 32 */
@ -7053,12 +7187,12 @@ if (use_jit)
/* Validate the relevant portion of the subject. Adjust the offset of an
invalid code point to be an absolute offset in the whole string. */
match_data->rc = PRIV(valid_utf)(start_match,
rc = PRIV(valid_utf)(start_match,
length - (start_match - subject), &(match_data->startchar));
if (match_data->rc != 0)
if (rc != 0)
{
match_data->startchar += start_match - subject;
return match_data->rc;
return match_data->rc = rc;
}
jit_checked_utf = TRUE;
}
@ -7071,16 +7205,27 @@ if (use_jit)
match_data, mcontext);
if (rc != PCRE2_ERROR_JIT_BADOPTION)
{
match_data->subject_length = length;
match_data->options = original_options;
if (rc >= 0 && (options & PCRE2_COPY_MATCHED_SUBJECT) != 0)
{
length = CU2BYTES(length + was_zero_terminated);
match_data->subject = match_data->memctl.malloc(length,
match_data->memctl.memory_data);
if (match_data->subject == NULL) return PCRE2_ERROR_NOMEMORY;
memcpy((void *)match_data->subject, subject, length);
if (length != 0)
{
match_data->subject = match_data->memctl.malloc(CU2BYTES(length),
match_data->memctl.memory_data);
if (match_data->subject == NULL)
return match_data->rc = PCRE2_ERROR_NOMEMORY;
memcpy((void *)match_data->subject, subject, CU2BYTES(length));
}
else
match_data->subject = NULL;
match_data->flags |= PCRE2_MD_COPIED_SUBJECT;
}
else
{
/* When pcre2_jit_match sets the subject, it doesn't know what the
original passed-in pointer was. */
if (match_data->subject != NULL) match_data->subject = original_subject;
}
return rc;
}
}
@ -7137,11 +7282,11 @@ if (utf &&
}
else if (start_match < end_subject && NOT_FIRSTCU(*start_match))
{
if (start_offset > 0) return PCRE2_ERROR_BADUTFOFFSET;
if (start_offset > 0) return match_data->rc = PCRE2_ERROR_BADUTFOFFSET;
#if PCRE2_CODE_UNIT_WIDTH == 8
return PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */
return match_data->rc = PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */
#else
return PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */
return match_data->rc = PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */
#endif
}
#endif /* WIDTH != 32 */
@ -7189,10 +7334,10 @@ if (utf &&
for (;;)
{
match_data->rc = PRIV(valid_utf)(mb->check_subject,
rc = PRIV(valid_utf)(mb->check_subject,
length - (mb->check_subject - subject), &(match_data->startchar));
if (match_data->rc == 0) break; /* Valid UTF string */
if (rc == 0) break; /* Valid UTF string */
/* Invalid UTF string. Adjust the offset to be an absolute offset in the
whole string. If we are handling invalid UTF strings, set end_subject to
@ -7200,7 +7345,7 @@ if (utf &&
Otherwise return the error. */
match_data->startchar += mb->check_subject - subject;
if (!allow_invalid || match_data->rc > 0) return match_data->rc;
if (!allow_invalid || rc > 0) return match_data->rc = rc;
end_subject = subject + match_data->startchar;
/* If the end precedes start_match, it means there is invalid UTF in the
@ -7265,8 +7410,11 @@ mb->start_offset = start_offset;
mb->end_subject = end_subject;
mb->true_end_subject = true_end_subject;
mb->hasthen = (re->flags & PCRE2_HASTHEN) != 0;
mb->hasbsk = (re->flags & PCRE2_HASBSK) != 0;
mb->allowemptypartial = (re->max_lookbehind > 0) ||
(re->flags & PCRE2_MATCH_EMPTY) != 0;
mb->allowlookaroundbsk =
(re->extra_options & PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) != 0;
mb->poptions = re->overall_options; /* Pattern options */
mb->ignore_skip_arg = 0;
mb->mark = mb->nomatch_mark = NULL; /* In case never set */
@ -7314,9 +7462,11 @@ switch(re->newline_convention)
mb->nltype = NLTYPE_ANYCRLF;
break;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INTERNAL;
return match_data->rc = PCRE2_ERROR_INTERNAL;
/* LCOV_EXCL_STOP */
}
/* The backtracking frames have fixed data at the front, and a PCRE2_SIZE
@ -7358,7 +7508,7 @@ if (heapframes_size < START_FRAMES_SIZE) heapframes_size = START_FRAMES_SIZE;
if (heapframes_size / 1024 > mb->heap_limit)
{
PCRE2_SIZE max_size = 1024 * mb->heap_limit;
if (max_size < frame_size) return PCRE2_ERROR_HEAPLIMIT;
if (max_size < frame_size) return match_data->rc = PCRE2_ERROR_HEAPLIMIT;
heapframes_size = max_size;
}
@ -7374,7 +7524,7 @@ if (match_data->heapframes_size < heapframes_size)
if (match_data->heapframes == NULL)
{
match_data->heapframes_size = 0;
return PCRE2_ERROR_NOMEMORY;
return match_data->rc = PCRE2_ERROR_NOMEMORY;
}
match_data->heapframes_size = heapframes_size;
}
@ -7850,7 +8000,7 @@ for(;;)
new_start_match = mb->verb_skip_ptr;
break;
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* NOMATCH and PRUNE advance by one character. THEN at this level acts
exactly like PRUNE. Unset ignore SKIP-with-argument. */
@ -8008,6 +8158,7 @@ if (utf && end_subject != true_end_subject &&
match_data->code = re;
match_data->mark = mb->mark;
match_data->matchedby = PCRE2_MATCHEDBY_INTERPRETER;
match_data->options = original_options;
/* Handle a fully successful match. Set the return code to the number of
captured strings, or 0 if there were too many to fit into the ovector, and then
@ -8019,20 +8170,26 @@ if (rc == MATCH_MATCH)
match_data->rc = ((int)mb->end_offset_top >= 2 * match_data->oveccount)?
0 : (int)mb->end_offset_top/2 + 1;
match_data->subject_length = length;
match_data->start_offset = start_offset;
match_data->startchar = start_match - subject;
match_data->leftchar = mb->start_used_ptr - subject;
match_data->rightchar = ((mb->last_used_ptr > mb->end_match_ptr)?
mb->last_used_ptr : mb->end_match_ptr) - subject;
if ((options & PCRE2_COPY_MATCHED_SUBJECT) != 0)
{
length = CU2BYTES(length + was_zero_terminated);
match_data->subject = match_data->memctl.malloc(length,
match_data->memctl.memory_data);
if (match_data->subject == NULL) return PCRE2_ERROR_NOMEMORY;
memcpy((void *)match_data->subject, subject, length);
if (length != 0)
{
match_data->subject = match_data->memctl.malloc(CU2BYTES(length),
match_data->memctl.memory_data);
if (match_data->subject == NULL)
return match_data->rc = PCRE2_ERROR_NOMEMORY;
memcpy((void *)match_data->subject, subject, CU2BYTES(length));
}
else
match_data->subject = NULL;
match_data->flags |= PCRE2_MD_COPIED_SUBJECT;
}
else match_data->subject = subject;
else match_data->subject = original_subject;
return match_data->rc;
}
@ -8054,8 +8211,9 @@ PCRE2_ERROR_PARTIAL. */
else if (match_partial != NULL)
{
match_data->subject = subject;
match_data->subject = original_subject;
match_data->subject_length = length;
match_data->start_offset = start_offset;
match_data->ovector[0] = match_partial - subject;
match_data->ovector[1] = end_subject - subject;
match_data->startchar = match_partial - subject;
@ -8066,7 +8224,13 @@ else if (match_partial != NULL)
/* Else this is the classic nomatch case. */
else match_data->rc = PCRE2_ERROR_NOMATCH;
else
{
match_data->subject = original_subject;
match_data->subject_length = length;
match_data->start_offset = start_offset;
match_data->rc = PCRE2_ERROR_NOMATCH;
}
return match_data->rc;
}

View file

@ -39,10 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
@ -85,6 +81,7 @@ PCRE2_EXP_DEFN pcre2_match_data * PCRE2_CALL_CONVENTION
pcre2_match_data_create_from_pattern(const pcre2_code *code,
pcre2_general_context *gcontext)
{
if (code == NULL) return NULL;
if (gcontext == NULL) gcontext = (pcre2_general_context *)code;
return pcre2_match_data_create(((const pcre2_real_code *)code)->top_bracket + 1,
gcontext);

View file

@ -0,0 +1,171 @@
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2016-2024 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
#include "pcre2_internal.h"
/* Advance the offset by one code unit, and return the new value.
It is only called when the offset is not at the end of the subject. */
static PCRE2_SIZE do_bumpalong(pcre2_match_data *match_data,
PCRE2_SIZE offset)
{
PCRE2_SPTR subject = match_data->subject;
PCRE2_SIZE subject_length = match_data->subject_length;
#ifdef SUPPORT_UNICODE
BOOL utf = (match_data->code->overall_options & PCRE2_UTF) != 0;
#endif
/* Skip over CRLF as an atomic sequence, if CRLF is configured as a newline
sequence. */
if (subject[offset] == CHAR_CR && offset + 1 < subject_length &&
subject[offset + 1] == CHAR_LF)
{
switch(match_data->code->newline_convention)
{
case PCRE2_NEWLINE_CRLF:
case PCRE2_NEWLINE_ANY:
case PCRE2_NEWLINE_ANYCRLF:
return offset + 2;
}
}
/* Advance by one full character if in UTF mode. */
#ifdef SUPPORT_UNICODE
if (utf)
{
PCRE2_SPTR next = subject + offset + 1;
PCRE2_SPTR subject_end = subject + subject_length;
(void)subject_end; /* Suppress warning; 32-bit FORWARDCHARTEST ignores this */
FORWARDCHARTEST(next, subject_end);
return next - subject;
}
#endif
return offset + 1;
}
/*************************************************
* Advance the match *
*************************************************/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_next_match(pcre2_match_data *match_data, PCRE2_SIZE *pstart_offset,
uint32_t *poptions)
{
int rc = match_data->rc;
PCRE2_SIZE start_offset = match_data->start_offset;
PCRE2_SIZE *ovector = match_data->ovector;
/* Match error, or no match: no further iteration possible. In previous versions
of PCRE2, we recommended that clients use a strategy which involved retrying in
certain cases after PCRE2_ERROR_NOMATCH, but this is no longer required. */
if (rc < 0)
return FALSE;
/* Match succeeded: get the start offset for the next match */
/* Although \K can affect the position of ovector[0], there are no ways to do
anything surprising with ovector[1], which must always be >= start_offset. */
PCRE2_ASSERT(ovector[1] >= start_offset);
/* Special handling for patterns which contain \K in a lookaround, which enables
the match start to be pushed back to before the starting search offset
(ovector[0] < start_offset) or after the match ends (ovector[0] > ovector[1]).
This is not a problem if ovector[1] > start_offset, because in this case, we can
just attempt the next match at ovector[1]: we are making progress, which is all
that we require.
However, if we have ovector[1] == start_offset, then we have a very rare case
which must be handled specially, because it's a non-empty match which
nonetheless fails to make progress through the subject. */
if (ovector[0] != start_offset && ovector[1] == start_offset)
{
/* If the match end is at the end of the subject, we are done. */
if (start_offset >= match_data->subject_length)
return FALSE;
/* Otherwise, bump along by one code unit, and do a normal search. */
*pstart_offset = do_bumpalong(match_data, ovector[1]);
*poptions = 0;
return TRUE;
}
/* If the previous match was for an empty string, we are finished if we are at
the end of the subject. Otherwise, arrange to run another match at the same
point to see if a non-empty match can be found. */
if (ovector[0] == ovector[1])
{
/* If the match is at the end of the subject, we are done. */
if (ovector[0] >= match_data->subject_length)
return FALSE;
/* Otherwise, continue at this exact same point, but we must set the flag
which ensures that we don't return the exact same empty match again. */
*pstart_offset = ovector[1];
*poptions = PCRE2_NOTEMPTY_ATSTART;
return TRUE;
}
/* Finally, we must be in the happy state of a non-empty match, where the end of
the match is further on in the subject than start_offset, so we are easily able
to continue and make progress. */
*pstart_offset = ovector[1];
*poptions = 0;
return TRUE;
}
/* End of pcre2_match_next.c */

View file

@ -48,10 +48,6 @@ and NLTYPE_ANY. The full list of Unicode newline characters is taken from
http://unicode.org/unicode/reports/tr18/. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"

View file

@ -43,13 +43,10 @@ POSSIBILITY OF SUCH DAMAGE.
into a UTF string. The behaviour is different for each code unit width. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/* If SUPPORT_UNICODE is not defined, this function will never be called.
Supply a dummy function because some compilers do not like empty source
modules. */
@ -83,16 +80,17 @@ PRIV(ord2utf)(uint32_t cvalue, PCRE2_UCHAR *buffer)
/* Convert to UTF-8 */
#if PCRE2_CODE_UNIT_WIDTH == 8
int i, j;
unsigned int i;
for (i = 0; i < PRIV(utf8_table1_size); i++)
if ((int)cvalue <= PRIV(utf8_table1)[i]) break;
buffer += i;
for (j = i; j > 0; j--)
for (unsigned int j = i; j != 0; j--)
{
*buffer-- = 0x80 | (cvalue & 0x3f);
cvalue >>= 6;
}
*buffer = PRIV(utf8_table2)[i] | cvalue;
*buffer = (PCRE2_UCHAR)(PRIV(utf8_table2)[i] | (int)cvalue);
return i + 1;
/* Convert to UTF-16 */

View file

@ -39,13 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/*************************************************
* Return info about compiled pattern *
*************************************************/
@ -292,8 +289,7 @@ if (re->magic_number != MAGIC_NUMBER) return PCRE2_ERROR_BADMAGIC;
if ((re->flags & (PCRE2_CODE_UNIT_WIDTH/8)) == 0) return PCRE2_ERROR_BADMODE;
cb.version = 0;
cc = (PCRE2_SPTR)((const uint8_t *)re + sizeof(pcre2_real_code))
+ re->name_count * re->name_entry_size;
cc = (PCRE2_SPTR)((uint8_t *)re + re->code_start);
while (TRUE)
{

File diff suppressed because it is too large Load diff

View file

@ -38,15 +38,14 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains the function for checking a script run. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/*************************************************
* Check script run *
*************************************************/

View file

@ -38,17 +38,15 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains functions for serializing and deserializing
a sequence of compiled codes. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/* Magic number to provide a small check against being handed junk. */
#define SERIALIZED_DATA_MAGIC 0x50523253u

View file

@ -38,53 +38,15 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains internal functions for comparing and finding the length
of strings. These are used instead of strcmp() etc because the standard
functions work only on 8-bit data. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/*************************************************
* 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 *

View file

@ -38,16 +38,15 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains functions for scanning a compiled pattern and
collecting data (e.g. minimum matching length). */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/* The maximum remembered capturing brackets minimum. */
#define MAX_CACHE_BACKREF 128
@ -139,7 +138,7 @@ for (;;)
PCRE2_UCHAR op;
PCRE2_SPTR cs, ce;
if (branchlength >= UINT16_MAX)
if (branchlength >= (int)UINT16_MAX)
{
branchlength = UINT16_MAX;
cc = nextbranch;
@ -176,7 +175,7 @@ for (;;)
cc += 1 + LINK_SIZE;
break;
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_ONCE:
case OP_SCRIPT_RUN:
@ -253,7 +252,7 @@ for (;;)
case OP_ASSERT_SCS:
case OP_ASSERTBACK_NA:
do cc += GET(cc, 1); while (*cc == OP_ALT);
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* Skip over things that don't match chars */
@ -353,7 +352,7 @@ for (;;)
case OP_PROP:
case OP_NOTPROP:
cc += 2;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_NOT_DIGIT:
case OP_DIGIT:
@ -434,7 +433,7 @@ for (;;)
case OP_CRMINPLUS:
case OP_CRPOSPLUS:
branchlength++;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_CRSTAR:
case OP_CRMINSTAR:
@ -628,11 +627,11 @@ for (;;)
break;
}
/* Take care not to overflow: (1) min and d are ints, so check that their
product is not greater than INT_MAX. (2) branchlength is limited to
UINT16_MAX (checked at the top of the loop). */
/* Take care not to overflow: (1) min and d are ints, so check that their
product is not greater than INT_MAX. (2) branchlength is limited to
UINT16_MAX (checked at the top of the loop). */
if ((d > 0 && (INT_MAX/d) < min) || UINT16_MAX - branchlength < min*d)
if ((d > 0 && (INT_MAX/d) < min) || (int)UINT16_MAX - branchlength < min*d)
branchlength = UINT16_MAX;
else branchlength += min * d;
break;
@ -753,14 +752,18 @@ for (;;)
/* This should not occur: we list all opcodes explicitly so that when
new ones get added they are properly considered. */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return -3;
/* LCOV_EXCL_STOP */
}
}
/* LCOV_EXCL_START */
PCRE2_DEBUG_UNREACHABLE(); /* Control should never reach here */
return -3; /* Avoid compiler warnings */
/* LCOV_EXCL_STOP */
}
@ -1304,7 +1307,7 @@ do
case OP_PROP:
if (ncode[1] != PT_CLIST) break;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_ANYNL:
case OP_CHAR:
case OP_CHARI:
@ -1328,7 +1331,7 @@ do
tcode = ncode;
continue; /* With the following significant opcode */
}
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* For a group bracket or a positive assertion without an immediately
following mandatory setting, recurse to set bits from within the
@ -1456,7 +1459,7 @@ do
case OP_EXACT:
tcode += IMM2_SIZE;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_CHAR:
case OP_PLUS:
case OP_MINPLUS:
@ -1467,7 +1470,7 @@ do
case OP_EXACTI:
tcode += IMM2_SIZE;
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
case OP_CHARI:
case OP_PLUSI:
case OP_MINPLUSI:
@ -1487,10 +1490,10 @@ do
SET_BIT(CHAR_SPACE);
/* For the 16-bit and 32-bit libraries (which can never be EBCDIC), set
the bits for 0xA0 and for code units >= 255, independently of UTF. */
the bits for NBSP and for code units >= 255, independently of UTF. */
#if PCRE2_CODE_UNIT_WIDTH != 8
SET_BIT(0xA0);
SET_BIT(CHAR_NBSP);
SET_BIT(0xFF);
#else
/* For the 8-bit library in UTF-8 mode, set the bits for the first code
@ -1506,12 +1509,9 @@ do
}
else
#endif
/* For the 8-bit library not in UTF-8 mode, set the bit for 0xA0, unless
the code is EBCDIC. */
/* For the 8-bit library not in UTF-8 mode, set the bit for NBSP. */
{
#ifndef EBCDIC
SET_BIT(0xA0);
#endif /* Not EBCDIC */
SET_BIT(CHAR_NBSP);
}
#endif /* 8-bit support */
@ -1606,7 +1606,8 @@ do
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
case OP_TYPEPOSUPTO:
tcode += IMM2_SIZE; /* Fall through */
tcode += IMM2_SIZE;
PCRE2_FALLTHROUGH /* Fall through */
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
@ -1626,10 +1627,10 @@ do
SET_BIT(CHAR_SPACE);
/* For the 16-bit and 32-bit libraries (which can never be EBCDIC), set
the bits for 0xA0 and for code units >= 255, independently of UTF. */
the bits for NBSP and for code units >= 255, independently of UTF. */
#if PCRE2_CODE_UNIT_WIDTH != 8
SET_BIT(0xA0);
SET_BIT(CHAR_NBSP);
SET_BIT(0xFF);
#else
/* For the 8-bit library in UTF-8 mode, set the bits for the first code
@ -1645,12 +1646,9 @@ do
}
else
#endif
/* For the 8-bit library not in UTF-8 mode, set the bit for 0xA0, unless
the code is EBCDIC. */
/* For the 8-bit library not in UTF-8 mode, set the bit for NBSP. */
{
#ifndef EBCDIC
SET_BIT(0xA0);
#endif /* Not EBCDIC */
SET_BIT(CHAR_NBSP);
}
#endif /* 8-bit support */
break;
@ -1779,9 +1777,11 @@ do
case XCL_END:
goto HANDLE_CLASSMAP;
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return SSB_UNKNOWN; /* Internal error, should not occur */
/* LCOV_EXCL_STOP */
}
}
#endif /* SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8 */
@ -1790,7 +1790,7 @@ do
/* It seems that the fall through comment must be outside the #ifdef if
it is to avoid the gcc compiler warning. */
/* Fall through */
PCRE2_FALLTHROUGH /* Fall through */
/* Enter here for a negative non-XCLASS. In the 8-bit library, if we are
in UTF mode, any byte with a value >= 0xc4 is a potentially valid starter
@ -1805,14 +1805,15 @@ do
re->start_bitmap[24] |= 0xf0; /* Bits for 0xc4 - 0xc8 */
memset(re->start_bitmap+25, 0xff, 7); /* Bits for 0xc9 - 0xff */
}
PCRE2_FALLTHROUGH /* Fall through */
#elif PCRE2_CODE_UNIT_WIDTH != 8
SET_BIT(0xFF); /* For characters >= 255 */
PCRE2_FALLTHROUGH /* Fall through */
#endif
/* Fall through */
/* Enter here for a positive non-XCLASS. If we have fallen through from
an XCLASS, classmap will already be set; just advance the code pointer.
Otherwise, set up classmap for a a non-XCLASS and advance past it. */
Otherwise, set up classmap for a non-XCLASS and advance past it. */
case OP_CLASS:
if (*tcode == OP_XCLASS) tcode += GET(tcode, 1); else
@ -1930,11 +1931,13 @@ if ((re->flags & (PCRE2_FIRSTSET|PCRE2_STARTLINE)) == 0)
{
int depth = 0;
int rc = set_start_bits(re, code, utf, ucp, &depth);
/* LCOV_EXCL_START */
if (rc == SSB_UNKNOWN)
{
PCRE2_DEBUG_UNREACHABLE();
return 1;
}
/* LCOV_EXCL_STOP */
/* If a list of starting code units was set up, scan the list to see if only
one or two were listed. Having only one listed is rare because usually a
@ -2002,6 +2005,16 @@ if ((re->flags & (PCRE2_FIRSTSET|PCRE2_STARTLINE)) == 0)
if (d != a) goto DONE; /* Not the other case of a */
b = c; /* Save second in b */
#ifdef EBCDIC
/* To match ASCII (which puts the uppercase one in a), swap a & b
if needed. This doesn't really matter, but neatens the tests. */
if (TABLE_GET((unsigned int)a, re->tables + lcc_offset, a) == a)
{
b = a;
a = c;
}
#endif
}
else goto DONE; /* More than two characters found */
}
@ -2049,16 +2062,20 @@ if ((re->flags & (PCRE2_MATCH_EMPTY|PCRE2_HASACCEPT)) == 0 &&
case -1: /* \C in UTF mode or over-complex regex */
break; /* Leave minlength unchanged (will be zero) */
/* LCOV_EXCL_START */
case -2:
PCRE2_DEBUG_UNREACHABLE();
return 2; /* missing capturing bracket */
/* LCOV_EXCL_STOP */
/* LCOV_EXCL_START */
case -3:
PCRE2_DEBUG_UNREACHABLE();
return 3; /* unrecognized opcode */
/* LCOV_EXCL_STOP */
default:
re->minlength = (min > UINT16_MAX)? UINT16_MAX : min;
re->minlength = (min > (int)UINT16_MAX)? (int)UINT16_MAX : min;
break;
}
}

View file

@ -39,12 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#define PTR_STACK_SIZE 20
#define SUBSTITUTE_OPTIONS \
@ -131,7 +129,6 @@ for (; ptr < ptrend; ptr++)
ptr += 1; /* Must point after \ */
erc = PRIV(check_escape)(&ptr, ptrend, &ch, &errorcode,
code->overall_options, code->extra_options, code->top_bracket, FALSE, NULL);
ptr -= 1; /* Back to last code unit of escape */
if (errorcode != 0)
{
/* errorcode from check_escape is positive, so must not be returned by
@ -327,9 +324,11 @@ if (input_len == 0) return 0;
switch (state->to_case)
{
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return 0;
/* LCOV_EXCL_STOP */
case PCRE2_SUBSTITUTE_CASE_LOWER: // Can be single_char TRUE or FALSE
case PCRE2_SUBSTITUTE_CASE_UPPER: // Can only be single_char FALSE
@ -465,9 +464,11 @@ PCRE2_ASSERT(input_len != 0);
switch (state->to_case)
{
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return 0;
/* LCOV_EXCL_STOP */
case PCRE2_SUBSTITUTE_CASE_LOWER: // Can be single_char TRUE or FALSE
case PCRE2_SUBSTITUTE_CASE_UPPER: // Can only be single_char FALSE
@ -751,12 +752,14 @@ BOOL use_existing_match;
BOOL replacement_only;
BOOL utf = (code->overall_options & PCRE2_UTF) != 0;
PCRE2_UCHAR temp[6];
PCRE2_UCHAR null_str[1] = { 0xcd };
PCRE2_SPTR original_subject = subject;
PCRE2_SPTR ptr;
PCRE2_SPTR repend = NULL;
PCRE2_SIZE extra_needed = 0;
PCRE2_SIZE buff_offset, buff_length, lengthleft, fraglength;
PCRE2_SIZE *ovector;
PCRE2_SIZE ovecsave[3];
PCRE2_SIZE ovecsave[2] = { 0, 0 };
pcre2_substitute_callout_block scb;
PCRE2_SIZE sub_start_extra_needed;
PCRE2_SIZE (*substitute_case_callout)(PCRE2_SPTR, PCRE2_SIZE, PCRE2_UCHAR *,
@ -768,7 +771,6 @@ void *substitute_case_callout_data = NULL;
buff_offset = 0;
lengthleft = buff_length = *blength;
*blength = PCRE2_UNSET;
ovecsave[0] = ovecsave[1] = ovecsave[2] = PCRE2_UNSET;
if (mcontext != NULL)
{
@ -788,18 +790,74 @@ zero length is interpreted as an empty string. */
if (replacement == NULL)
{
if (rlength != 0) return PCRE2_ERROR_NULL;
replacement = (PCRE2_SPTR)"";
replacement = null_str;
}
if (rlength == PCRE2_ZERO_TERMINATED) rlength = PRIV(strlen)(replacement);
repend = replacement + rlength;
/* A NULL subject of zero length is treated as an empty string. */
if (subject == NULL)
{
if (length != 0) return PCRE2_ERROR_NULL;
subject = null_str;
}
if (length == PCRE2_ZERO_TERMINATED) length = PRIV(strlen)(subject);
/* Check for using a match that has already happened. Note that the subject
pointer in the match data may be NULL after a no-match. */
use_existing_match = ((options & PCRE2_SUBSTITUTE_MATCHED) != 0);
replacement_only = ((options & PCRE2_SUBSTITUTE_REPLACEMENT_ONLY) != 0);
if (use_existing_match && match_data == NULL) return PCRE2_ERROR_NULL;
/* If an existing match is being passed in, we should check that it matches
the passed-in subject pointer, length, and match options. We don't currently
have a use-case for someone to match on one subject, then try and use that
match data on a different subject. In a UTF-encoded string, a simple change
like replacing one character for another won't preserve the code unit offsets,
so it's hard to see, in the general case, how it would be safe or useful to
support swapping or mutating the subject string.
Similarly, using different match options between the first (external) and
subsequent (internal, global) matches is hard to justify. */
if (use_existing_match)
{
/* Return early, as the rest of the match_data may not have been
initialised. This duplicates and must be in sync with the check below that
aborts substitution on any result other than success or no-match. */
if (match_data->rc < 0 && match_data->rc != PCRE2_ERROR_NOMATCH)
return match_data->rc;
/* Not supported if the passed-in match was from the DFA interpreter. */
if (match_data->matchedby == PCRE2_MATCHEDBY_DFA_INTERPRETER)
return PCRE2_ERROR_DFA_UFUNC;
if (code != match_data->code)
return PCRE2_ERROR_DIFFSUBSPATTERN;
/* We want the passed-in subject strings to match. This implies the effective
length must match, and either: the pointers are equal (with strict matching
of NULL against NULL); or, the special case of PCRE2_COPY_MATCHED_SUBJECT
where we cannot compare pointers but we can verify the contents. */
if (length != match_data->subject_length ||
!(original_subject == match_data->subject ||
((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0 &&
(length == 0 ||
memcmp(subject, match_data->subject, CU2BYTES(length)) == 0))))
return PCRE2_ERROR_DIFFSUBSSUBJECT;
if (start_offset != match_data->start_offset)
return PCRE2_ERROR_DIFFSUBSOFFSET;
if ((options & ~SUBSTITUTE_OPTIONS) != match_data->options)
return PCRE2_ERROR_DIFFSUBSOPTIONS;
}
/* If starting from an existing match, there must be an externally provided
match data block. We create an internal match_data block in two cases: (a) an
external one is not supplied (and we are not starting from an existing match);
@ -816,9 +874,8 @@ have to be changes below. */
if (match_data == NULL)
{
pcre2_general_context gcontext;
if (use_existing_match) return PCRE2_ERROR_NULL;
gcontext.memctl = (mcontext == NULL)?
((const pcre2_real_code *)code)->memctl :
((pcre2_real_code *)code)->memctl :
((pcre2_real_match_context *)mcontext)->memctl;
match_data = internal_match_data =
pcre2_match_data_create_from_pattern(code, &gcontext);
@ -830,7 +887,7 @@ else if (use_existing_match)
int pairs;
pcre2_general_context gcontext;
gcontext.memctl = (mcontext == NULL)?
((const pcre2_real_code *)code)->memctl :
((pcre2_real_code *)code)->memctl :
((pcre2_real_match_context *)mcontext)->memctl;
pairs = (code->top_bracket + 1 < match_data->oveccount)?
code->top_bracket + 1 : match_data->oveccount;
@ -841,9 +898,15 @@ else if (use_existing_match)
+ 2*pairs*sizeof(PCRE2_SIZE));
internal_match_data->heapframes = NULL;
internal_match_data->heapframes_size = 0;
/* Ensure that the subject is not freed when internal_match_data is */
internal_match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT;
match_data = internal_match_data;
}
/* If using an internal match data, there's no need to copy the subject. */
if (internal_match_data != NULL) options &= ~PCRE2_COPY_MATCHED_SUBJECT;
/* Remember ovector details */
ovector = pcre2_get_ovector_pointer(match_data);
@ -856,19 +919,6 @@ scb.input = subject;
scb.output = (PCRE2_SPTR)buffer;
scb.ovector = ovector;
/* A NULL subject of zero length is treated as an empty string. */
if (subject == NULL)
{
if (length != 0) return PCRE2_ERROR_NULL;
subject = (PCRE2_SPTR)"";
}
/* Find length of zero-terminated subject */
if (length == PCRE2_ZERO_TERMINATED)
length = subject? PRIV(strlen)(subject) : 0;
/* Check UTF replacement string if necessary. */
#ifdef SUPPORT_UNICODE
@ -905,7 +955,7 @@ if (!replacement_only) CHECKMEMCPY(subject, start_offset);
match is taken from the match_data that was passed in. */
subs = 0;
do
for (;;)
{
PCRE2_SPTR ptrstack[PTR_STACK_SIZE];
uint32_t ptrstackptr = 0;
@ -925,54 +975,12 @@ do
if (utf) options |= PCRE2_NO_UTF_CHECK; /* Only need to check once */
#endif
/* Any error other than no match returns the error code. No match when not
doing the special after-empty-match global rematch, or when at the end of the
subject, breaks the global loop. Otherwise, advance the starting point by one
character, copying it to the output, and try again. */
/* Any error other than no match returns the error code. No match breaks the
global loop. */
if (rc < 0)
{
PCRE2_SIZE save_start;
if (rc == PCRE2_ERROR_NOMATCH) break;
if (rc != PCRE2_ERROR_NOMATCH) goto EXIT;
if (goptions == 0 || start_offset >= length) break;
/* Advance by one code point. Then, if CRLF is a valid newline sequence and
we have advanced into the middle of it, advance one more code point. In
other words, do not start in the middle of CRLF, even if CR and LF on their
own are valid newlines. */
save_start = start_offset++;
if (subject[start_offset-1] == CHAR_CR &&
(code->newline_convention == PCRE2_NEWLINE_CRLF ||
code->newline_convention == PCRE2_NEWLINE_ANY ||
code->newline_convention == PCRE2_NEWLINE_ANYCRLF) &&
start_offset < length &&
subject[start_offset] == CHAR_LF)
start_offset++;
/* Otherwise, in UTF mode, advance past any secondary code points. */
else if ((code->overall_options & PCRE2_UTF) != 0)
{
#if PCRE2_CODE_UNIT_WIDTH == 8
while (start_offset < length && (subject[start_offset] & 0xc0) == 0x80)
start_offset++;
#elif PCRE2_CODE_UNIT_WIDTH == 16
while (start_offset < length &&
(subject[start_offset] & 0xfc00) == 0xdc00)
start_offset++;
#endif
}
/* Copy what we have advanced past (unless not required), reset the special
global options, and continue to the next match. */
fraglength = start_offset - save_start;
if (!replacement_only) CHECKMEMCPY(subject + save_start, fraglength);
goptions = 0;
continue;
}
if (rc < 0) goto EXIT;
/* Handle a successful match. Matches that use \K to end before they start
or start before the current point in the subject are not supported. */
@ -983,25 +991,27 @@ do
goto EXIT;
}
/* Check for the same match as previous. This is legitimate after matching an
empty string that starts after the initial match offset. We have tried again
at the match point in case the pattern is one like /(?<=\G.)/ which can never
match at its starting point, so running the match achieves the bumpalong. If
we do get the same (null) match at the original match point, it isn't such a
pattern, so we now do the empty string magic. In all other cases, a repeat
match should never occur. */
/* Assert that our replacement loop is making progress, checked even in
release builds. This should be impossible to hit, however, an infinite loop
would be fairly catastrophic.
if (ovecsave[0] == ovector[0] && ovecsave[1] == ovector[1])
"Progress" is measured as ovector[1] strictly advancing, or, an empty match
after a non-empty match. */
/* LCOV_EXCL_START */
if (subs > 0 &&
!(ovector[1] > ovecsave[1] ||
(ovector[1] == ovector[0] && ovecsave[1] > ovecsave[0] &&
ovector[1] == ovecsave[1])))
{
if (ovector[0] == ovector[1] && ovecsave[2] != start_offset)
{
goptions = PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED;
ovecsave[2] = start_offset;
continue; /* Back to the top of the loop */
}
PCRE2_DEBUG_UNREACHABLE();
rc = PCRE2_ERROR_INTERNAL_DUPMATCH;
goto EXIT;
}
/* LCOV_EXCL_STOP */
ovecsave[0] = ovector[0];
ovecsave[1] = ovector[1];
/* Count substitutions with a paranoid check for integer overflow; surely no
real call to this function would ever hit this! */
@ -1133,6 +1143,44 @@ do
subptrend = subject + length;
goto SUBPTR_SUBSTITUTE;
}
else if (next == CHAR_PLUS &&
!(ptr+1 < repend && ptr[1] == CHAR_LEFT_CURLY_BRACKET))
{
/* Perl supports $+ for "highest captured group" (not the same as $^N
which is mainly only useful inside Perl's match callbacks). We also
don't accept "$+{..." since that's Perl syntax for our ${name}. */
++ptr;
if (code->top_bracket == 0)
{
/* Treat either as "no such group" or "all groups unset" based on the
PCRE2_SUBSTITUTE_UNKNOWN_UNSET option. */
if ((suboptions & PCRE2_SUBSTITUTE_UNKNOWN_UNSET) == 0)
{
rc = PCRE2_ERROR_NOSUBSTRING;
goto PTREXIT;
}
group = 0;
}
else
{
/* If we have any capture groups, then the ovector needs to be large
enough for all of them, or the result won't be accurate. */
if (match_data->oveccount < code->top_bracket + 1)
{
rc = PCRE2_ERROR_UNAVAILABLE;
goto PTREXIT;
}
for (group = code->top_bracket; group > 0; group--)
if (ovector[2*group] != PCRE2_UNSET) break;
}
if (group == 0)
{
if ((suboptions & PCRE2_SUBSTITUTE_UNSET_EMPTY) != 0) continue;
rc = PCRE2_ERROR_UNSET;
goto PTREXIT;
}
goto GROUP_SUBSTITUTE;
}
if (next == CHAR_LEFT_CURLY_BRACKET)
{
@ -1627,19 +1675,25 @@ do
}
}
/* Save the details of this match. See above for how this data is used. If we
matched an empty string, do the magic for global matches. Update the start
offset to point to the rest of the subject string. If we re-used an existing
match for the first match, switch to the internal match data block. */
/* Exit the global loop if we are not in global mode, or if pcre2_next_match()
indicates we have reached the end of the subject. */
ovecsave[0] = ovector[0];
ovecsave[1] = ovector[1];
ovecsave[2] = start_offset;
if ((suboptions & PCRE2_SUBSTITUTE_GLOBAL) == 0 ||
!pcre2_next_match(match_data, &start_offset, &goptions))
{
start_offset = ovector[1];
break;
}
goptions = (ovector[0] != ovector[1] || ovector[0] > start_offset)? 0 :
PCRE2_ANCHORED|PCRE2_NOTEMPTY_ATSTART;
start_offset = ovector[1];
} while ((suboptions & PCRE2_SUBSTITUTE_GLOBAL) != 0); /* Repeat "do" loop */
/* Verify that pcre2_next_match() has not done a bumpalong (because we have
already returned PCRE2_ERROR_BADSUBSPATTERN for \K in lookarounds).
We would otherwise have to memcpy the fragment spanning from ovector[1] to the
new start_offset.*/
PCRE2_ASSERT(start_offset == ovector[1]);
} /* End of global loop */
/* Copy the rest of the subject unless not required, and terminate the output
with a binary zero. */

View file

@ -39,10 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
@ -126,7 +122,7 @@ PCRE2_SIZE size;
rc = pcre2_substring_length_bynumber(match_data, stringnumber, &size);
if (rc < 0) return rc;
if (size + 1 > *sizeptr) return PCRE2_ERROR_NOMEMORY;
memcpy(buffer, match_data->subject + match_data->ovector[stringnumber*2],
if (size != 0) memcpy(buffer, match_data->subject + match_data->ovector[stringnumber*2],
CU2BYTES(size));
buffer[size] = 0;
*sizeptr = size;
@ -218,7 +214,7 @@ yield = PRIV(memctl_malloc)(sizeof(pcre2_memctl) +
(size + 1)*PCRE2_CODE_UNIT_WIDTH, (pcre2_memctl *)match_data);
if (yield == NULL) return PCRE2_ERROR_NOMEMORY;
yield = (PCRE2_UCHAR *)(((char *)yield) + sizeof(pcre2_memctl));
memcpy(yield, match_data->subject + match_data->ovector[stringnumber*2],
if (size != 0) memcpy(yield, match_data->subject + match_data->ovector[stringnumber*2],
CU2BYTES(size));
yield[size] = 0;
*stringptr = yield;
@ -259,7 +255,7 @@ permits duplicate names, the first substring that is set is chosen.
Arguments:
match_data pointer to match data
stringname the name of the required substring
sizeptr where to put the length
sizeptr where to put the length, if not NULL
Returns: 0 if successful, else a negative error number
*/
@ -342,8 +338,15 @@ else /* Matched using pcre2_dfa_match() */
left = match_data->ovector[stringnumber*2];
right = match_data->ovector[stringnumber*2+1];
/* LCOV_EXCL_START - this appears to be unreachable, as the ovector and
subject_length should always be set consistently, no matter what misbehaviour
the caller has committed. */
if (left > match_data->subject_length || right > match_data->subject_length)
{
PCRE2_DEBUG_UNREACHABLE();
return PCRE2_ERROR_INVALIDOFFSET;
}
/* LCOV_EXCL_STOP */
if (sizeptr != NULL) *sizeptr = (left > right)? 0 : right - left;
return 0;
}

View file

@ -38,27 +38,33 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains some fixed tables that are used by more than one of the
PCRE2 code modules. The tables are also #included by the pcre2test program,
which uses macros to change their names from _pcre2_xxx to xxxx, thereby
avoiding name clashes with the library. In this case, PCRE2_PCRE2TEST is
defined. */
#ifndef PCRE2_PCRE2TEST /* We're compiling the library */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if !defined(PCRE2_PCRE2TEST) && !defined(PCRE2_DFTABLES) && \
!defined(PCRE2_PCRE2POSIX) /* We're compiling the library */
#include "pcre2_internal.h"
#endif /* PCRE2_PCRE2TEST */
#endif
/* Utility macros */
#define ARR_SIZE(x) sizeof(x)/sizeof(x[0])
#if !defined(PCRE2_PCRE2TEST) && !defined(PCRE2_DFTABLES) && \
!defined(PCRE2_PCRE2POSIX)
/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
the definition is next to the definition of the opcodes in pcre2_internal.h.
This is mode-dependent, so it is skipped when this file is included by
pcre2test. */
#ifndef PCRE2_PCRE2TEST
const uint8_t PRIV(OP_lengths)[] = { OP_LENGTHS };
#endif
/* Tables of horizontal and vertical whitespace characters, suitable for
adding to classes. */
@ -66,6 +72,11 @@ adding to classes. */
const uint32_t PRIV(hspace_list)[] = { HSPACE_LIST };
const uint32_t PRIV(vspace_list)[] = { VSPACE_LIST };
#endif /* !PCRE2_PCRE2TEST && !PCRE2_DFTABLES && !PCRE2_PCRE2POSIX */
#if !defined(PCRE2_DFTABLES) && !defined(PCRE2_PCRE2POSIX)
/* These tables are the pairs of delimiters that are valid for callout string
arguments. For each starting delimiter there must be a matching ending
delimiter, which in fact is different only for bracket-like delimiters. */
@ -80,6 +91,8 @@ const uint32_t PRIV(callout_end_delims[]) = {
CHAR_CIRCUMFLEX_ACCENT, CHAR_PERCENT_SIGN, CHAR_NUMBER_SIGN,
CHAR_DOLLAR_SIGN, CHAR_RIGHT_CURLY_BRACKET, 0 };
#endif /* !PCRE2_DFTABLES && !PCRE2_PCRE2POSIX */
/*************************************************
* Tables for UTF-8 support *
@ -90,23 +103,24 @@ as for the library in 8-bit mode, because pcre2test uses UTF-8 internally for
handling wide characters. */
#if defined PCRE2_PCRE2TEST || \
(defined SUPPORT_UNICODE && \
defined PCRE2_CODE_UNIT_WIDTH && \
PCRE2_CODE_UNIT_WIDTH == 8)
(!defined(PCRE2_DFTABLES) && !defined(PCRE2_PCRE2POSIX) && \
defined SUPPORT_UNICODE && \
defined PCRE2_CODE_UNIT_WIDTH && \
PCRE2_CODE_UNIT_WIDTH == 8)
/* These are the breakpoints for different numbers of bytes in a UTF-8
character. */
const int PRIV(utf8_table1)[] =
{ 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
{ 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff };
const int PRIV(utf8_table1_size) = sizeof(PRIV(utf8_table1)) / sizeof(int);
const unsigned PRIV(utf8_table1_size) = ARR_SIZE(PRIV(utf8_table1));
/* These are the indicator bits and the mask for the data bits to set in the
first byte of a character, indexed by the number of additional bytes. */
const int PRIV(utf8_table2)[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
const int PRIV(utf8_table3)[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
const int PRIV(utf8_table2)[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc };
const int PRIV(utf8_table3)[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01 };
/* Table of the number of extra bytes, indexed by the first byte masked with
0x3f. The highest number for a valid UTF-8 first byte is in fact 0x3d. */
@ -120,10 +134,11 @@ const uint8_t PRIV(utf8_table4)[] = {
#endif /* UTF-8 support needed */
/* Tables concerned with Unicode properties are relevant only when Unicode
support is enabled. See also the pcre2_ucptables.c file, which is generated by
support is enabled. See also the pcre2_ucptables_inc.h file, which is generated by
a Python script from Unicode data files. */
#ifdef SUPPORT_UNICODE
#if !defined(PCRE2_DFTABLES) && !defined(PCRE2_PCRE2POSIX) && \
defined(SUPPORT_UNICODE)
/* Table to translate from particular type value to the general value. */
@ -227,8 +242,69 @@ const int PRIV(ucp_typerange)[] = {
/* Finally, include the tables that are auto-generated from the Unicode data
files. */
#include "pcre2_ucptables.c"
#include "pcre2_ucptables_inc.h"
#endif /* SUPPORT_UNICODE */
#endif /* Unicode support needed */
/*************************************************
* Tables for EBCDIC support *
*************************************************/
#if defined(EBCDIC) && \
(defined(PCRE2_PCRE2TEST) || defined(PCRE2_DFTABLES) || 'a' != 0x81)
const uint8_t PRIV(ebcdic_1047_to_ascii)[256] = {
0x00,0x01,0x02,0x03,0x9c,0x09,0x86,0x7f,0x97,0x8d,0x8e,0x0b,0x0c,0x0d,0x0e,0x0f,
#ifdef EBCDIC_NL25
0x10,0x11,0x12,0x13,0x9d,0x85,0x08,0x87,0x18,0x19,0x92,0x8f,0x1c,0x1d,0x1e,0x1f,
0x80,0x81,0x82,0x83,0x84,0x0a,0x17,0x1b,0x88,0x89,0x8a,0x8b,0x8c,0x05,0x06,0x07,
#else
0x10,0x11,0x12,0x13,0x9d,0x0a,0x08,0x87,0x18,0x19,0x92,0x8f,0x1c,0x1d,0x1e,0x1f,
0x80,0x81,0x82,0x83,0x84,0x85,0x17,0x1b,0x88,0x89,0x8a,0x8b,0x8c,0x05,0x06,0x07,
#endif
0x90,0x91,0x16,0x93,0x94,0x95,0x96,0x04,0x98,0x99,0x9a,0x9b,0x14,0x15,0x9e,0x1a,
0x20,0xa0,0xe2,0xe4,0xe0,0xe1,0xe3,0xe5,0xe7,0xf1,0xa2,0x2e,0x3c,0x28,0x2b,0x7c,
0x26,0xe9,0xea,0xeb,0xe8,0xed,0xee,0xef,0xec,0xdf,0x21,0x24,0x2a,0x29,0x3b,0x5e,
0x2d,0x2f,0xc2,0xc4,0xc0,0xc1,0xc3,0xc5,0xc7,0xd1,0xa6,0x2c,0x25,0x5f,0x3e,0x3f,
0xf8,0xc9,0xca,0xcb,0xc8,0xcd,0xce,0xcf,0xcc,0x60,0x3a,0x23,0x40,0x27,0x3d,0x22,
0xd8,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0xab,0xbb,0xf0,0xfd,0xfe,0xb1,
0xb0,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0xaa,0xba,0xe6,0xb8,0xc6,0xa4,
0xb5,0x7e,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0xa1,0xbf,0xd0,0x5b,0xde,0xae,
0xac,0xa3,0xa5,0xb7,0xa9,0xa7,0xb6,0xbc,0xbd,0xbe,0xdd,0xa8,0xaf,0x5d,0xb4,0xd7,
0x7b,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0xad,0xf4,0xf6,0xf2,0xf3,0xf5,
0x7d,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0xb9,0xfb,0xfc,0xf9,0xfa,0xff,
0x5c,0xf7,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0xb2,0xd4,0xd6,0xd2,0xd3,0xd5,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0xb3,0xdb,0xdc,0xd9,0xda,0x9f,
};
const uint8_t PRIV(ascii_to_ebcdic_1047)[256] = {
#ifdef EBCDIC_NL25
0x00,0x01,0x02,0x03,0x37,0x2d,0x2e,0x2f,0x16,0x05,0x25,0x0b,0x0c,0x0d,0x0e,0x0f,
#else
0x00,0x01,0x02,0x03,0x37,0x2d,0x2e,0x2f,0x16,0x05,0x15,0x0b,0x0c,0x0d,0x0e,0x0f,
#endif
0x10,0x11,0x12,0x13,0x3c,0x3d,0x32,0x26,0x18,0x19,0x3f,0x27,0x1c,0x1d,0x1e,0x1f,
0x40,0x5a,0x7f,0x7b,0x5b,0x6c,0x50,0x7d,0x4d,0x5d,0x5c,0x4e,0x6b,0x60,0x4b,0x61,
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0x7a,0x5e,0x4c,0x7e,0x6e,0x6f,
0x7c,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,
0xd7,0xd8,0xd9,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xad,0xe0,0xbd,0x5f,0x6d,
0x79,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x91,0x92,0x93,0x94,0x95,0x96,
0x97,0x98,0x99,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xc0,0x4f,0xd0,0xa1,0x07,
#ifdef EBCDIC_NL25
0x20,0x21,0x22,0x23,0x24,0x15,0x06,0x17,0x28,0x29,0x2a,0x2b,0x2c,0x09,0x0a,0x1b,
#else
0x20,0x21,0x22,0x23,0x24,0x25,0x06,0x17,0x28,0x29,0x2a,0x2b,0x2c,0x09,0x0a,0x1b,
#endif
0x30,0x31,0x1a,0x33,0x34,0x35,0x36,0x08,0x38,0x39,0x3a,0x3b,0x04,0x14,0x3e,0xff,
0x41,0xaa,0x4a,0xb1,0x9f,0xb2,0x6a,0xb5,0xbb,0xb4,0x9a,0x8a,0xb0,0xca,0xaf,0xbc,
0x90,0x8f,0xea,0xfa,0xbe,0xa0,0xb6,0xb3,0x9d,0xda,0x9b,0x8b,0xb7,0xb8,0xb9,0xab,
0x64,0x65,0x62,0x66,0x63,0x67,0x9e,0x68,0x74,0x71,0x72,0x73,0x78,0x75,0x76,0x77,
0xac,0x69,0xed,0xee,0xeb,0xef,0xec,0xbf,0x80,0xfd,0xfe,0xfb,0xfc,0xba,0xae,0x59,
0x44,0x45,0x42,0x46,0x43,0x47,0x9c,0x48,0x54,0x51,0x52,0x53,0x58,0x55,0x56,0x57,
0x8c,0x49,0xcd,0xce,0xcb,0xcf,0xcc,0xe1,0x70,0xdd,0xde,0xdb,0xdc,0x8d,0x8e,0xdf,
};
#endif /* EBCDIC support needed */
/* End of pcre2_tables.c */

View file

@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This file contains tables of Unicode properties that are extracted from
Unicode data files. See the comments at the start of maint/GenerateUcd.py for
details.
@ -52,13 +53,13 @@ _pcre2_xxx to xxxx, thereby avoiding name clashes with the library. At present,
just one of these tables is actually needed. When compiling the library, some
headers are needed. */
#ifndef PCRE2_PCRE2TEST
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#endif /* PCRE2_PCRE2TEST */
/* The tables herein are needed only when UCP support is built, and in PCRE2
that happens automatically with UTF support. This module should not be
referenced otherwise, so it should not matter whether it is compiled or not.

View file

@ -1593,4 +1593,4 @@ const size_t PRIV(utt_size) = sizeof(PRIV(utt)) / sizeof(ucp_type_table);
#endif /* SUPPORT_UNICODE */
/* End of pcre2_ucptables.c */
/* End of pcre2_ucptables_inc.h */

View file

@ -71,6 +71,8 @@ side-effects. */
} while(0)
#endif
/* LCOV_EXCL_START */
/* PCRE2_UNREACHABLE() can be used to mark locations on the code that
shouldn't be reached. In non debug builds is defined as a hint for
the compiler to eliminate any code after it, so it is useful also for
@ -107,8 +109,16 @@ the reason and the actions that should be taken if it ever triggers. */
#define PCRE2_DEBUG_UNREACHABLE() PCRE2_UNREACHABLE()
/* LCOV_EXCL_STOP */
#endif /* PCRE2_DEBUG */
#ifndef PCRE2_ASSERT
#define PCRE2_ASSERT(x) do {} while(0)
#endif
/* LCOV_EXCL_START */
#ifndef PCRE2_DEBUG_UNREACHABLE
#define PCRE2_DEBUG_UNREACHABLE() do {} while(0)
#endif
@ -123,8 +133,45 @@ the reason and the actions that should be taken if it ever triggers. */
#endif
#endif /* !PCRE2_UNREACHABLE */
#ifndef PCRE2_ASSERT
#define PCRE2_ASSERT(x) do {} while(0)
/* LCOV_EXCL_STOP */
/* We define this fallthrough macro for suppressing -Wimplicit-fallthrough warnings.
Clang only allows this via an attribute, whereas other compilers (eg. GCC) match attributes
and also specially-formatted comments.
This macro should be used with no following semicolon, and ideally with a comment: */
// PCRE2_FALLTHROUGH /* Fall through */
#ifndef PCRE2_FALLTHROUGH
#if defined(__cplusplus) && __cplusplus >= 202002L && \
defined(__has_cpp_attribute)
/* Standards-compatible C++ variant. */
#if __has_cpp_attribute(fallthrough)
#define PCRE2_FALLTHROUGH [[fallthrough]];
#endif
#elif !defined(__cplusplus) && \
defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L && \
defined(__has_c_attribute)
/* Standards-compatible C variant. */
#if __has_c_attribute(fallthrough)
#define PCRE2_FALLTHROUGH [[fallthrough]];
#endif
#elif ((defined(__clang__) && __clang_major__ >= 10) || \
(defined(__GNUC__) && __GNUC__ >= 7)) && \
defined(__has_attribute)
/* Clang and GCC syntax. Rule out old versions because apparently Clang at
least has a broken implementation of __has_attribute. */
#if __has_attribute(fallthrough)
#define PCRE2_FALLTHROUGH __attribute__((fallthrough));
#endif
#endif
#endif /* !PCRE2_FALLTHROUGH */
#ifndef PCRE2_FALLTHROUGH
#define PCRE2_FALLTHROUGH
#endif
#endif /* PCRE2_UTIL_H_IDEMPOTENT_GUARD */

View file

@ -44,14 +44,13 @@ strings. This file is also #included by the pcre2test program, which uses
macros to change names from _pcre2_xxx to xxxx, thereby avoiding name clashes
with the library. In this case, PCRE2_PCRE2TEST is defined. */
#ifndef PCRE2_PCRE2TEST /* We're compiling the library */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
#endif /* PCRE2_PCRE2TEST */
#ifndef SUPPORT_UNICODE
/*************************************************
* Dummy function when Unicode is not supported *

View file

@ -38,18 +38,16 @@ POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
*/
/* This module contains two internal functions that are used to match
OP_XCLASS and OP_ECLASS. It is used by pcre2_auto_possessify() and by both
pcre2_match() and pcre2_dfa_match(). */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre2_internal.h"
/*************************************************
* Match character against an XCLASS *
*************************************************/
@ -252,9 +250,11 @@ if (*data == XCL_PROP || *data == XCL_NOTPROP)
/* This should never occur, but compilers may mutter if there is no
default. */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return FALSE;
/* LCOV_EXCL_STOP */
}
data += 2;
@ -529,9 +529,11 @@ while (ptr < data_end)
/* This should never occur, but compilers may mutter if there is no
default. */
/* LCOV_EXCL_START */
default:
PCRE2_DEBUG_UNREACHABLE();
return FALSE;
/* LCOV_EXCL_STOP */
}
}

View file

@ -41,18 +41,21 @@ POSSIBILITY OF SUCH DAMAGE.
/* This module is a wrapper that provides a POSIX API to the underlying PCRE2
functions. The functions are called pcre2_regcomp(), pcre2_regexec(), etc.
pcre2posix.h defines the POSIX names as macros for the corresonding pcre2_xxx
pcre2posix.h defines the POSIX names as macros for the corresponding pcre2_xxx
functions, so any program that includes it and uses the POSIX names will call
the PCRE2 implementations instead. */
#ifdef HAVE_CONFIG_H
/* This module doesn't use pcre2_internal.h, because the pcre2posix dynamic
library has an "internal" view of some macros, but is an "external" client of
the pcre2-8 dynamic library. This is unusual, and justifies a (rare) direct
inclusion of config.h. */
#if defined HAVE_CONFIG_H && !defined PCRE2_CONFIG_H_IDEMPOTENT_GUARD
#define PCRE2_CONFIG_H_IDEMPOTENT_GUARD
#include "config.h"
#endif
#ifdef PCRE2POSIX_SHARED
#undef PCRE2_STATIC
#endif
/* Ensure that the PCRE2POSIX_EXP_xxx macros are set appropriately for
@ -60,9 +63,24 @@ compiling these functions. This must come before including pcre2posix.h, where
they are set for an application (using these functions) if they have not
previously been set. */
#if defined(_WIN32) && (defined(PCRE2POSIX_SHARED) || !defined(PCRE2_STATIC))
# define PCRE2POSIX_EXP_DECL extern __declspec(dllexport)
# define PCRE2POSIX_EXP_DEFN __declspec(dllexport)
#if defined __cplusplus
#error This project uses C99. C++ is not supported.
#endif
#ifndef PCRE2POSIX_EXP_DECL
# if defined(_WIN32) && defined(PCRE2POSIX_SHARED)
# define PCRE2POSIX_EXP_DECL extern __declspec(dllexport)
# else
# define PCRE2POSIX_EXP_DECL extern PCRE2_EXPORT
# endif
#endif
#ifndef PCRE2POSIX_EXP_DEFN
# if defined(_WIN32) && defined(PCRE2POSIX_SHARED)
# define PCRE2POSIX_EXP_DEFN extern __declspec(dllexport)
# else
# define PCRE2POSIX_EXP_DEFN extern PCRE2_EXPORT
# endif
#endif
/* Older versions of MSVC lack snprintf(). This define allows for
@ -71,7 +89,6 @@ MSVC 10/2010. Except for VC6 (which is missing some fundamentals and fails). */
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#define BROKEN_SNPRINTF
#endif
@ -96,6 +113,13 @@ changed. This #define is a copy of the one in pcre2_internal.h. */
#include "pcre2posix.h"
#include "pcre2_util.h"
/* For pcre2_tables.c */
#define PCRE2_PCRE2POSIX
/* For pcre2_tables.c */
#define PRIV(name) name
#include "pcre2_tables.c"
/* Table to translate PCRE2 compile time error codes into POSIX error codes.
Only a few PCRE2 errors with a value greater than 23 turn into special POSIX
codes: most go to REG_BADPAT. The second table lists, in pairs, those that
@ -167,14 +191,6 @@ static const char *const pstring[] = {
"match failed" /* NOMATCH */
};
static int message_len(const char *message, int offset)
{
char buf[12];
/* 11 magic number comes from the format below */
return (int)strlen(message) + 11 + snprintf(buf, sizeof(buf), "%d", offset);
}
/*************************************************
* Translate error code to string *
*************************************************/
@ -183,66 +199,50 @@ PCRE2POSIX_EXP_DEFN size_t PCRE2_CALL_CONVENTION
pcre2_regerror(int errcode, const regex_t *preg, char *errbuf,
size_t errbuf_size)
{
int ret;
const char *message;
size_t len = 0; /* keeps 0 if snprintf is used */
char offset_buf[11+12]; /* big enough for " at offset -2147483648" */
int snprintf_rc, have_offset = 0;
PCRE2_SIZE i;
message = (errcode <= 0 || errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
"unknown error code" : pstring[errcode];
if (preg != NULL && (int)preg->re_erroffset != -1)
if (preg != NULL && preg->re_erroffset != (size_t)(-1)
/* LCOV_EXCL_START - snprintf failures here are essentially unreachable */
&& (snprintf_rc = snprintf(offset_buf, sizeof(offset_buf), " at offset %d",
(int)preg->re_erroffset)) > 0
&& snprintf_rc < (int)sizeof(offset_buf))
/* LCOV_EXCL_STOP */
{
/* no need to deal with UB in snprintf */
if (errbuf_size > INT_MAX) errbuf_size = INT_MAX;
/* there are 11 characters between message and offset;
update message_len() if changed */
ret = snprintf(errbuf, errbuf_size, "%s at offset %d", message,
(int)preg->re_erroffset);
}
else
{
len = strlen(message);
if (errbuf_size != 0)
{
strncpy(errbuf, message, errbuf_size);
if (errbuf_size <= len) errbuf[errbuf_size - 1] = '\0';
}
ret = (int)len;
have_offset = 1;
offset_buf[sizeof(offset_buf) - 1] = 0; /* Paranoia for very old snprintf */
}
PCRE2_ASSERT(len > 0 || preg != NULL);
for (i = 0; *message != 0; i++, message++)
if (i + 1 < errbuf_size) errbuf[i] = *message;
do {
if (ret < 0)
{
#ifdef BROKEN_SNPRINTF
/* _snprintf returns -1 on overflow and doesn't zero terminate */
if (!len)
{
if (ret == -1 && errbuf_size != 0) errbuf[errbuf_size - 1] = '\0';
if (have_offset)
{
for (message = offset_buf; *message != 0; i++, message++)
if (i + 1 < errbuf_size) errbuf[i] = *message;
}
ret = message_len(message, (int)preg->re_erroffset);
break;
}
#if defined EBCDIC && 'a' != 0x81
/* If compiling for EBCDIC, but the compiler's string literals are not EBCDIC,
then we are in the "force EBCDIC 1047" mode. I have chosen to add a few lines
here to translate the error strings on the fly, rather than require the string
literals above to be written out arduously using the "STR_XYZ" macros. */
for (PCRE2_SIZE j = 0; j < i && j < errbuf_size; ++j)
errbuf[j] = PRIV(ascii_to_ebcdic_1047)[(uint8_t)errbuf[j]];
#endif
/* snprintf failed, will use a 14 char long message if possible */
ret = 14;
if (errbuf_size != 0)
{
strncpy(errbuf, "internal error", errbuf_size);
if ((int)errbuf_size <= ret) errbuf[errbuf_size - 1] = '\0';
}
}
else if (ret == (int)errbuf_size && !len)
{
/* pre C99 snprintf returns used, so redo ret to fix that */
ret = message_len(message, (int)preg->re_erroffset);
}
} while (0);
/* Terminate message, even if truncated. */
return ret + 1;
if (errbuf_size > 0)
errbuf[(i < errbuf_size)? i : errbuf_size - 1] = 0;
i++;
return (int)i;
}
@ -283,6 +283,9 @@ int errorcode;
int options = 0;
int re_nsub = 0;
preg->re_match_data = NULL;
preg->re_pcre2_code = NULL;
patlen = ((cflags & REG_PEND) != 0)? (PCRE2_SIZE)(preg->re_endp - pattern) :
PCRE2_ZERO_TERMINATED;
@ -324,10 +327,14 @@ preg->re_erroffset = (size_t)(-1); /* No meaning after successful compile */
if (preg->re_match_data == NULL)
{
/* LCOV_EXCL_START */
/* There is no facility for passing a custom allocator to the POSIX API, so
our test code cannot force a malloc failure here. If there were an API to
customize the default (global) PCRE2 allocator, we could test it. Since the
code is nonetheless reachable, I prefer not to exclude it from coverage
reporting. */
pcre2_code_free(preg->re_pcre2_code);
preg->re_pcre2_code = NULL;
return REG_ESPACE;
/* LCOV_EXCL_STOP */
}
return 0;

View file

@ -118,41 +118,38 @@ typedef struct {
regoff_t rm_eo;
} regmatch_t;
/* When an application links to a PCRE2 DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
export settings are needed, and are set in pcre2posix.c before including this
file. So, we don't change existing definitions of PCRE2POSIX_EXP_DECL.
By default, we use the standard "extern" declarations. */
#ifndef PCRE2POSIX_EXP_DECL
# if defined(_WIN32) && defined(PCRE2POSIX_SHARED)
# define PCRE2POSIX_EXP_DECL extern __declspec(dllimport)
# elif defined __cplusplus
# define PCRE2POSIX_EXP_DECL extern "C"
# else
# define PCRE2POSIX_EXP_DECL extern
# endif
#endif
/* When compiling with the MSVC compiler, it is sometimes necessary to include
a "calling convention" before exported function names. (This is secondhand
information; I know nothing about MSVC myself). For example, something like
a "calling convention" before exported function names. For example:
void __cdecl function(....)
might be needed. In order to make this easy, all the exported functions have
PCRE2_CALL_CONVENTION just before their names. It is rarely needed; if not
set, we ensure here that it has no effect. */
PCRE2_CALL_CONVENTION just before their names.
PCRE2 normally uses the platform's standard calling convention, so this should
not be set unless you know you need it. */
#ifndef PCRE2_CALL_CONVENTION
#define PCRE2_CALL_CONVENTION
#endif
#ifndef PCRE2_EXPORT
#define PCRE2_EXPORT
#endif
/* When an application links to a PCRE2 DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
export settings are needed, and are set in pcre2posix.c before including this
file. */
/* By default, we use the standard "extern" declarations. */
#ifndef PCRE2POSIX_EXP_DECL
# if defined(_WIN32) && defined(PCRE2POSIX_SHARED) && !defined(PCRE2_STATIC)
# define PCRE2POSIX_EXP_DECL extern __declspec(dllimport)
# define PCRE2POSIX_EXP_DEFN __declspec(dllimport)
# else
# define PCRE2POSIX_EXP_DECL extern PCRE2_EXPORT
# define PCRE2POSIX_EXP_DEFN
# endif
#endif
/* The functions. The actual code is in functions with pcre2_xxx names for
uniqueness. POSIX names are provided as macros for API compatibility with POSIX
regex functions. It's done this way to ensure to they are always linked from

6349
libpcre/src/pcre2test_inc.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -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 <assert.h> 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 <minix/config.h> 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 <stdlib.h> 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 <strings.h> header file. */
#define HAVE_STRINGS_H 1
@ -905,7 +892,7 @@ sure both macros are undefined; an emulation function will then be used. */
#define PCRE2_EXPORT
#define LINK_SIZE 2
#define MAX_NAME_COUNT 10000
#define MAX_NAME_SIZE 32
#define MAX_NAME_SIZE 128
#define MATCH_LIMIT 10000000
#define HEAP_LIMIT 20000000
#define NEWLINE_DEFAULT 2
@ -1037,6 +1024,9 @@ PCRE2_CHKDINT.OBJ : PCRE2_CHKDINT.C
PCRE2_COMPILE.OBJ : PCRE2_COMPILE.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_COMPILE.OBJ : PCRE2_COMPILE_CGROUP.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_COMPILE.OBJ : PCRE2_COMPILE_CLASS.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
@ -1070,12 +1060,6 @@ PCRE2_FUZZSUPPORT.OBJ : PCRE2_FUZZSUPPORT.C
PCRE2_JIT_COMPILE.OBJ : PCRE2_JIT_COMPILE.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_JIT_MATCH.OBJ : PCRE2_JIT_MATCH.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_JIT_MISC.OBJ : PCRE2_JIT_MISC.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_JIT_TEST.OBJ : PCRE2_JIT_TEST.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
@ -1088,6 +1072,9 @@ PCRE2_MATCH.OBJ : PCRE2_MATCH.C
PCRE2_MATCH_DATA.OBJ : PCRE2_MATCH_DATA.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_MATCH_NEXT.OBJ : PCRE2_MATCH_NEXT.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_NEWLINE.OBJ : PCRE2_NEWLINE.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
@ -1097,9 +1084,6 @@ PCRE2_ORD2UTF.OBJ : PCRE2_ORD2UTF.C
PCRE2_PATTERN_INFO.OBJ : PCRE2_PATTERN_INFO.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_PRINTINT.OBJ : PCRE2_PRINTINT.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_SCRIPT_RUN.OBJ : PCRE2_SCRIPT_RUN.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
@ -1124,9 +1108,6 @@ PCRE2_TABLES.OBJ : PCRE2_TABLES.C
PCRE2_UCD.OBJ : PCRE2_UCD.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_UCPTABLES.OBJ : PCRE2_UCPTABLES.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)
PCRE2_VALID_UTF.OBJ : PCRE2_VALID_UTF.C
$(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)