Patchwork Fix reginfo.c i18n issue

login
register
mail settings
Submitter Joseph S. Myers
Date Nov. 11, 2010, 6:30 p.m.
Message ID <Pine.LNX.4.64.1011111829280.5853@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/70854/
State New
Headers show

Comments

Joseph S. Myers - Nov. 11, 2010, 6:30 p.m.
In the course of making the diagnostics cleanup in
<http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01102.html> I noticed a
diagnostic with multiple issues including inserting untranslated
English words from an array, which it seemed best to fix separately
rather than as part of that very mechanical patch.  I've now committed
this patch to use separate full sentences in each of the three cases.
Bootstrapped with no regressions on x86_64-unknown-linux-gnu.

2010-11-11  Joseph Myers  <joseph@codesourcery.com>

	* reginfo.c (fix_register): Avoid inserting English word in
	diagnostic sentence.  Use %qs for quoting and %'.

Patch

Index: gcc/reginfo.c
===================================================================
--- gcc/reginfo.c	(revision 166597)
+++ gcc/reginfo.c	(working copy)
@@ -770,12 +770,40 @@  fix_register (const char *name, int fixe
 	   )
 	  && (fixed == 0 || call_used == 0))
 	{
-	  static const char * const what_option[2][2] = {
-	    { "call-saved", "call-used" },
-	    { "no-such-option", "fixed" }};
-
-	  error ("can't use '%s' as a %s register", name,
-		 what_option[fixed][call_used]);
+	  switch (fixed)
+	    {
+	    case 0:
+	      switch (call_used)
+		{
+		case 0:
+		  error ("can%'t use %qs as a call-saved register", name);
+		  break;
+
+		case 1:
+		  error ("can%'t use %qs as a call-used register", name);
+		  break;
+
+		default:
+		  gcc_unreachable ();
+		}
+	      break;
+
+	    case 1:
+	      switch (call_used)
+		{
+		case 1:
+		  error ("can%'t use %qs as a fixed register", name);
+		  break;
+
+		case 0:
+		default:
+		  gcc_unreachable ();
+		}
+	      break;
+
+	    default:
+	      gcc_unreachable ();
+	    }
 	}
       else
 	{