This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 6/7] i386.c: make "sorry" message more amenable to translation (PR target/79926)
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: roland dot illig at gmx dot de, Joseph Myers <joseph at codesourcery dot com>, David Malcolm <dmalcolm at redhat dot com>
- Date: Thu, 9 Mar 2017 12:45:28 -0500
- Subject: [PATCH 6/7] i386.c: make "sorry" message more amenable to translation (PR target/79926)
- Authentication-results: sourceware.org; auth=none
- References: <1489081529-22256-1-git-send-email-dmalcolm@redhat.com>
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);
--
1.8.5.3