Aharon Robbins wrote:

What happens if you compile them in and run the grep test suite?

The test suite passes, but grep is bigger and (I presume) slower. The GREP-related changes are for performance, and shouldn't affect behavior.

How about if we apply the attached patch to dfa.c, in both gawk and grep? I tried it just now, and gawk passed all its tests too. Or, if there's some reason this patch would introduce a bug into gawk, I'd like to fix the grep test cases to detect the bug.
diff --git a/dfa.c b/dfa.c
index ac1cf9a..f84ccd2 100644
--- a/dfa.c
+++ b/dfa.c
@@ -1135,18 +1135,6 @@ parse_bracket_exp (void)
                 case_fold ? towlower (wc) : (wchar_t) wc;
               work_mbc->range_ends[work_mbc->nranges++] =
                 case_fold ? towlower (wc2) : (wchar_t) wc2;
-
-#ifndef GREP
-              if (case_fold && (iswalpha (wc) || iswalpha (wc2)))
-                {
-                  REALLOC_IF_NECESSARY (work_mbc->range_sts,
-                                        range_sts_al, work_mbc->nranges + 1);
-                  work_mbc->range_sts[work_mbc->nranges] = towupper (wc);
-                  REALLOC_IF_NECESSARY (work_mbc->range_ends,
-                                        range_ends_al, work_mbc->nranges + 1);
-                  work_mbc->range_ends[work_mbc->nranges++] = towupper (wc2);
-                }
-#endif
             }
           else
             {
@@ -1182,11 +1170,7 @@ parse_bracket_exp (void)
                                     work_mbc->nchars + 1);
               work_mbc->chars[work_mbc->nchars++] = wc;
             }
-#ifdef GREP
           continue;
-#else
-          wc = towupper (wc);
-#endif
         }
       if (!setbit_wc (wc, ccl))
         {
@@ -1780,14 +1764,6 @@ atom (void)
   else if (MBS_SUPPORT && tok == WCHAR)
     {
       addtok_wc (case_fold ? towlower (wctok) : wctok);
-#ifndef GREP
-      if (case_fold && iswalpha (wctok))
-        {
-          addtok_wc (towupper (wctok));
-          addtok (OR);
-        }
-#endif
-
       tok = lex ();
     }
   else if (MBS_SUPPORT && tok == ANYCHAR && using_utf8 ())

Reply via email to