]> Savannah Git Hosting - gnulib.git/commitdiff
dfa: work around Clang 15 bug
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Jan 2023 06:06:10 +0000 (22:06 -0800)
committerBruno Haible <bruno@clisp.org>
Sat, 14 Jan 2023 20:21:44 +0000 (21:21 +0100)
Problem reported by Kenton Groombridge in:
https://lists.gnu.org/archive/html/bug-gawk/2022-12/msg00010.html
On x86-64, Clang 15 gets confused by a call (X ? dfaerror :
dfawarn) (Y) and generates the wrong code, presumably because
dfaerror is _Noreturn and dfawarn is not.
* lib/dfa.c (parse_bracket_exp): Reword to have one call for
dfaerror, the other for dfawarn.

ChangeLog
lib/dfa.c

index ef7f457143d59816614fc0203e8494d5b3d14039..d9acffc787efacf50649d8acc295462a43b1bbc7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-01-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       dfa: work around Clang 15 bug
+       Problem reported by Kenton Groombridge in:
+       https://lists.gnu.org/archive/html/bug-gawk/2022-12/msg00010.html
+       On x86-64, Clang 15 gets confused by a call (X ? dfaerror :
+       dfawarn) (Y) and generates the wrong code, presumably because
+       dfaerror is _Noreturn and dfawarn is not.
+       * lib/dfa.c (parse_bracket_exp): Reword to have one call for
+       dfaerror, the other for dfawarn.
+
 2022-12-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        assert-h: port static_assert to strict C99
index 57df1e0421abe1facdfd066ecd68547b174fe5f9..211e1ed18f69a478b2ca0d4f5cbbf8aebe83e766 100644 (file)
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -1138,9 +1138,14 @@ parse_bracket_exp (struct dfa *dfa)
   while ((wc = wc1, (c = c1) != ']'));
 
   if (colon_warning_state == 7)
-    ((dfa->syntax.dfaopts & DFA_CONFUSING_BRACKETS_ERROR
-      ? dfaerror : dfawarn)
-     (_("character class syntax is [[:space:]], not [:space:]")));
+    {
+      char const *msg
+        = _("character class syntax is [[:space:]], not [:space:]");
+      if (dfa->syntax.dfaopts & DFA_CONFUSING_BRACKETS_ERROR)
+        dfaerror (msg);
+      else
+        dfawarn (msg);
+    }
 
   if (! known_bracket_exp)
     return BACKREF;