]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
intl: Fix portability problem in previous commit.
authorBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2023 18:59:24 +0000 (20:59 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2023 22:36:55 +0000 (00:36 +0200)
* gettext-runtime/intl/localealias.c (read_alias_file): Use
"#pragma GCC diagnostic ..." only with new enough GCC versions.

gettext-runtime/intl/localealias.c

index d1de252badc4900b0921cea4f1c2e54023aec940..3953312c54a2f38cfa887bc965613d69b4e290b2 100644 (file)
@@ -363,13 +363,12 @@ read_alias_file (const char *fname, int fname_len)
 
                  if (string_space_act + alias_len + value_len > string_space_max)
                    {
-#pragma GCC diagnostic push
-
-#if defined __GNUC__ && __GNUC__ >= 12
+# if defined __GNUC__ && __GNUC__ >= 12
+#  pragma GCC diagnostic push
   /* Suppress the valid GCC 12 warning until the code below is changed
      to avoid using pointers to the reallocated block.  */
 #  pragma GCC diagnostic ignored "-Wuse-after-free"
-#endif
+# endif
 
                    /* Increase size of memory pool.  */
                      size_t new_size = (string_space_max
@@ -404,7 +403,9 @@ read_alias_file (const char *fname, int fname_len)
                                           value, value_len);
                  string_space_act += value_len;
 
-#pragma GCC diagnostic pop
+# if defined __GNUC__ && __GNUC__ >= 12
+#  pragma GCC diagnostic pop
+# endif
 
                  ++nmap;
                  ++added;