This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[RFC] Internationalization markup of messages and common code


  As I recently added the gettext category to 
standard ARI output, I found out that 
common/signals.c has calls to error and warning functions
without _() markups.
  Trying to add them, I realized that the problem
was that gdbserver did not use those markups.
  This leads to a conflict between gdbserver code
that has no internalization and gdb that requires it.

  The following patch adds a no-op underscore macro
to server.h in gdbserver sub-directory, allowing thus to use
_ macro in any new common code (I still have some
code of this kind to prepare for submission...).

  I have no idea if this is the correct answer to
the problem I raised above, but for me it seemed
a simple answer.

  All opinions welcome,


Pierre Muller
GDB pascal language maintainer


PS: This is an illustration of the multiple ChangeLog 
problem, this is really a unique patch,
but with two independent entries, this link will be lost..
Should I add a cross-reference to the other ChangeLog here?


Proposed patch:


gdb ChangeLog entry:

2011-03-18  Pierre Muller  <muller@ics.u-strasbg.fr>

	* common/signals.c (target_signal_from_host): Add _ markup to error
	function call message.
	(target_signal_to_host): Add _ markup and remove trailing new line
	from warning call message.
	(target_signal_from_command): Add _ markup to error function call
	message.

gdb/gdbserver ChangeLog entry:

2011-03-18  Pierre Muller  <muller@ics.u-strasbg.fr>

	* server.h (Macro _): Define it if not available.


Index: src/gdb/common/signals.c
===================================================================
RCS file: /cvs/src/src/gdb/common/signals.c,v
retrieving revision 1.6
diff -u -p -r1.6 signals.c
--- src/gdb/common/signals.c	6 Jan 2011 00:57:02 -0000	1.6
+++ src/gdb/common/signals.c	18 Mar 2011 09:48:37 -0000
@@ -349,8 +349,8 @@ target_signal_from_host (int hostsig)
 	return (enum target_signal)
 	  (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64);
       else
-	error ("GDB bug: target.c (target_signal_from_host): "
-	       "unrecognized real-time signal");
+	error (_("GDB bug: target.c (target_signal_from_host): "
+	       "unrecognized real-time signal"));
     }
 #endif
 
@@ -644,7 +644,7 @@ target_signal_to_host (enum target_signa
     {
       /* The user might be trying to do "signal SIGSAK" where this system
          doesn't have SIGSAK.  */
-      warning ("Signal %s does not exist on this system.\n",
+      warning (_("Signal %s does not exist on this system."),
 	       target_signal_to_name (oursig));
       return 0;
     }
@@ -667,8 +667,8 @@ target_signal_from_command (int num)
 {
   if (num >= 1 && num <= 15)
     return (enum target_signal) num;
-  error ("Only signals 1-15 are valid as numeric signals.\n\
-Use \"info signals\" for a list of symbolic signals.");
+  error (_("Only signals 1-15 are valid as numeric signals.\n\
+Use \"info signals\" for a list of symbolic signals."));
 }
 
 extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */
Index: src/gdb/gdbserver/server.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.h,v
retrieving revision 1.81
diff -u -p -r1.81 server.h
--- src/gdb/gdbserver/server.h	14 Feb 2011 11:13:12 -0000	1.81
+++ src/gdb/gdbserver/server.h	18 Mar 2011 09:48:37 -0000
@@ -96,6 +96,12 @@ int vsnprintf(char *str, size_t size, co
 #endif
 #endif
 
+/* Define underscore macro, if not available, to be able to use it inside
+   code shared with gdb in common directory.  */
+#ifndef _
+#define _(String) (String)
+#endif
+
 /* A type used for binary buffers.  */
 typedef unsigned char gdb_byte;



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