From: Bruno Haible <bruno@clisp.org>
Date: Thu, 12 Dec 2024 13:07:06 +0000 (+0100)
Subject: bcp47: Silence a gcc 14 -Wanalyzer-infinite-loop warning.
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=8fa44cbff0405e923c6b08a35ac18575ab08b7a1;p=gnulib.git

bcp47: Silence a gcc 14 -Wanalyzer-infinite-loop warning.

* lib/bcp47.c: Include <stdlib.h>.
(bcp47_to_xpg): Verify an invariant through an abort().
---

diff --git a/ChangeLog b/ChangeLog
index 8b1b923d17..47b518100f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-12-12  Bruno Haible  <bruno@clisp.org>
+
+	bcp47: Silence a gcc 14 -Wanalyzer-infinite-loop warning.
+	* lib/bcp47.c: Include <stdlib.h>.
+	(bcp47_to_xpg): Verify an invariant through an abort().
+
 2024-12-11  Paul Eggert  <eggert@cs.ucla.edu>
 
 	doc: isdigit and isxdigit are locale-independent
diff --git a/lib/bcp47.c b/lib/bcp47.c
index 96f7aad8ce..09f60f1eec 100644
--- a/lib/bcp47.c
+++ b/lib/bcp47.c
@@ -21,6 +21,7 @@
 /* Specification.  */
 #include "bcp47.h"
 
+#include <stdlib.h>
 #include <string.h>
 
 #include "c-ctype.h"
@@ -421,6 +422,8 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
                   }
               }
           }
+        else
+          abort ();
       }
   }