~michaelh1/crosstool-ng/update-binutils

« back to all changes in this revision

Viewing changes to contrib/linaro/patches/gcc/linaro-4.7+bzr115029/gcc-nls.patch

  • Committer: Michael Hope
  • Date: 2012-10-18 08:44:06 UTC
  • mfrom: (2504.1.3 trunk)
  • Revision ID: michael.hope@linaro.org-20121018084406-y5m303zajig7cpo4
config/binutils,gcc: update to Linaro GCC tip and binutils tip.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff -Naru gcc-linaro-4.7-2012.04/gcc/gcc.c gcc-linaro-4.7-2012.04-updated/gcc/gcc.c
 
2
--- gcc-linaro-4.7-2012.04/gcc/gcc.c    2012-04-10 17:54:47.000000000 +0800
 
3
+++ gcc-linaro-4.7-2012.04-updated/gcc/gcc.c    2012-04-17 10:09:17.261047794 +0800
 
4
@@ -6154,7 +6154,7 @@
 
5
   /* Unlock the stdio streams.  */
 
6
   unlock_std_streams ();
 
7
 
 
8
-  gcc_init_libintl ();
 
9
+  gcc_init_libintl_program (argv[0]);
 
10
 
 
11
   diagnostic_initialize (global_dc, 0);
 
12
   if (atexit (delete_temp_files) != 0)
 
13
diff -Naru gcc-linaro-4.7-2012.04/gcc/intl.c gcc-linaro-4.7-2012.04-updated/gcc/intl.c
 
14
--- gcc-linaro-4.7-2012.04/gcc/intl.c   2012-04-10 17:54:47.000000000 +0800
 
15
+++ gcc-linaro-4.7-2012.04-updated/gcc/intl.c   2012-04-17 10:41:40.129785979 +0800
 
16
@@ -49,6 +49,14 @@
 
17
 void
 
18
 gcc_init_libintl (void)
 
19
 {
 
20
+  gcc_init_libintl_program("gcc");
 
21
+}
 
22
+
 
23
+#define LIBINTL_RELATIVE_DIR "../share/locale"
 
24
+
 
25
+void
 
26
+gcc_init_libintl_program (const char * program_name)
 
27
+{
 
28
 #ifdef HAVE_LC_MESSAGES
 
29
   setlocale (LC_CTYPE, "");
 
30
   setlocale (LC_MESSAGES, "");
 
31
@@ -56,7 +64,32 @@
 
32
   setlocale (LC_ALL, "");
 
33
 #endif
 
34
 
 
35
-  (void) bindtextdomain ("gcc", LOCALEDIR);
 
36
+  if (!access (LOCALEDIR, X_OK))
 
37
+    {
 
38
+      /* If LOCALEDIR exists, use LOCALEDIR. */
 
39
+      (void) bindtextdomain ("gcc", LOCALEDIR);
 
40
+    }
 
41
+  else
 
42
+    {
 
43
+      /* Try relative dir, i.e.  .../bin/../share/locale. */
 
44
+      int len1, len2;
 
45
+      char *prefix_dir, *locale_dir;
 
46
+      prefix_dir = make_relative_prefix(program_name,".",".");
 
47
+      len1 = strlen (prefix_dir);
 
48
+      len2 = strlen (LIBINTL_RELATIVE_DIR);
 
49
+      locale_dir = xmalloc (len1 + len2 + 1);
 
50
+      if (locale_dir != NULL)
 
51
+       {
 
52
+         strcpy (locale_dir, prefix_dir);
 
53
+         strcpy (locale_dir + len1, LIBINTL_RELATIVE_DIR);
 
54
+         (void) bindtextdomain ("gcc", locale_dir);
 
55
+       }
 
56
+      else
 
57
+       (void) bindtextdomain ("gcc", LOCALEDIR);
 
58
+
 
59
+      free (prefix_dir);
 
60
+    }
 
61
+
 
62
   (void) textdomain ("gcc");
 
63
 
 
64
   /* Opening quotation mark.  */
 
65
diff -Naru gcc-linaro-4.7-2012.04/gcc/intl.h gcc-linaro-4.7-2012.04-updated/gcc/intl.h
 
66
--- gcc-linaro-4.7-2012.04/gcc/intl.h   2012-04-10 17:54:47.000000000 +0800
 
67
+++ gcc-linaro-4.7-2012.04-updated/gcc/intl.h   2012-04-17 10:09:17.261047794 +0800
 
68
@@ -30,6 +30,7 @@
 
69
 #ifdef ENABLE_NLS
 
70
 #include <libintl.h>
 
71
 extern void gcc_init_libintl (void);
 
72
+extern void gcc_init_libintl_program (const char *);
 
73
 extern size_t gcc_gettext_width (const char *);
 
74
 #else
 
75
 /* Stubs.  */