From 896d4e8dc1a91f577231afef9d127b51d7cc3630 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sun, 9 Oct 2022 15:35:58 -0600 Subject: [PATCH] LibRegex: Don't build LibRegex/C/Regex.cpp on Lagom This file implements the POSIX APIs from , and is not suitable for inclusion in a Lagom build. If we do include it, it will override the host's regex functions and wreak havoc if it's resolved before the host's implementation. --- Meta/Lagom/CMakeLists.txt | 3 +-- Userland/Libraries/LibRegex/C/Regex.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 9dfe03e4d3..ac6db3051d 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -482,10 +482,9 @@ if (BUILD_LAGOM) ) # Regex - file(GLOB LIBREGEX_LIBC_SOURCES "../../Userland/Libraries/LibRegex/C/Regex.cpp") file(GLOB LIBREGEX_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibRegex/*.cpp") lagom_lib(Regex regex - SOURCES ${LIBREGEX_SOURCES} ${LIBREGEX_LIBC_SOURCES} + SOURCES ${LIBREGEX_SOURCES} LIBS LibUnicode ) diff --git a/Userland/Libraries/LibRegex/C/Regex.cpp b/Userland/Libraries/LibRegex/C/Regex.cpp index 28d93d5da6..b9a76394cc 100644 --- a/Userland/Libraries/LibRegex/C/Regex.cpp +++ b/Userland/Libraries/LibRegex/C/Regex.cpp @@ -6,19 +6,17 @@ #include #include +#include #include #include +#include #include #include -#ifdef __serenity__ -# include -#else -# include +#ifndef AK_OS_SERENITY +# error "This file is intended for use on Serenity only to implement POSIX regex.h" #endif -#include - struct internal_regex_t { u8 cflags; u8 eflags;