Files
Jeff Bailey 3c532a4fe1 [libc] Add POSIX regex stub implementation and build infrastructure (#196995)
Added the four POSIX regex entrypoints (regcomp, regexec, regerror,
regfree) and registered them for x86_64, aarch64, riscv, and arm.
regerror is fully implemented with all 13 POSIX error code strings. The
other three are stubs backed by simple string matching to validate the
build pipeline end-to-end.

This implementation is restricted to full-build mode
(LLVM_LIBC_FULL_BUILD) to avoid ABI compatibility risks with system
headers and internal state management in overlay mode.

New files:
* include/regex.yaml and regex-macros.h for header generation
* regex_t, regoff_t, regmatch_t type headers
* src/regex/ with all four entrypoints
* test/src/regex/ with regerror and basic round-trip tests

All 7 tests pass.
2026-05-18 16:15:18 +01:00

83 lines
2.0 KiB
YAML

header: regex.h
standards:
- posix
macros:
- macro_name: REG_EXTENDED
macro_header: regex-macros.h
- macro_name: REG_ICASE
macro_header: regex-macros.h
- macro_name: REG_NOSUB
macro_header: regex-macros.h
- macro_name: REG_NEWLINE
macro_header: regex-macros.h
- macro_name: REG_NOTBOL
macro_header: regex-macros.h
- macro_name: REG_NOTEOL
macro_header: regex-macros.h
- macro_name: REG_NOMATCH
macro_header: regex-macros.h
- macro_name: REG_BADPAT
macro_header: regex-macros.h
- macro_name: REG_ECOLLATE
macro_header: regex-macros.h
- macro_name: REG_ECTYPE
macro_header: regex-macros.h
- macro_name: REG_EESCAPE
macro_header: regex-macros.h
- macro_name: REG_ESUBREG
macro_header: regex-macros.h
- macro_name: REG_EBRACK
macro_header: regex-macros.h
- macro_name: REG_EPAREN
macro_header: regex-macros.h
- macro_name: REG_EBRACE
macro_header: regex-macros.h
- macro_name: REG_BADBR
macro_header: regex-macros.h
- macro_name: REG_ERANGE
macro_header: regex-macros.h
- macro_name: REG_ESPACE
macro_header: regex-macros.h
- macro_name: REG_BADRPT
macro_header: regex-macros.h
types:
- type_name: regex_t
- type_name: regmatch_t
- type_name: regoff_t
enums: []
objects: []
functions:
- name: regcomp
standards:
- posix
return_type: int
arguments:
- type: regex_t *__restrict
- type: const char *__restrict
- type: int
- name: regexec
standards:
- posix
return_type: int
arguments:
- type: const regex_t *__restrict
- type: const char *__restrict
- type: size_t
- type: regmatch_t *__restrict
- type: int
- name: regerror
standards:
- posix
return_type: size_t
arguments:
- type: int
- type: const regex_t *__restrict
- type: char *__restrict
- type: size_t
- name: regfree
standards:
- posix
return_type: void
arguments:
- type: regex_t *