From: Pedro Alves <palves@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Use std::max and std::min throughout
Date: Mon, 19 Sep 2016 13:36:00 -0000 [thread overview]
Message-ID: <d19e8756-4748-bfe1-2f26-8c725525a0c1@redhat.com> (raw)
In-Reply-To: <20160919114724.A00EC10B7EF@oc8523832656.ibm.com>
On 09/19/2016 12:47 PM, Ulrich Weigand wrote:
>
> It seems the reason for this is a GDB header trick in common/gdb_locale.h:
>
> #ifdef ENABLE_NLS
> ...
> #else
> # define gettext(Msgid) (Msgid)
> ...
> #endif
>
> This will obviously cause problems if the <libintl.h> header is included
> at any point after "gdb_locale.h" (which is in turn included by "defs.h"
> via "common-defs.h", and thus by any GDB file).
>
> Apparently in the past this newer happened. But after your change to
> include <algorithm>, this is now triggered, since (at least the GCC 4.1
> copy of) <algorihm> includes <libintl.h> via <bits/stl_algobase.h>,
> <iosfwd>, and <bits/c++locale.h>.
>
> Any thoughts how to fix this?
I tried a --disable-nls with both gcc 5.1 and 4.7 here, and it
doesn't trigger this. I can't seem to find the libintl.h inclusion
you're seeing. Sounds like that was changed at some point.
The gdb_locale.h code in question is:
#ifdef ENABLE_NLS
# include <libintl.h>
# define _(String) gettext (String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define gettext(Msgid) (Msgid)
# define dgettext(Domainname, Msgid) (Msgid)
# define dcgettext(Domainname, Msgid, Category) (Msgid)
# define textdomain(Domainname) while (0) /* nothing */
# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
# define _(String) (String)
# define N_(String) (String)
#endif
How about always including libintl.h, even when ENABLE_NLS:
#ifdef HAVE_LIBINTL_H
# include <libintl.h>
#endif
#ifdef ENABLE_NLS
# define _(String) gettext (String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define gettext(Msgid) (Msgid)
# define dgettext(Domainname, Msgid) (Msgid)
# define dcgettext(Domainname, Msgid, Category) (Msgid)
# define textdomain(Domainname) while (0) /* nothing */
# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
# define _(String) (String)
# define N_(String) (String)
#endif
I.e., something like the patch below.
From 55a19a41adba756ebb82f987a5ebbba4dcd8ee27 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 19 Sep 2016 14:29:12 +0100
Subject: [PATCH] fix libintl.h
---
gdb/common/common.m4 | 2 +-
gdb/common/gdb_locale.h | 5 ++++-
gdb/config.in | 9 ++++++---
gdb/configure | 2 +-
gdb/gdbserver/config.in | 3 +++
gdb/gdbserver/configure | 2 +-
6 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/gdb/common/common.m4 b/gdb/common/common.m4
index 68afc65..4192020 100644
--- a/gdb/common/common.m4
+++ b/gdb/common/common.m4
@@ -28,7 +28,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_CHECK_HEADERS(linux/perf_event.h locale.h memory.h signal.h dnl
sys/resource.h sys/socket.h sys/syscall.h dnl
sys/un.h sys/wait.h dnl
- thread_db.h wait.h)
+ thread_db.h wait.h libintl.h)
AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair sigaction])
diff --git a/gdb/common/gdb_locale.h b/gdb/common/gdb_locale.h
index 686260e..15fa364 100644
--- a/gdb/common/gdb_locale.h
+++ b/gdb/common/gdb_locale.h
@@ -23,8 +23,11 @@
# include <locale.h>
#endif
-#ifdef ENABLE_NLS
+#ifdef HAVE_LIBINTL_H
# include <libintl.h>
+#endif
+
+#ifdef ENABLE_NLS
# define _(String) gettext (String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
diff --git a/gdb/config.in b/gdb/config.in
index c82a5b4..465d3a9 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -237,6 +237,9 @@
/* Define to 1 if you have the `libiconvlist' function. */
#undef HAVE_LIBICONVLIST
+/* Define to 1 if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
/* Define if you have the ipt library. */
#undef HAVE_LIBIPT
@@ -453,12 +456,12 @@
/* Define to 1 if your system has struct lwp. */
#undef HAVE_STRUCT_LWP
-/* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_tdname'. */
-#undef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME
-
/* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_syscall_code'. */
#undef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
+/* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_tdname'. */
+#undef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME
+
/* Define to 1 if your system has struct reg in <machine/reg.h>. */
#undef HAVE_STRUCT_REG
diff --git a/gdb/configure b/gdb/configure
index e2d853d..499d3c3 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -12198,7 +12198,7 @@ $as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
fi
- for ac_header in linux/perf_event.h locale.h memory.h signal.h sys/resource.h sys/socket.h sys/syscall.h sys/un.h sys/wait.h thread_db.h wait.h
+ for ac_header in linux/perf_event.h locale.h memory.h signal.h sys/resource.h sys/socket.h sys/syscall.h sys/un.h sys/wait.h thread_db.h wait.h libintl.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 04072cf..52ba0cd 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -117,6 +117,9 @@
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
+/* Define to 1 if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
/* Define to 1 if you have the `mcheck' library (-lmcheck). */
#undef HAVE_LIBMCHECK
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index f112517..4b83790 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -5867,7 +5867,7 @@ $as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
fi
- for ac_header in linux/perf_event.h locale.h memory.h signal.h sys/resource.h sys/socket.h sys/syscall.h sys/un.h sys/wait.h thread_db.h wait.h
+ for ac_header in linux/perf_event.h locale.h memory.h signal.h sys/resource.h sys/socket.h sys/syscall.h sys/un.h sys/wait.h thread_db.h wait.h libintl.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
--
2.5.5
next prev parent reply other threads:[~2016-09-19 13:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 16:52 Pedro Alves
2016-09-15 17:47 ` Simon Marchi
2016-09-16 19:01 ` Pedro Alves
2016-09-18 23:26 ` [pushed] gdb: Fix std::{min, max}-related build breakage on 32-bit hosts Pedro Alves
2016-09-18 23:37 ` [pushed] gdb/s390: Fix build breakage due to std::min/std::max usage without header Pedro Alves
2016-09-19 11:47 ` [PATCH] gdb: Use std::max and std::min throughout Ulrich Weigand
2016-09-19 13:36 ` Pedro Alves [this message]
2016-09-19 13:44 ` Pedro Alves
2016-09-19 14:02 ` Pedro Alves
2016-09-19 14:56 ` Ulrich Weigand
2016-09-19 15:23 ` Pedro Alves
2016-09-19 15:59 ` [pushed] gdb: Fix build breakage with GCC 4.1 and --disable-nls Pedro Alves
2016-09-19 16:18 ` Ulrich Weigand
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=d19e8756-4748-bfe1-2f26-8c725525a0c1@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/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