public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jeff Law <law@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1415] [PATCH] config: Backport "Rely less on internal symbols" (serial 69) to gettext.m4
Date: Mon, 14 Jun 2021 02:26:22 +0000 (GMT)	[thread overview]
Message-ID: <20210614022622.12E8D383D02F@sourceware.org> (raw)

https://gcc.gnu.org/g:3a01d8eec23091dc24c2fb14a621ea92a262ff50

commit r12-1415-g3a01d8eec23091dc24c2fb14a621ea92a262ff50
Author: Michael Forney <mforney@mforney.org>
Date:   Sun Jun 13 22:24:06 2021 -0400

    [PATCH] config: Backport "Rely less on internal symbols" (serial 69) to gettext.m4
    
    config
    
            * gettext.m4 (AM_GNU_GETTEXT): Skip checks for the internal
            symbols _nl_msg_cat_cntr, _nl_domain_bindings, and
            _nl_expand_alias, if __GNU_GETTEXT_SUPPORTED_REVISION is defined.
            Backport of gettext serial 68 patch.

Diff:
---
 config/gettext.m4 | 52 +++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 17 deletions(-)

diff --git a/config/gettext.m4 b/config/gettext.m4
index 45fa6b4ab76..5b42bb16523 100644
--- a/config/gettext.m4
+++ b/config/gettext.m4
@@ -128,6 +128,13 @@ AC_DEFUN([AM_GNU_GETTEXT],
 
         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
          [AC_TRY_LINK([#include <libintl.h>
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings)
+#else
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+#endif
 ]ifelse([$2], [need-formatstring-macros],
 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
@@ -135,10 +142,9 @@ AC_DEFUN([AM_GNU_GETTEXT],
 changequote(,)dnl
 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern int *_nl_domain_bindings;],
+], []),
             [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION],
             gt_cv_func_gnugettext_libc=yes,
             gt_cv_func_gnugettext_libc=no)])
 
@@ -160,6 +166,17 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
             LIBS="$LIBS $LIBINTL"
             dnl Now see whether libintl exists and does not depend on libiconv.
             AC_TRY_LINK([#include <libintl.h>
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (0))
+#else
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+#endif
 ]ifelse([$2], [need-formatstring-macros],
 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
@@ -167,20 +184,26 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
 changequote(,)dnl
 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias ();],
+], []),
               [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION],
               gt_cv_func_gnugettext_libintl=yes,
               gt_cv_func_gnugettext_libintl=no)
             dnl Now see whether libintl exists and depends on libiconv.
             if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
               LIBS="$LIBS $LIBICONV"
               AC_TRY_LINK([#include <libintl.h>
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (0))
+#else
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+#endif
 ]ifelse([$2], [need-formatstring-macros],
 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
@@ -188,14 +211,9 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
 changequote(,)dnl
 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias ();],
+], []),
                 [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION],
                [LIBINTL="$LIBINTL $LIBICONV"
                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
                 gt_cv_func_gnugettext_libintl=yes


                 reply	other threads:[~2021-06-14  2:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210614022622.12E8D383D02F@sourceware.org \
    --to=law@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).