summaryrefslogtreecommitdiff
path: root/regexp.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-09-22 11:56:48 -0600
committerKarl Williamson <khw@cpan.org>2014-09-29 11:07:40 -0600
commitcc4d09e1f55f1a823a9b410aa3e43aab0df8147a (patch)
tree476764295d45b9f5528ffa62205dc79ff77ca6a3 /regexp.h
parent477afe810ce7934cb37983108672d43de207e0c5 (diff)
downloadperl-cc4d09e1f55f1a823a9b410aa3e43aab0df8147a.tar.gz
Deprecate multiple "x" in "/xx"
It is planned for a future Perl release to have /xx mean something different from just /x. To prepare for this, this commit raises a deprecation warning if someone currently has this usage. A grep of CPAN did not turn up any instances of this, but this is to be safe anyway. The added code is more general than actually needed, in case we want to do this for another flag.
Diffstat (limited to 'regexp.h')
-rw-r--r--regexp.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/regexp.h b/regexp.h
index 1f6b67d374..7622d6706a 100644
--- a/regexp.h
+++ b/regexp.h
@@ -274,11 +274,18 @@ and check for NULL.
#define RXf_PMf_STD_PMMOD (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_FOLD|RXf_PMf_EXTENDED)
-#define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl) \
- case IGNORE_PAT_MOD: *(pmfl) |= RXf_PMf_FOLD; break; \
- case MULTILINE_PAT_MOD: *(pmfl) |= RXf_PMf_MULTILINE; break; \
- case SINGLE_PAT_MOD: *(pmfl) |= RXf_PMf_SINGLELINE; break; \
- case XTENDED_PAT_MOD: *(pmfl) |= RXf_PMf_EXTENDED; break
+#define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl, x_count) \
+ case IGNORE_PAT_MOD: *(pmfl) |= RXf_PMf_FOLD; break; \
+ case MULTILINE_PAT_MOD: *(pmfl) |= RXf_PMf_MULTILINE; break; \
+ case SINGLE_PAT_MOD: *(pmfl) |= RXf_PMf_SINGLELINE; break; \
+ case XTENDED_PAT_MOD: *(pmfl) |= RXf_PMf_EXTENDED; (x_count)++; break;
+
+#define STD_PMMOD_FLAGS_PARSE_X_WARN(x_count) \
+ if (UNLIKELY((x_count) > 1)) { \
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP), \
+ "Having more than one /%c regexp modifier is deprecated", \
+ XTENDED_PAT_MOD); \
+ }
/* Note, includes charset ones, assumes 0 is the default for them */
#define STD_PMMOD_FLAGS_CLEAR(pmfl) \