* lib/dfa.c (lex): Use ‘assume’ rather than ‘abort’, to try to pacify Coverity. (maybe_disable_superset_dfa): Use ‘assume’ here too, for consistency. Using ‘assume’ should make the code a tiny bit faster, though at the cost of having undefined behavior instead of nicely aborting. --- ChangeLog | 9 +++++++++ lib/dfa.c | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index a138378822..997f51f3b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-05-20 Paul Eggert <egg...@cs.ucla.edu> + + dfa: attempt to pacify Coverity + * lib/dfa.c (lex): Use ‘assume’ rather than ‘abort’, + to try to pacify Coverity. + (maybe_disable_superset_dfa): Use ‘assume’ here too, for consistency. + Using ‘assume’ should make the code a tiny bit faster, though + at the cost of having undefined behavior instead of nicely aborting. + 2024-05-20 Bruno Haible <br...@clisp.org> Make it easy to generate debug info for libbacktrace on macOS. diff --git a/lib/dfa.c b/lib/dfa.c index c79afddcd9..0ccb167176 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -1221,8 +1221,7 @@ lex (struct dfa *dfa) { /* This loop should consume at most a backslash and some other character. */ - if (2 <= i) - abort (); + assume (i < 2); if (! dfa->lex.left) return dfa->lex.lasttok = END; @@ -3727,7 +3726,7 @@ maybe_disable_superset_dfa (struct dfa *d) { case ANYCHAR: /* Lowered. */ - abort (); + assume (false); case BACKREF: have_backref = true; break; -- 2.40.1