Permalink
Browse files

regcomp.c: Add macro for warning experimental features

This consolidates the code that warns that an experimental feature is
being called into a common macro.
  • Loading branch information...
khwilliamson committed Oct 8, 2018
1 parent ec5cf66 commit 1baf9568e26e32af4cc56fd859f2a92cbedc4e06
Showing with 14 additions and 13 deletions.
  1. +14 −13 regcomp.c
View
@@ -871,6 +871,11 @@ static const scan_data_t zero_scan_data = {
a1, a2, a3, a4, \
REPORT_LOCATION_ARGS(loc)))
#define ckWARNexperimental(loc, class, m) \
_WARN_HELPER(loc, Perl_ck_warner_d(aTHX_ packWARN(class), \
m REPORT_LOCATION, \
REPORT_LOCATION_ARGS(loc)))
/* Convert between a pointer to a node and its offset from the beginning of the
* program */
#define REGNODE_p(offset) (RExC_emit_start + (offset))
@@ -10956,11 +10961,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
/* By doing this here, we avoid extra warnings for nested
* script runs */
if (PASS2) {
Perl_ck_warner_d(aTHX_
packWARN(WARN_EXPERIMENTAL__SCRIPT_RUN),
"The script_run feature is experimental"
REPORT_LOCATION, REPORT_LOCATION_ARGS(RExC_parse));
ckWARNexperimental(RExC_parse,
WARN_EXPERIMENTAL__SCRIPT_RUN,
"The script_run feature is experimental");
}
if (paren == 's') {
@@ -11004,10 +11007,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth)
alpha_assertions:
if (PASS2) {
Perl_ck_warner_d(aTHX_
packWARN(WARN_EXPERIMENTAL__ALPHA_ASSERTIONS),
"The alpha_assertions feature is experimental"
REPORT_LOCATION, REPORT_LOCATION_ARGS(RExC_parse));
ckWARNexperimental(RExC_parse,
WARN_EXPERIMENTAL__ALPHA_ASSERTIONS,
"The alpha_assertions feature is experimental");
}
RExC_seen_zerolen++;
@@ -15494,10 +15496,9 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
}
/* Pass 2 only after this. */
Perl_ck_warner_d(aTHX_
packWARN(WARN_EXPERIMENTAL__REGEX_SETS),
"The regex_sets feature is experimental" REPORT_LOCATION,
REPORT_LOCATION_ARGS(RExC_parse));
ckWARNexperimental(RExC_parse,
WARN_EXPERIMENTAL__REGEX_SETS,
"The regex_sets feature is experimental");
/* Everything in this construct is a metacharacter. Operands begin with
* either a '\' (for an escape sequence), or a '[' for a bracketed

0 comments on commit 1baf956

Please sign in to comment.