From 4a63e4a27e761cae000d83b587180325096a1a0c Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 10 Dec 2023 06:08:25 -0800 Subject: [PATCH] Reduce header complexity of PCRE2 --- third_party/pcre/pcre2.h | 4 ---- third_party/pcre/pcre2_compile.c | 2 ++ third_party/pcre/pcre2_config.c | 1 + third_party/pcre/pcre2_context.c | 3 +++ third_party/pcre/pcre2_convert.c | 2 ++ third_party/pcre/pcre2_dfa_match.c | 2 ++ third_party/pcre/pcre2_internal.h | 12 +----------- third_party/pcre/pcre2_maketables.c | 2 ++ third_party/pcre/pcre2_match.c | 2 ++ third_party/pcre/pcre2_script_run.c | 2 ++ third_party/pcre/pcre2_serialize.c | 2 ++ third_party/pcre/pcre2_study.c | 2 ++ third_party/pcre/pcre2_substitute.c | 2 ++ third_party/pcre/pcre2_substring.c | 2 ++ 14 files changed, 25 insertions(+), 15 deletions(-) diff --git a/third_party/pcre/pcre2.h b/third_party/pcre/pcre2.h index 33255497e..52c7722c8 100644 --- a/third_party/pcre/pcre2.h +++ b/third_party/pcre/pcre2.h @@ -91,10 +91,6 @@ not have stdint.h, which is why we use inttypes.h, which according to the C standard is a superset of stdint.h. If inttypes.h is not available the build will break and the relevant values must be provided by some other means. */ -#include -#include -#include - /* Allow for C++ users compiling this directly. */ #ifdef __cplusplus diff --git a/third_party/pcre/pcre2_compile.c b/third_party/pcre/pcre2_compile.c index 2d2a660fb..fb910ed8e 100644 --- a/third_party/pcre/pcre2_compile.c +++ b/third_party/pcre/pcre2_compile.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + asm(".ident\t\"\\n\\n\ PCRE2 (PCRE2 License)\\n\ Copyright (c) 1997-2022 University of Cambridge\""); diff --git a/third_party/pcre/pcre2_config.c b/third_party/pcre/pcre2_config.c index 5ef103caf..e43138cbd 100644 --- a/third_party/pcre/pcre2_config.c +++ b/third_party/pcre/pcre2_config.c @@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H +#include "libc/str/str.h" #include "config.h" #endif diff --git a/third_party/pcre/pcre2_context.c b/third_party/pcre/pcre2_context.c index 8e05ede50..9788a6336 100644 --- a/third_party/pcre/pcre2_context.c +++ b/third_party/pcre/pcre2_context.c @@ -1,3 +1,6 @@ +#include "libc/mem/mem.h" +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_convert.c b/third_party/pcre/pcre2_convert.c index 36466e4b9..79d7ce86a 100644 --- a/third_party/pcre/pcre2_convert.c +++ b/third_party/pcre/pcre2_convert.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_dfa_match.c b/third_party/pcre/pcre2_dfa_match.c index b16e594cc..139dc4ca6 100644 --- a/third_party/pcre/pcre2_dfa_match.c +++ b/third_party/pcre/pcre2_dfa_match.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_internal.h b/third_party/pcre/pcre2_internal.h index 92dd3138d..2417268b4 100644 --- a/third_party/pcre/pcre2_internal.h +++ b/third_party/pcre/pcre2_internal.h @@ -53,13 +53,6 @@ pcre2test.c with CODE_UNIT_WIDTH == 0. */ /* Standard C headers */ -#include -#include -#include -#include -#include -#include - /* Macros to make boolean values more obvious. The #ifndef is to pacify compiler warnings in environments where these macros are defined elsewhere. Unfortunately, there is no way to do the same for the typedef. */ @@ -72,10 +65,6 @@ typedef int BOOL; /* Valgrind (memcheck) support */ -#ifdef SUPPORT_VALGRIND -#include -#endif - /* -ftrivial-auto-var-init support supports initializing all local variables to avoid some classes of bug, but this can cause an unacceptable slowdown for large on-stack arrays in hot functions. This macro lets us annotate @@ -140,6 +129,7 @@ only if it is not already set. */ /* Include the public PCRE2 header and the definitions of UCP character property values. This must follow the setting of PCRE2_EXP_DECL above. */ +#include "libc/limits.h" #include "pcre2.h" #include "pcre2_ucp.h" diff --git a/third_party/pcre/pcre2_maketables.c b/third_party/pcre/pcre2_maketables.c index 56d249402..ab0aa5d6e 100644 --- a/third_party/pcre/pcre2_maketables.c +++ b/third_party/pcre/pcre2_maketables.c @@ -1,6 +1,8 @@ /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ +#include "libc/str/str.h" +#include "libc/mem/mem.h" /* 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. diff --git a/third_party/pcre/pcre2_match.c b/third_party/pcre/pcre2_match.c index 9bef858e9..606a850c3 100644 --- a/third_party/pcre/pcre2_match.c +++ b/third_party/pcre/pcre2_match.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + asm(".ident\t\"\\n\\n\ PCRE2 (PCRE2 License)\\n\ Copyright (c) 1997-2022 University of Cambridge\""); diff --git a/third_party/pcre/pcre2_script_run.c b/third_party/pcre/pcre2_script_run.c index 4926fa63b..3434c3c98 100644 --- a/third_party/pcre/pcre2_script_run.c +++ b/third_party/pcre/pcre2_script_run.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_serialize.c b/third_party/pcre/pcre2_serialize.c index ba17a26d2..c333810d6 100644 --- a/third_party/pcre/pcre2_serialize.c +++ b/third_party/pcre/pcre2_serialize.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_study.c b/third_party/pcre/pcre2_study.c index 4db3ad118..2b582dd04 100644 --- a/third_party/pcre/pcre2_study.c +++ b/third_party/pcre/pcre2_study.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_substitute.c b/third_party/pcre/pcre2_substitute.c index edbb78c6d..8a20ed649 100644 --- a/third_party/pcre/pcre2_substitute.c +++ b/third_party/pcre/pcre2_substitute.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/ diff --git a/third_party/pcre/pcre2_substring.c b/third_party/pcre/pcre2_substring.c index ddf5774e1..c7c3f8291 100644 --- a/third_party/pcre/pcre2_substring.c +++ b/third_party/pcre/pcre2_substring.c @@ -1,3 +1,5 @@ +#include "libc/str/str.h" + /************************************************* * Perl-Compatible Regular Expressions * *************************************************/