]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Assume ISO C 99 or newer.
authorBruno Haible <bruno@clisp.org>
Fri, 22 Sep 2023 07:48:37 +0000 (09:48 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 22 Sep 2023 07:48:37 +0000 (09:48 +0200)
* gettext-runtime/intl/plural-exp.h (HAVE_STRUCT_INITIALIZER): Remove macro.
(GERMANIC_PLURAL): Assume HAVE_STRUCT_INITIALIZER is 1.
* gettext-runtime/intl/plural-exp.c: Assume HAVE_STRUCT_INITIALIZER is 1.
(init_germanic_plural): Remove function.
(INIT_GERMANIC_PLURAL): Remove macro.
(EXTRACT_PLURAL_EXPRESSION): Update.

gettext-runtime/intl/plural-exp.c
gettext-runtime/intl/plural-exp.h

index 00183dca46de89b435fa6f595e134b75ba5a2d88..6bff9a212e6a7bc671513da65e23dcae6825d626 100644 (file)
@@ -1,5 +1,5 @@
 /* Expression parsing for plural form selection.
-   Copyright (C) 2000-2016, 2021 Free Software Foundation, Inc.
+   Copyright (C) 2000-2023 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software: you can redistribute it and/or modify
@@ -25,8 +25,6 @@
 
 #include "plural-exp.h"
 
-#if HAVE_STRUCT_INITIALIZER
-
 /* These structs are the constant expression for the germanic plural
    form determination.  It represents the expression  "n != 1".  */
 static const struct expression plvar =
@@ -57,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
 internal_function
 EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
@@ -140,7 +104,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;
     }
index eac31afca9f5013dc44951009a09429a98440632..c4c7153ad533ed49bae75fece62ff1e857ef9781 100644 (file)
@@ -1,5 +1,5 @@
 /* Expression parsing and evaluation for plural form selection.
-   Copyright (C) 2000-2016, 2019, 2021 Free Software Foundation, Inc.
+   Copyright (C) 2000-2023 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software: you can redistribute it and/or modify
@@ -105,25 +105,10 @@ struct parse_args
 # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
 #endif
 
-#if (defined __GNUC__ && !(defined __APPLE_CC_ && __APPLE_CC__ > 1) \
-     && !defined __cplusplus)                                       \
-    || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L     \
-        && !defined __HP_cc)                                        \
-    || (defined __SUNPRO_C && 0x560 <= __SUNPRO_C                   \
-        && !(defined __STDC__ && __STDC__ == 1))
-# define HAVE_STRUCT_INITIALIZER 1
-#else
-# define HAVE_STRUCT_INITIALIZER 0
-#endif
-
 extern void FREE_EXPRESSION (struct expression *exp)
      internal_function;
 extern int PLURAL_PARSE (struct parse_args *arg);
-#if HAVE_STRUCT_INITIALIZER
 extern const struct expression GERMANIC_PLURAL attribute_hidden;
-#else
-extern struct expression GERMANIC_PLURAL attribute_hidden;
-#endif
 extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
                                       const struct expression **pluralp,
                                       unsigned long int *npluralsp)