0001-regcomp-c-regexec-c-fixup-regex-engine-build-under-Uusedl.patch 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. From ba6e2c38aafc23cf114f3ba0d0ff3baead34328b Mon Sep 17 00:00:00 2001
  2. From: Yves Orton <demerphq@gmail.com>
  3. Date: Tue, 1 Aug 2023 23:12:46 +0200
  4. Subject: [PATCH] regcomp*.c, regexec.c - fixup regex engine build under
  5. -Uusedl
  6. The regex engine is built a bit different from most of the perl
  7. codebase. It is compiled as part of the main libperl.so and it is
  8. also compiled (with DEBUGGING enabled) as part of the re extension.
  9. When perl itself is compiled with DEBUGGING enabled then the code
  10. in the re.so extension and the code in libperl.so is the same.
  11. This all works fine and dandy until you have a static build where the
  12. re.so is linked into libperl.so, which results in duplicate symbols
  13. being defined. These symbols come in two flaviours: "auxiliary" and
  14. "debugging" related symbols.
  15. We have basically three cases:
  16. 1. USE_DYNAMIC_LOADING is defined. In this case we are doing a dynamic
  17. build and re.so will be separate from libperl.so, so it even if this
  18. is a DEBUGGING enabled build debug and auxiliary functions can be
  19. compiled into *both* re.so and libperl.so. This is basically the
  20. "standard build".
  21. 2. USE_DYNAMIC_LOADING is not defined, and DEBUGGING is not defined
  22. either. In this case auxiliary functions should only be compiled in
  23. libperl.so, and the debug functions should only be compiled into
  24. re.so
  25. 3. USE_DYNAMIC_LOADING is not defined, and DEBUGGING *is* defined. In
  26. this case auxiliary functions AND debug functions should only be
  27. compiled into libperl.so
  28. It is possible to detect the different build options by looking at the
  29. defines 'USE_DYNAMIC_LOADING', 'PERL_EXT_RE_DEBUG' and
  30. 'DEBUGGING_RE_ONLY'. 'USE_DYNAMIC_LOADING' is NOT defined when we are
  31. building a static perl. 'PERL_EXT_RE_DEBUG' is defined only when we are
  32. building re.so, and 'DEBUGGING_RE_ONLY' is defined only when we are
  33. building re.so in a perl that is not itself already a DEBUGGING enabled
  34. perl. The file ext/re/re_top.h responsible for setting up
  35. DEBUGGING_RE_ONLY.
  36. This patch uses 'PERL_EXT_RE_DEBUG', 'DEBUGGING_RE_ONLY' and
  37. 'USE_DYNAMIC_LOADING' to define in regcomp.h two further define flags
  38. 'PERL_RE_BUILD_DEBUG' and 'PERL_RE_BUILD_AUX'.
  39. The 'PERL_RE_BUILD_DEBUG' flag determines if the debugging functions
  40. should be compiled into libperl.so or re.so or both. The
  41. 'PERL_RE_BUILD_AUX' flag determines if the auxiliary functions should be
  42. compiled into just libperl.so or into it and re.so. We then use these
  43. flags to guard the different types of functions so that we can build in
  44. all three modes without duplicate symbols.
  45. Upstream: https://github.com/Perl/perl5/commit/ba6e2c38aafc23cf114f3ba0d0ff3baead34328b
  46. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  47. ---
  48. regcomp.c | 13 +-
  49. regcomp.h | 14 ++-
  50. regcomp_debug.c | 308 +++++++++++++++++++++++-----------------------
  51. regcomp_invlist.c | 3 +-
  52. regexec.c | 3 +-
  53. 5 files changed, 181 insertions(+), 160 deletions(-)
  54. diff --git a/regcomp.c b/regcomp.c
  55. index d3c135fbfad1..6e35d95d2ac6 100644
  56. --- a/regcomp.c
  57. +++ b/regcomp.c
  58. @@ -290,6 +290,7 @@ S_edit_distance(const UV* src,
  59. /* END of edit_distance() stuff
  60. * ========================================================= */
  61. +#ifdef PERL_RE_BUILD_AUX
  62. /* add a data member to the struct reg_data attached to this regex, it should
  63. * always return a non-zero return. the 's' argument is the type of the items
  64. * being added and the n is the number of items. The length of 's' should match
  65. @@ -340,6 +341,7 @@ Perl_reg_add_data(RExC_state_t* const pRExC_state, const char* const s, const U3
  66. assert(count>0);
  67. return count;
  68. }
  69. +#endif /* PERL_RE_BUILD_AUX */
  70. /*XXX: todo make this not included in a non debugging perl, but appears to be
  71. * used anyway there, in 'use re' */
  72. @@ -7443,6 +7445,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
  73. }
  74. +#ifdef PERL_RE_BUILD_AUX
  75. void
  76. Perl_populate_anyof_bitmap_from_invlist(pTHX_ regnode *node, SV** invlist_ptr)
  77. {
  78. @@ -7502,6 +7505,7 @@ Perl_populate_anyof_bitmap_from_invlist(pTHX_ regnode *node, SV** invlist_ptr)
  79. }
  80. }
  81. }
  82. +#endif /* PERL_RE_BUILD_AUX */
  83. /* Parse POSIX character classes: [[:foo:]], [[=foo=]], [[.foo.]].
  84. Character classes ([:foo:]) can also be negated ([:^foo:]).
  85. @@ -9095,6 +9099,7 @@ S_dump_regex_sets_structures(pTHX_ RExC_state_t *pRExC_state,
  86. #undef IS_OPERATOR
  87. #undef IS_OPERAND
  88. +#ifdef PERL_RE_BUILD_AUX
  89. void
  90. Perl_add_above_Latin1_folds(pTHX_ RExC_state_t *pRExC_state, const U8 cp, SV** invlist)
  91. {
  92. @@ -9182,6 +9187,8 @@ Perl_add_above_Latin1_folds(pTHX_ RExC_state_t *pRExC_state, const U8 cp, SV** i
  93. }
  94. }
  95. }
  96. +#endif /* PERL_RE_BUILD_AUX */
  97. +
  98. STATIC void
  99. S_output_posix_warnings(pTHX_ RExC_state_t *pRExC_state, AV* posix_warnings)
  100. @@ -12105,6 +12112,7 @@ S_optimize_regclass(pTHX_
  101. #undef HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION
  102. +#ifdef PERL_RE_BUILD_AUX
  103. void
  104. Perl_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state,
  105. regnode* const node,
  106. @@ -12261,6 +12269,7 @@ Perl_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state,
  107. RExC_rxi->data->data[n] = (void*)rv;
  108. ARG1u_SET(node, n);
  109. }
  110. +#endif /* PERL_RE_BUILD_AUX */
  111. SV *
  112. @@ -12999,6 +13008,8 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode_offset p,
  113. }
  114. #endif
  115. +
  116. +#ifdef PERL_RE_BUILD_AUX
  117. SV*
  118. Perl_get_ANYOFM_contents(pTHX_ const regnode * n) {
  119. @@ -13047,7 +13058,7 @@ Perl_get_ANYOFHbbm_contents(pTHX_ const regnode * n) {
  120. UTF_CONTINUATION_MARK | 0));
  121. return cp_list;
  122. }
  123. -
  124. +#endif /* PERL_RE_BUILD_AUX */
  125. SV *
  126. diff --git a/regcomp.h b/regcomp.h
  127. index 31c91e6a68e8..017a9f843514 100644
  128. --- a/regcomp.h
  129. +++ b/regcomp.h
  130. @@ -1554,7 +1554,19 @@ typedef enum {
  131. #define EVAL_OPTIMISTIC_FLAG 128
  132. #define EVAL_FLAGS_MASK (EVAL_OPTIMISTIC_FLAG-1)
  133. -
  134. +/* We define PERL_RE_BUILD_DEBUG if we are NOT compiling the re extension and
  135. + * we are under DEBUGGING, or if we are ARE compiling the re extension
  136. + * and this is not a DEBUGGING enabled build (identified by
  137. + * DEBUGGING_RE_ONLY being defined)
  138. + */
  139. +#if ( defined(USE_DYNAMIC_LOADING) && defined(DEBUGGING)) || \
  140. + ( defined(PERL_EXT_RE_BUILD) && defined(DEBUGGING_RE_ONLY)) || \
  141. + (!defined(PERL_EXT_RE_BUILD) && defined(DEBUGGING))
  142. +#define PERL_RE_BUILD_DEBUG
  143. +#endif
  144. +#if ( defined(USE_DYNAMIC_LOADING) || !defined(PERL_EXT_RE_BUILD) )
  145. +#define PERL_RE_BUILD_AUX
  146. +#endif
  147. #endif /* PERL_REGCOMP_H_ */
  148. diff --git a/regcomp_debug.c b/regcomp_debug.c
  149. index 93db7a89cf48..96598c49c0bc 100644
  150. --- a/regcomp_debug.c
  151. +++ b/regcomp_debug.c
  152. @@ -18,8 +18,7 @@
  153. #include "unicode_constants.h"
  154. #include "regcomp_internal.h"
  155. -#ifdef DEBUGGING
  156. -
  157. +#ifdef PERL_RE_BUILD_DEBUG
  158. int
  159. Perl_re_printf(pTHX_ const char *fmt, ...)
  160. {
  161. @@ -159,13 +158,160 @@ Perl_debug_peep(pTHX_ const char *str, const RExC_state_t *pRExC_state,
  162. });
  163. }
  164. -#endif /* DEBUGGING */
  165. +const regnode *
  166. +Perl_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
  167. + const regnode *last, const regnode *plast,
  168. + SV* sv, I32 indent, U32 depth)
  169. +{
  170. + const regnode *next;
  171. + const regnode *optstart= NULL;
  172. +
  173. + RXi_GET_DECL(r, ri);
  174. + DECLARE_AND_GET_RE_DEBUG_FLAGS;
  175. +
  176. + PERL_ARGS_ASSERT_DUMPUNTIL;
  177. +
  178. +#ifdef DEBUG_DUMPUNTIL
  179. + Perl_re_printf( aTHX_ "--- %d : %d - %d - %d\n", indent, node-start,
  180. + last ? last-start : 0, plast ? plast-start : 0);
  181. +#endif
  182. +
  183. + if (plast && plast < last)
  184. + last= plast;
  185. +
  186. + while (node && (!last || node < last)) {
  187. + const U8 op = OP(node);
  188. +
  189. + if (op == CLOSE || op == SRCLOSE || op == WHILEM)
  190. + indent--;
  191. + next = regnext((regnode *)node);
  192. + const regnode *after = regnode_after((regnode *)node,0);
  193. +
  194. + /* Where, what. */
  195. + if (op == OPTIMIZED) {
  196. + if (!optstart && RE_DEBUG_FLAG(RE_DEBUG_COMPILE_OPTIMISE))
  197. + optstart = node;
  198. + else
  199. + goto after_print;
  200. + } else
  201. + CLEAR_OPTSTART;
  202. +
  203. + regprop(r, sv, node, NULL, NULL);
  204. + Perl_re_printf( aTHX_ "%4" IVdf ":%*s%s", (IV)(node - start),
  205. + (int)(2*indent + 1), "", SvPVX_const(sv));
  206. +
  207. + if (op != OPTIMIZED) {
  208. + if (next == NULL) /* Next ptr. */
  209. + Perl_re_printf( aTHX_ " (0)");
  210. + else if (REGNODE_TYPE(op) == BRANCH
  211. + && REGNODE_TYPE(OP(next)) != BRANCH )
  212. + Perl_re_printf( aTHX_ " (FAIL)");
  213. + else
  214. + Perl_re_printf( aTHX_ " (%" IVdf ")", (IV)(next - start));
  215. + Perl_re_printf( aTHX_ "\n");
  216. + }
  217. +
  218. + after_print:
  219. + if (REGNODE_TYPE(op) == BRANCHJ) {
  220. + assert(next);
  221. + const regnode *nnode = (OP(next) == LONGJMP
  222. + ? regnext((regnode *)next)
  223. + : next);
  224. + if (last && nnode > last)
  225. + nnode = last;
  226. + DUMPUNTIL(after, nnode);
  227. + }
  228. + else if (REGNODE_TYPE(op) == BRANCH) {
  229. + assert(next);
  230. + DUMPUNTIL(after, next);
  231. + }
  232. + else if ( REGNODE_TYPE(op) == TRIE ) {
  233. + const regnode *this_trie = node;
  234. + const U32 n = ARG1u(node);
  235. + const reg_ac_data * const ac = op>=AHOCORASICK ?
  236. + (reg_ac_data *)ri->data->data[n] :
  237. + NULL;
  238. + const reg_trie_data * const trie =
  239. + (reg_trie_data*)ri->data->data[op<AHOCORASICK ? n : ac->trie];
  240. +#ifdef DEBUGGING
  241. + AV *const trie_words
  242. + = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]);
  243. +#endif
  244. + const regnode *nextbranch= NULL;
  245. + I32 word_idx;
  246. + SvPVCLEAR(sv);
  247. + for (word_idx= 0; word_idx < (I32)trie->wordcount; word_idx++) {
  248. + SV ** const elem_ptr = av_fetch_simple(trie_words, word_idx, 0);
  249. +
  250. + Perl_re_indentf( aTHX_ "%s ",
  251. + indent+3,
  252. + elem_ptr
  253. + ? pv_pretty(sv, SvPV_nolen_const(*elem_ptr),
  254. + SvCUR(*elem_ptr), PL_dump_re_max_len,
  255. + PL_colors[0], PL_colors[1],
  256. + (SvUTF8(*elem_ptr)
  257. + ? PERL_PV_ESCAPE_UNI
  258. + : 0)
  259. + | PERL_PV_PRETTY_ELLIPSES
  260. + | PERL_PV_PRETTY_LTGT
  261. + )
  262. + : "???"
  263. + );
  264. + if (trie->jump) {
  265. + U16 dist= trie->jump[word_idx+1];
  266. + Perl_re_printf( aTHX_ "(%" UVuf ")\n",
  267. + (UV)((dist ? this_trie + dist : next) - start));
  268. + if (dist) {
  269. + if (!nextbranch)
  270. + nextbranch= this_trie + trie->jump[0];
  271. + DUMPUNTIL(this_trie + dist, nextbranch);
  272. + }
  273. + if (nextbranch && REGNODE_TYPE(OP(nextbranch))==BRANCH)
  274. + nextbranch= regnext((regnode *)nextbranch);
  275. + } else {
  276. + Perl_re_printf( aTHX_ "\n");
  277. + }
  278. + }
  279. + if (last && next > last)
  280. + node= last;
  281. + else
  282. + node= next;
  283. + }
  284. + else if ( op == CURLY ) { /* "next" might be very big: optimizer */
  285. + DUMPUNTIL(after, after + 1); /* +1 is NOT a REGNODE_AFTER */
  286. + }
  287. + else if (REGNODE_TYPE(op) == CURLY && op != CURLYX) {
  288. + assert(next);
  289. + DUMPUNTIL(after, next);
  290. + }
  291. + else if ( op == PLUS || op == STAR) {
  292. + DUMPUNTIL(after, after + 1); /* +1 NOT a REGNODE_AFTER */
  293. + }
  294. + else if (REGNODE_TYPE(op) == EXACT || op == ANYOFHs) {
  295. + /* Literal string, where present. */
  296. + node = (const regnode *)REGNODE_AFTER_varies(node);
  297. + }
  298. + else {
  299. + node = REGNODE_AFTER_opcode(node,op);
  300. + }
  301. + if (op == CURLYX || op == OPEN || op == SROPEN)
  302. + indent++;
  303. + if (REGNODE_TYPE(op) == END)
  304. + break;
  305. + }
  306. + CLEAR_OPTSTART;
  307. +#ifdef DEBUG_DUMPUNTIL
  308. + Perl_re_printf( aTHX_ "--- %d\n", (int)indent);
  309. +#endif
  310. + return node;
  311. +}
  312. +
  313. +#endif /* PERL_RE_BUILD_DEBUG */
  314. /*
  315. - regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form
  316. */
  317. #ifdef DEBUGGING
  318. -
  319. static void
  320. S_regdump_intflags(pTHX_ const char *lead, const U32 flags)
  321. {
  322. @@ -907,8 +1053,8 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
  323. #endif /* DEBUGGING */
  324. }
  325. -#ifdef DEBUGGING
  326. +#ifdef DEBUGGING
  327. STATIC void
  328. S_put_code_point(pTHX_ SV *sv, UV c)
  329. {
  330. @@ -1517,154 +1663,4 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv,
  331. return did_output_something;
  332. }
  333. -
  334. -
  335. -const regnode *
  336. -Perl_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
  337. - const regnode *last, const regnode *plast,
  338. - SV* sv, I32 indent, U32 depth)
  339. -{
  340. - const regnode *next;
  341. - const regnode *optstart= NULL;
  342. -
  343. - RXi_GET_DECL(r, ri);
  344. - DECLARE_AND_GET_RE_DEBUG_FLAGS;
  345. -
  346. - PERL_ARGS_ASSERT_DUMPUNTIL;
  347. -
  348. -#ifdef DEBUG_DUMPUNTIL
  349. - Perl_re_printf( aTHX_ "--- %d : %d - %d - %d\n", indent, node-start,
  350. - last ? last-start : 0, plast ? plast-start : 0);
  351. -#endif
  352. -
  353. - if (plast && plast < last)
  354. - last= plast;
  355. -
  356. - while (node && (!last || node < last)) {
  357. - const U8 op = OP(node);
  358. -
  359. - if (op == CLOSE || op == SRCLOSE || op == WHILEM)
  360. - indent--;
  361. - next = regnext((regnode *)node);
  362. - const regnode *after = regnode_after((regnode *)node,0);
  363. -
  364. - /* Where, what. */
  365. - if (op == OPTIMIZED) {
  366. - if (!optstart && RE_DEBUG_FLAG(RE_DEBUG_COMPILE_OPTIMISE))
  367. - optstart = node;
  368. - else
  369. - goto after_print;
  370. - } else
  371. - CLEAR_OPTSTART;
  372. -
  373. - regprop(r, sv, node, NULL, NULL);
  374. - Perl_re_printf( aTHX_ "%4" IVdf ":%*s%s", (IV)(node - start),
  375. - (int)(2*indent + 1), "", SvPVX_const(sv));
  376. -
  377. - if (op != OPTIMIZED) {
  378. - if (next == NULL) /* Next ptr. */
  379. - Perl_re_printf( aTHX_ " (0)");
  380. - else if (REGNODE_TYPE(op) == BRANCH
  381. - && REGNODE_TYPE(OP(next)) != BRANCH )
  382. - Perl_re_printf( aTHX_ " (FAIL)");
  383. - else
  384. - Perl_re_printf( aTHX_ " (%" IVdf ")", (IV)(next - start));
  385. - Perl_re_printf( aTHX_ "\n");
  386. - }
  387. -
  388. - after_print:
  389. - if (REGNODE_TYPE(op) == BRANCHJ) {
  390. - assert(next);
  391. - const regnode *nnode = (OP(next) == LONGJMP
  392. - ? regnext((regnode *)next)
  393. - : next);
  394. - if (last && nnode > last)
  395. - nnode = last;
  396. - DUMPUNTIL(after, nnode);
  397. - }
  398. - else if (REGNODE_TYPE(op) == BRANCH) {
  399. - assert(next);
  400. - DUMPUNTIL(after, next);
  401. - }
  402. - else if ( REGNODE_TYPE(op) == TRIE ) {
  403. - const regnode *this_trie = node;
  404. - const U32 n = ARG1u(node);
  405. - const reg_ac_data * const ac = op>=AHOCORASICK ?
  406. - (reg_ac_data *)ri->data->data[n] :
  407. - NULL;
  408. - const reg_trie_data * const trie =
  409. - (reg_trie_data*)ri->data->data[op<AHOCORASICK ? n : ac->trie];
  410. -#ifdef DEBUGGING
  411. - AV *const trie_words
  412. - = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]);
  413. -#endif
  414. - const regnode *nextbranch= NULL;
  415. - I32 word_idx;
  416. - SvPVCLEAR(sv);
  417. - for (word_idx= 0; word_idx < (I32)trie->wordcount; word_idx++) {
  418. - SV ** const elem_ptr = av_fetch_simple(trie_words, word_idx, 0);
  419. -
  420. - Perl_re_indentf( aTHX_ "%s ",
  421. - indent+3,
  422. - elem_ptr
  423. - ? pv_pretty(sv, SvPV_nolen_const(*elem_ptr),
  424. - SvCUR(*elem_ptr), PL_dump_re_max_len,
  425. - PL_colors[0], PL_colors[1],
  426. - (SvUTF8(*elem_ptr)
  427. - ? PERL_PV_ESCAPE_UNI
  428. - : 0)
  429. - | PERL_PV_PRETTY_ELLIPSES
  430. - | PERL_PV_PRETTY_LTGT
  431. - )
  432. - : "???"
  433. - );
  434. - if (trie->jump) {
  435. - U16 dist= trie->jump[word_idx+1];
  436. - Perl_re_printf( aTHX_ "(%" UVuf ")\n",
  437. - (UV)((dist ? this_trie + dist : next) - start));
  438. - if (dist) {
  439. - if (!nextbranch)
  440. - nextbranch= this_trie + trie->jump[0];
  441. - DUMPUNTIL(this_trie + dist, nextbranch);
  442. - }
  443. - if (nextbranch && REGNODE_TYPE(OP(nextbranch))==BRANCH)
  444. - nextbranch= regnext((regnode *)nextbranch);
  445. - } else {
  446. - Perl_re_printf( aTHX_ "\n");
  447. - }
  448. - }
  449. - if (last && next > last)
  450. - node= last;
  451. - else
  452. - node= next;
  453. - }
  454. - else if ( op == CURLY ) { /* "next" might be very big: optimizer */
  455. - DUMPUNTIL(after, after + 1); /* +1 is NOT a REGNODE_AFTER */
  456. - }
  457. - else if (REGNODE_TYPE(op) == CURLY && op != CURLYX) {
  458. - assert(next);
  459. - DUMPUNTIL(after, next);
  460. - }
  461. - else if ( op == PLUS || op == STAR) {
  462. - DUMPUNTIL(after, after + 1); /* +1 NOT a REGNODE_AFTER */
  463. - }
  464. - else if (REGNODE_TYPE(op) == EXACT || op == ANYOFHs) {
  465. - /* Literal string, where present. */
  466. - node = (const regnode *)REGNODE_AFTER_varies(node);
  467. - }
  468. - else {
  469. - node = REGNODE_AFTER_opcode(node,op);
  470. - }
  471. - if (op == CURLYX || op == OPEN || op == SROPEN)
  472. - indent++;
  473. - if (REGNODE_TYPE(op) == END)
  474. - break;
  475. - }
  476. - CLEAR_OPTSTART;
  477. -#ifdef DEBUG_DUMPUNTIL
  478. - Perl_re_printf( aTHX_ "--- %d\n", (int)indent);
  479. -#endif
  480. - return node;
  481. -}
  482. -
  483. -#endif /* DEBUGGING */
  484. +#endif /* DEBUGGING */
  485. diff --git a/regcomp_invlist.c b/regcomp_invlist.c
  486. index 9ea3f431817d..82f82305846a 100644
  487. --- a/regcomp_invlist.c
  488. +++ b/regcomp_invlist.c
  489. @@ -18,7 +18,7 @@
  490. #include "unicode_constants.h"
  491. #include "regcomp_internal.h"
  492. -
  493. +#ifdef PERL_RE_BUILD_AUX
  494. void
  495. Perl_populate_bitmap_from_invlist(pTHX_ SV * invlist, const UV offset, const U8 * bitmap, const Size_t len)
  496. {
  497. @@ -70,6 +70,7 @@ Perl_populate_invlist_from_bitmap(pTHX_ const U8 * bitmap, const Size_t bitmap_l
  498. }
  499. }
  500. }
  501. +#endif /* PERL_RE_BUILD_AUX */
  502. /* This section of code defines the inversion list object and its methods. The
  503. * interfaces are highly subject to change, so as much as possible is static to
  504. diff --git a/regexec.c b/regexec.c
  505. index c404d9aa3d73..de0b7c461918 100644
  506. --- a/regexec.c
  507. +++ b/regexec.c
  508. @@ -4428,7 +4428,8 @@ S_regtry(pTHX_ regmatch_info *reginfo, char **startposp)
  509. */
  510. #define REPORT_CODE_OFF 29
  511. #define INDENT_CHARS(depth) ((int)(depth) % 20)
  512. -#ifdef DEBUGGING
  513. +
  514. +#ifdef PERL_RE_BUILD_DEBUG
  515. int
  516. Perl_re_exec_indentf(pTHX_ const char *fmt, U32 depth, ...)
  517. {