Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Internationalization markup of messages and common code
@ 2011-03-18 13:07 Pierre Muller
  2011-03-18 13:12 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre Muller @ 2011-03-18 13:07 UTC (permalink / raw)
  To: gdb-patches

  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;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] Internationalization markup of messages and common code
  2011-03-18 13:07 [RFC] Internationalization markup of messages and common code Pierre Muller
@ 2011-03-18 13:12 ` Pedro Alves
  2011-03-18 13:31   ` Pierre Muller
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2011-03-18 13:12 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pierre Muller

On Friday 18 March 2011 10:23:01, Pierre Muller wrote:
> 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.

Okay.  The right fix IMO, is to move gdb_locale.h to common/.
One of Kwok's patches does that, but I don't know when he'll
be posting them.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [RFC] Internationalization markup of messages and common code
  2011-03-18 13:12 ` Pedro Alves
@ 2011-03-18 13:31   ` Pierre Muller
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre Muller @ 2011-03-18 13:31 UTC (permalink / raw)
  To: 'Pedro Alves', gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : vendredi 18 mars 2011 13:12
> À : gdb-patches@sourceware.org
> Cc : Pierre Muller
> Objet : Re: [RFC] Internationalization markup of messages and common
> code
> 
> On Friday 18 March 2011 10:23:01, Pierre Muller wrote:
> > 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.
> 
> Okay.  

  Thanks for the approval,
I committed the patch.

> The right fix IMO, is to move gdb_locale.h to common/.
> One of Kwok's patches does that, but I don't know when he'll
> be posting them.
  It shouldn't be too hard to fix the conflict generated by my patch,
if any.

Pierre


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-18 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-18 13:07 [RFC] Internationalization markup of messages and common code Pierre Muller
2011-03-18 13:12 ` Pedro Alves
2011-03-18 13:31   ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox