* [PATCH] dfa: pacify Oracle Solaris Studio 12.6
@ 2023-03-19 4:55 Paul Eggert
0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2023-03-19 4:55 UTC (permalink / raw)
To: bug-gnulib; +Cc: Paul Eggert
Without this patch, the compiler complains “statement not reached”.
* lib/dfa.c (lex): Refactor to omit unreachable statement.
---
ChangeLog | 4 ++++
lib/dfa.c | 12 ++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 00f18855bd..7d7f85a54b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/lib/dfa.c b/lib/dfa.c
index 20502a802f..d54aab40fd 100644
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -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
--
2.37.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-19 4:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-19 4:55 [PATCH] dfa: pacify Oracle Solaris Studio 12.6 Paul Eggert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).