[glibc] intl: Remove pre-C99 fallbacks from plural-exp.c

Adhemerval Zanella via Glibc-cvs <[email protected]> Mon, 18 May 2026 16:34:06 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5ce8201bf5c38e84d0c65e51d9acdd743e69d483

commit 5ce8201bf5c38e84d0c65e51d9acdd743e69d483
Author: Avinal Kumar <[email protected]>
Date:   Tue May 5 20:41:42 2026 +0530

    intl: Remove pre-C99 fallbacks from plural-exp.c
    
    glibc requires C11 since 2022, making pre-C99 compatibility
    paths in plural-exp.c dead code:
    
    - init_germanic_plural(): With C99+, GERMANIC_PLURAL is
    initialized at compile time and this function is never called.
    Remove the function and the INIT_GERMANIC_PLURAL macro.
    
    - HAVE_STRTOUL guard: Protected strtoul() usage with a manual
    digit-parsing fallback.  strtoul is in C89 <stdlib.h> and glibc
    provides it.  Remove the guard and the fallback loop.
    
    Imported from GNU gettext commits ab5990532 and c1d84d656.
    Original author: Bruno Haible <[email protected]>
    
    Signed-off-by: Avinal Kumar <[email protected]>
    Reviewed-by: Adhemerval Zanella  <[email protected]>

Diff:
---
 intl/plural-exp.c | 44 --------------------------------------------
 1 file changed, 44 deletions(-)

diff --git a/intl/plural-exp.c b/intl/plural-exp.c
index c02e4b6a6d..8f910d7e7f 100644
--- a/intl/plural-exp.c
+++ b/intl/plural-exp.c
@@ -25,10 +25,6 @@
 
 #include <plural-exp.h>
 
-#if (defined __GNUC__ && !(defined __APPLE_CC_ && __APPLE_CC__ > 1) && \
-     !defined __cplusplus)					       \
-    || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
-
 /* These structs are the constant expression for the germanic plural
    form determination.  It represents the expression  "n != 1".  */
 static const struct expression plvar =
@@ -59,40 +55,6 @@ const struct expression GERMANIC_PLURAL =
   }
 };
 
-# define INIT_GERMANIC_PLURAL()
-
-#else
-
-/* For compilers without support for ISO C 99 struct/union initializers:
-   Initialization at run-time.  */
-
-static struct expression plvar;
-static struct expression plone;
-struct expression GERMANIC_PLURAL;
-
-static void
-init_germanic_plural (void)
-{
-  if (plone.val.num == 0)
-    {
-      plvar.nargs = 0;
-      plvar.operation = var;
-
-      plone.nargs = 0;
-      plone.operation = num;
-      plone.val.num = 1;
-
-      GERMANIC_PLURAL.nargs = 2;
-      GERMANIC_PLURAL.operation = not_equal;
-      GERMANIC_PLURAL.val.args[0] = &plvar;
-      GERMANIC_PLURAL.val.args[1] = &plone;
-    }
-}
-
-# define INIT_GERMANIC_PLURAL() init_germanic_plural ()
-
-#endif
-
 void
 EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
 			   const struct expression **pluralp,
@@ -119,12 +81,7 @@ EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
 	    ++nplurals;
 	  if (!(*nplurals >= '0' && *nplurals <= '9'))
 	    goto no_plural;
-#if defined HAVE_STRTOUL || defined _LIBC
 	  n = strtoul (nplurals, &endp, 10);
-#else
-	  for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++)
-	    n = n * 10 + (*endp - '0');
-#endif
 	  if (nplurals == endp)
 	    goto no_plural;
 	  *npluralsp = n;
@@ -146,7 +103,6 @@ EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
          for `one', the plural form otherwise.  Yes, this is also what
          English is using since English is a Germanic language.  */
     no_plural:
-      INIT_GERMANIC_PLURAL ();
       *pluralp = &GERMANIC_PLURAL;
       *npluralsp = 2;
     }