diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2023-03-18 21:53:12 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-03-18 21:54:42 -0700 |
commit | 83006fa8c9a55cd1e6897f46c0815f7edcafd84e (patch) | |
tree | 76477fba1007c2cb312aca65c3bb2f0a0abcd085 | |
parent | f41ef72934cb9a1b6a6528929b85d3bab8809afd (diff) | |
download | gnulib-83006fa8c9a55cd1e6897f46c0815f7edcafd84e.tar.gz |
dfa: pacify Oracle Solaris Studio 12.6
Without this patch, the compiler complains “statement not reached”.
* lib/dfa.c (lex): Refactor to omit unreachable statement.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/dfa.c | 12 |
2 files changed, 10 insertions, 6 deletions
@@ -1,5 +1,9 @@ 2023-03-18 Paul Eggert <eggert@cs.ucla.edu> + dfa: pacify Oracle Solaris Studio 12.6 + Without this patch, the compiler complains “statement not reached”. + * lib/dfa.c (lex): Refactor to omit unreachable statement. + Update MODULES.html.sh * MODULES.html.sh: Add some recently-added modules. This is by no means a complete update. I needed to point @@ -1202,8 +1202,13 @@ lex (struct dfa *dfa) On the plus side, this avoids having a duplicate of the main switch inside the backslash case. On the minus side, it means that just about every case tests the backslash flag. */ - for (int i = 0; i < 2; ++i) + for (int i = 0; ; i++) { + /* This loop should consume at most a backslash and some other + character. */ + if (2 <= i) + abort (); + if (! dfa->lex.left) return dfa->lex.lasttok = END; int c = fetch_wc (dfa); @@ -1591,11 +1596,6 @@ lex (struct dfa *dfa) return dfa->lex.lasttok = c; } } - - /* The above loop should consume at most a backslash - and some other character. */ - abort (); - return END; /* keeps pedantic compilers happy. */ } static void |