This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gold: fiddle <clocale>/<libintl.h> include order

With mingw32 (4.7.0) headers, including <clocale> before <libintl.h>
goes awry in arcane ways that I'm frankly grateful to have forgotten
the details of since the first time I saw the failure mode (which may
actually have been with some Cygwin version).

I was actually using the 2.23 branch where this blob is in gold.h instead
of system.h and only build-tested this trunk change on x86_64-linux-gnu
after having tested the identical change to 2.23-branch's gold.h on mingw32.

Based on the comment, the <clocale> include might not actually be necessary
in the [ENABLE_NLS] case at all, but this seemed like the safer,
less-perturbing change.

Ok for trunk?


2012-11-01  Roland McGrath  <>

	* system.h: Move inclusion of <clocale> to after <libintl.h> in
	[ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.

diff --git a/gold/system.h b/gold/system.h
index ce2d939..3e6fe1d 100644
--- a/gold/system.h
+++ b/gold/system.h
@@ -33,12 +33,10 @@
 # define _LIBGETTEXT_H

-// Always include <clocale> first to avoid conflicts with the macros
-// used when ENABLE_NLS is not defined.
-#include <clocale>
 #ifdef ENABLE_NLS
+// On some systems, things go awry when <libintl.h> comes after <clocale>.
 # include <libintl.h>
+# include <clocale>
 # define _(String) gettext (String)
 # ifdef gettext_noop
 #  define N_(String) gettext_noop (String)
@@ -46,6 +44,8 @@
 #  define N_(String) (String)
 # endif
+// Include <clocale> first to avoid conflicts with these macros.
+# include <clocale>
 # define gettext(Msgid) (Msgid)
 # define dgettext(Domainname, Msgid) (Msgid)
 # define dcgettext(Domainname, Msgid, Category) (Msgid)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]