Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: c03da2aff75733861e203e104ffe9315951cb6f3 https://github.com/Perl/perl5/commit/c03da2aff75733861e203e104ffe9315951cb6f3 Author: Lukas Mai <lukasmai....@gmail.com> Date: 2025-02-28 (Fri, 28 Feb 2025)
Changed paths: M MANIFEST M Makefile.SH M charclass_invlists.h M lib/unicore/uni_keywords.pl M perl.h M regen/mk_invlists.pl M regexp.h A regexp_constants.h M t/porting/regen.t M uni_keywords.h Log Message: ----------- perl.h: don't include charclass_invlists.h indiscriminately charclass_invlists.h is a generated file with a lot of code (4.5 MB). The vast majority of this code is skipped (masked by #ifdef .. #endif), but since perl.h includes it, the preprocessor has to slog through all 4.5 MB every time a *.c core file is compiled, slowing down the build. This also affects XS modules, which normally include perl.h. This commit rearranges things a bit in order to speed up compilation. For details, see below. Conceptually speaking, charclass_invlists.h consists of 4 parts: 1. Code only active in regcomp.c 2. Code only active in regexec.c 3. Code only active in utf8.c 4. Other code (always active) As it turns out, part 4 consists of two constants (NUM_ANYOF_CODE_POINTS and MAX_FOLD_FROMS) and nothing else. Furthermore, these are only needed in regexp.h. This commit splits off part 4 into a new header file (regexp_constants.h), which (like charclass_invlists.h) is generated by regen/mk_invlists.pl and included by regexp.h, its only consumer. Ideally, the rest of charclass_invlists.h (parts 1-3) should not be included in perl.h, but only in regcomp.c/regexec.c/utf8.c. However, this causes problems in practice: The generated code uses symbols like NULL, U8, or U32, so it cannot be included before perl.h, but it defines types that are needed by other headers (proto.h), so it cannot be included after perl.h either. I couldn't figure out how to disentangle this sanely, so now perl.h still includes charclass_invlists.h, but hidden behind an #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) guard. This way most consumers of perl.h will never have to touch charclass_invlists.h. Fixes #22678. To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications