gdb: Fix build breakage with GCC 4.1 and --disable-nls
authorPedro Alves <palves@redhat.com>
Mon, 19 Sep 2016 15:55:35 +0000 (16:55 +0100)
committerPedro Alves <palves@redhat.com>
Mon, 19 Sep 2016 15:55:35 +0000 (16:55 +0100)
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 <libintl.h> 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 <algorithm>, this now
happens with at least the GCC 4.1 copy of <algorithm>, which includes
<libintl.h> via <bits/stl_algobase.h>, <iosfwd>, and
<bits/c++locale.h>.

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  <palves@redhat.com>

* 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
gdb/common/gdb_locale.h
gdb/main.c

index 8b1f0bc834d6cdc19e9ff96fd253d7d74de67191..26b97e6687c84eaba4c75c978025fbfa8c0d82f5 100644 (file)
@@ -1,3 +1,10 @@
+2016-09-19  Pedro Alves  <palves@redhat.com>
+
+       * 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  <sergiodj@redhat.com>
 
        * darwin-nat.c (darwin_kill_inferior): Adjusting call to
index 686260e921db74916aca240da2ae55bbdfc4117c..f9538a731f05c641ffe914a4e2fe070dd8417506 100644 (file)
 #  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
index 23d4ca046ae68cc98ecd494e6f83c61718237706..2ea9466d38fc6e7f4f06b9a2defe8bb5ba25c8ad 100644 (file)
@@ -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 ();
This page took 0.032099 seconds and 4 git commands to generate.