From patchwork Mon Sep 19 15:59:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 15776 Received: (qmail 105964 invoked by alias); 19 Sep 2016 15:59:27 -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 105952 invoked by uid 89); 19 Sep 2016 15:59:27 -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=PACKAGE, 5018 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 15:59:18 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 6F2867EA90; Mon, 19 Sep 2016 15:59:17 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8JFxGO1006778; Mon, 19 Sep 2016 11:59:16 -0400 Subject: [pushed] gdb: Fix build breakage with GCC 4.1 and --disable-nls To: Ulrich Weigand References: <20160919145640.AFC84100083@oc8523832656.ibm.com> <2234d72c-6eae-ac7b-131c-5e6f77d53558@redhat.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: Date: Mon, 19 Sep 2016 16:59:15 +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: <2234d72c-6eae-ac7b-131c-5e6f77d53558@redhat.com> On 09/19/2016 04:23 PM, Pedro Alves wrote: > On 09/19/2016 03:56 PM, Ulrich Weigand wrote: >> Pedro Alves wrote: >> >>> 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. >> >> Yes, it looks like these days the C++ headers include a lot fewer >> of the base C headers (fixing namespace pollution, maybe?). > > Yeah, I assume so. > >>> Alternatively, simply remove the troublesome *gettext and *textdomain >>> macros, leaving only the _ and N_ ones. I can't seem to find any >>> directly reference to gettext in the tree. The textdomain calls >>> in main.c would need to be wrapped in #ifdef ENABLE_NLS, but >>> likes like that is all. >> >> This would also work, and seems the cleanest solution. > > OK, I'm testing a patch. I've pushed this in now. From 6679754127e51d9c3bd0e387fabbe4e71038c8ce Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 19 Sep 2016 16:55:35 +0100 Subject: [PATCH] gdb: Fix build breakage with GCC 4.1 and --disable-nls Ref: https://sourceware.org/ml/gdb-patches/2016-09/msg00203.html The std::{min,max} patch caused build failures when configuring GDB with with --disable-nls and using GCC 4.1. The reason is this bit in common/gdb_locale.h: #ifdef ENABLE_NLS ... #else # define gettext(Msgid) (Msgid) ... #endif This causes problems if the header is first included at any point after "gdb_locale.h". Specifically, the gettext&co declarations in libintl.h: extern char *gettext (__const char *__msgid) __THROW __attribute_format_arg__ (1); end up broken after preprocessing: extern char *(__const char *__msgid) throw () __attribute__ ((__format_arg__ (1))); After the std::min/std::max change to include , this now happens with at least the GCC 4.1 copy of , which includes via , , and . The fix is to simply remove the troublesome *gettext and *textdomain macros, leaving only the _ and N_ ones. gdb/ChangeLog: 2016-09-19 Pedro Alves * common/gdb_locale.h [!ENABLE_NLS] (gettext, dgettext, dcgettext, textdomain, bindtextdomain): Delete macros. * main.c (captured_main) [!ENABLE_NLS]: Skip bintextdomain and textdomain calls. --- gdb/ChangeLog | 7 +++++++ gdb/common/gdb_locale.h | 5 ----- gdb/main.c | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b1f0bc..26b97e6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2016-09-19 Pedro Alves + + * common/gdb_locale.h [!ENABLE_NLS] (gettext, dgettext, dcgettext, + textdomain, bindtextdomain): Delete macros. + * main.c (captured_main) [!ENABLE_NLS]: Skip bintextdomain and + textdomain calls. + 2016-09-19 Sergio Durigan Junior * darwin-nat.c (darwin_kill_inferior): Adjusting call to diff --git a/gdb/common/gdb_locale.h b/gdb/common/gdb_locale.h index 686260e..f9538a7 100644 --- a/gdb/common/gdb_locale.h +++ b/gdb/common/gdb_locale.h @@ -32,11 +32,6 @@ # 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 diff --git a/gdb/main.c b/gdb/main.c index 23d4ca0..2ea9466 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -501,8 +501,10 @@ captured_main (void *data) #if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); #endif +#ifdef ENABLE_NLS bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); +#endif bfd_init (); notice_open_fds ();