From patchwork Mon Sep 19 13:35:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 15771 Received: (qmail 66149 invoked by alias); 19 Sep 2016 13:36:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 66131 invoked by uid 89); 19 Sep 2016 13:36:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=HTo:U*uweigand, 2379, msgid X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Sep 2016 13:35:55 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7747A335654; Mon, 19 Sep 2016 13:35:54 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8JDZqKx010392; Mon, 19 Sep 2016 09:35:53 -0400 Subject: Re: [PATCH] gdb: Use std::max and std::min throughout To: Ulrich Weigand References: <20160919114724.A00EC10B7EF@oc8523832656.ibm.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: Date: Mon, 19 Sep 2016 14:35:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 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 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 , this is now triggered, since (at least the GCC 4.1 > copy of) includes via , > , and . > > 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 # 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 #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 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 #endif -#ifdef ENABLE_NLS +#ifdef HAVE_LIBINTL_H # include +#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 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 . */ #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 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"