]> Savannah Git Hosting - gnulib.git/commitdiff
dfa: do not warn about \] and \}
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Jun 2022 01:46:37 +0000 (18:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Jun 2022 16:55:57 +0000 (09:55 -0700)
* lib/dfa.c (lex): Do not warn about \] and \}, since they’re
surely universally supported even though POSIX says their
interpretation is undefined.

ChangeLog
lib/dfa.c
lib/dfa.h

index 5fe5e9ee23a62cd1db8668027c42fb8cdadec561..053fabde2a5abd33081f9622f83d7285c5aa6338 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-06-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       dfa: do not warn about \] and \}
+       * lib/dfa.c (lex): Do not warn about \] and \}, since they’re
+       surely universally supported even though POSIX says their
+       interpretation is undefined.
+
 2022-06-03  Paul Eggert  <eggert@cs.ucla.edu>
 
        regex-quote: \] -> ] in EREs and BREs
index bd4c5f05825b1c975bf87237040d9aed71a69b3b..4f8367af3f44312d7906b84c593ca56d4fe42668 100644 (file)
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -1563,6 +1563,8 @@ lex (struct dfa *dfa)
                 }
               dfawarn (msg);
             }
+          FALLTHROUGH;
+        case ']': case '}':
         normal_char:
           dfa->lex.laststart = false;
           /* For multibyte character sets, folding is done in atom.  Always
index 91ec1d809fcca70d77a2a591528f90ada2344c77..043f0e9717e38537745520cdbe55457542ed0dc9 100644 (file)
--- a/lib/dfa.h
+++ b/lib/dfa.h
@@ -79,7 +79,11 @@ enum
        merely a warning.  */
     DFA_CONFUSING_BRACKETS_ERROR = 1 << 2,
 
-    /* Warn about stray backslashes before ordinary characters.  */
+    /* Warn about stray backslashes before ordinary characters other
+       than ] and } which are special because even though POSIX
+       says \] and \} have undefined interpretation, platforms
+       reliably ignore those stray backlashes and warning about them
+       would likely cause more trouble than it's worth.  */
     DFA_STRAY_BACKSLASH_WARN = 1 << 3,
 
     /* Warn about * appearing out of context at the start of an