This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [PATCH 6/7] i386.c: make "sorry" message more amenable to translation (PR target/79926)


On 03/09/2017 10:45 AM, David Malcolm wrote:
PR target/79926 notes that in:

    sorry ("%s instructions aren't allowed in %s service routine",
           isa, (cfun->machine->func_type == TYPE_EXCEPTION
                 ? "exception" : "interrupt"));

the text from the second %s won't be translated, but should be.

This patch reworks the diagnostic by breaking it out into two messages
and marking them with G_() so they're seen by xgettext; a test run of
xgettext confirms that both messages make it into po/gcc.pot (in an
earlier version of the patch I attempted to do it without introducing
a local, but xgettext only picked up on one of the strings).

gcc/ChangeLog:
	PR target/79926
	* config/i386/i386.c (ix86_set_current_function): Make "sorry"
	message more amenable to translation.
---
 gcc/config/i386/i386.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e705a3e..b8688e3 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7271,9 +7271,15 @@ ix86_set_current_function (tree fndecl)
       if (isa != NULL)
 	{
 	  if (cfun->machine->func_type != TYPE_NORMAL)
-	    sorry ("%s instructions aren't allowed in %s service routine",
-		   isa, (cfun->machine->func_type == TYPE_EXCEPTION
-			 ? "exception" : "interrupt"));
+	    {
+	      const char *msgid
+		= (cfun->machine->func_type == TYPE_EXCEPTION
+		   ? G_("%s instructions aren't allowed in"
+			" exception service routine")
+		   : G_("%s instructions aren't allowed in"
+			" interrupt service routine"));
+	      sorry (msgid, isa);
+	    }
 	  else
 	    sorry ("%s instructions aren't allowed in function with "
 		   "no_caller_saved_registers attribute", isa);


Just a very minor point but I think one in line with the rest
of the problems addressed by these patches:  in the last sorry,
no_caller_saved_registers should be quoted in %< and %>.

(Also, although it's often left out, the other message above
seem like they could do with an article:

  instructions aren't allowed in <ins>an </ins>interrupt service
  routine)

Martin


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