summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--src/dfasearch.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 112d85b0..499eadf8 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,10 @@ GNU grep NEWS -*- outline -*-
Regular expressions with stray backslashes now cause warnings, as
their unspecified behavior can lead to unexpected results.
For example, '\a' and 'a' are not always equivalent
- <https://bugs.gnu.org/39768>. The warnings are intended as a
+ <https://bugs.gnu.org/39768>. Similarly, regular expressions or
+ subexpressions that start with a repetition operator now also cause
+ warnings due to their unspecified behavior; for example, *a(+b|{1}c)
+ now has three reasons to warn. The warnings are intended as a
transition aid; they are likely to be errors in future releases.
Regular expressions like [:space:] are now errors even if
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 7547a8a3..8d832f0c 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -197,6 +197,8 @@ GEAcompile (char *pattern, idx_t size, reg_syntax_t syntax_bits,
if (match_icase)
syntax_bits |= RE_ICASE;
int dfaopts = (DFA_CONFUSING_BRACKETS_ERROR | DFA_STRAY_BACKSLASH_WARN
+ | DFA_PLUS_WARN
+ | (syntax_bits & RE_CONTEXT_INDEP_OPS ? DFA_STAR_WARN : 0)
| (eolbyte ? 0 : DFA_EOL_NUL));
dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts);
bool bs_safe = !localeinfo.multibyte | localeinfo.using_utf8;