summaryrefslogtreecommitdiff
path: root/top/maint.mk
diff options
context:
space:
mode:
Diffstat (limited to 'top/maint.mk')
-rw-r--r--top/maint.mk7
1 files changed, 6 insertions, 1 deletions
diff --git a/top/maint.mk b/top/maint.mk
index 9ca2bd3b32..868e10f004 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -962,8 +962,13 @@ perl_filename_lineno_text_ = \
-e ' print "$$ARGV:$$n:$$v\n";' \
-e ' }'
+prohibit_doubled_words_ = \
+ the then in an on if is it but for or at and do to
+# expand the regex before running the check to avoid using expensive captures
+prohibit_doubled_word_expanded_ = \
+ $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_)))
prohibit_doubled_word_RE_ ?= \
- /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims
+ /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims
prohibit_doubled_word_ = \
-e 'while ($(prohibit_doubled_word_RE_))' \
$(perl_filename_lineno_text_)