[PATCH] c++ i18n fixes

Bonzini bonzini@gnu.org
Wed Jun 19 06:38:00 GMT 2002


This patch fixes all the i18n problems in the C++ front-ends that are
related to %s substitions in cp/*.c

A couple of error messages were reformatted to ease the change.  The
"candidates are:" message is printed in a separate line (but not
"candidate is:" which is still followed by the sole candidate) to
achieve better alignment, and "used for" was changed to "used as" where
it was applicable so that it is always followed (in the languages I know
about) by accusative.

A new file was created to hold various template strings (enumerated by
enum i18n_string) preceded by various prepositions, so that languages
with cases can use them.

2002-06-19  Paolo Bonzini  <bonzini@gnu.org>

        I18n fixes for the C++ front-end: new files and their users
        * cp/cp-i18n.c, cp/cp-i18n.h: new files
        * cp/Make-lang.in: add cp-i18n dependencies
        * cp/lex.c (cxx_init): call init_cp_i18n
        * cp/call.c (op_error): accept a boolean to indicate
        no match/ambiguous match, instead of a string.  Callers
        adjusted.
        * cp/cvt.c (convert_to_void): accept an enum i18n_string
        instead of a string.  Callers adjusted.
        * cp/decl.c (bad_specifiers): likewise
        * cp/typeck.c (build_indirect_ref, build_x_indirect_ref,
        composite_pointer_type, convert_for_assignment,
        convert_for_initialization, dubious_conversion_warnings):
        likewise
        * cp/typeck2.c (check_for_new_type): likewise
        * cp/typeck.c (convert_arguments): likewise for variable
        called_thing.

        I18n fixes for the C++ front-end: conditional expressions
        * cp/decl.c (duplicate_decls, grokfndecl, grokdeclarator,
        grokparms, grok_op_properties): use separate calls to printing
        functions instead of conditional expressions
        * cp/decl2.c (grok_method_quals): likewise
        * cp/error.c (dump_global_iord): likewise
        * cp/lex.c (check_for_missing_semicolon): likewise
        * cp/method.c (hack_identifier): likewise
        * cp/pt.c (tsubst): likewise
        * cp/typeck.c (build_binary_op, build_unary_op): likewise
        * cp/pt.c (redeclare_class_template): likewise, with ngettext

        I18n fixes for the C++ front-end: missing N_
        * cp/decl.c (create_array_type_for_decl): wrap assignments to
        error_msg into N_.
        * cp/rtti.c (build_dynamic_cast_1): likewise for errstr
        * cp/typeck.c (build_unary_op): likewise for errstring
        * cp/typeck2.c (readonly_error): likewise for fmt

        I18n fixes for the C++ front-end: `candidates are:..."
        * cp/call.c (print_z_candidates): reformat error message to
        allow easier translation.  `candidates are:' is on a separate line.
        * cp/decl2.c (check_classfn): likewise
        * cp/pt.c (print_candidates, instantiate_class_template): likewise

        I18N fixes for the C++ front-end: miscellaneous
        * cp/error.c (in_function): new name of function_category; return
        complete message "In xxxx `%s':".  Caller adjusted.
	* cp/tree.c (lvalue_or_else): second parameter now named msgid.
	Complete error message is passed as second parameter.  Callers
	adjusted.

diff -rpNU3 gcc-checkout/cp-old/Make-lang.in gcc-checkout/gcc/gcc/cp/Make-lang.in
--- gcc-checkout/cp-old/Make-lang.in	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/Make-lang.in	Mon Jun 17 05:41:16 2002
@@ -103,7 +103,7 @@ CXX_OBJS = cp/call.o cp/decl.o cp/expr.o
  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \
  cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
  cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \
- cp/optimize.o cp/mangle.o cp/cp-lang.o
+ cp/optimize.o cp/mangle.o cp/cp-lang.o cp/cp-i18n.o
 
 # Use loose warnings for this front end.
 cp-warn =
@@ -286,6 +286,7 @@ cp/except.o: cp/except.c $(CXX_TREE_H) f
   cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h
 cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
   except.h $(TM_P_H)
+cp/cp-i18n.o: cp/cp-i18n.c 
 cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
   $(GGC_H) $(RTL_H) except.h tree-inline.h gt-cp-pt.h
 cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h \
diff -rpNU3 gcc-checkout/cp-old/call.c gcc-checkout/gcc/gcc/cp/call.c
--- gcc-checkout/cp-old/call.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/call.c	Mon Jun 17 10:34:09 2002
@@ -28,8 +28,10 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "output.h"
 #include "flags.h"
+#include "intl.h"
 #include "rtl.h"
 #include "toplev.h"
 #include "expr.h"
@@ -53,7 +55,7 @@ static tree build_java_interface_fn_ref 
   convert_like_real ((CONV), (EXPR), (FN), (ARGNO), 0)
 static tree convert_like_real PARAMS ((tree, tree, tree, int, int));
 static void op_error PARAMS ((enum tree_code, enum tree_code, tree, tree,
-			    tree, const char *));
+			    tree, int));
 static tree build_object_call PARAMS ((tree, tree));
 static tree resolve_args PARAMS ((tree));
 static struct z_candidate * build_user_type_conversion_1
@@ -151,7 +153,7 @@ build_field_call (basetype_path, instanc
     {
       /* If it's a field, try overloading operator (),
 	 or calling if the field is a pointer-to-function.  */
-      instance = build_indirect_ref (instance_ptr, NULL);
+      instance = build_indirect_ref (instance_ptr, I18N_NULL);
       instance = build_component_ref_1 (instance, field, 0);
 
       if (instance == error_mark_node)
@@ -2358,7 +2360,21 @@ static void
 print_z_candidates (candidates)
      struct z_candidate *candidates;
 {
-  const char *str = "candidates are:";
+  int count = 0;
+  struct z_candidate *iter;
+  const char *str;
+  for (iter = candidates; iter; iter = iter->next)
+    count++;
+
+  str = ngettext ("candidate is:", "candidates are:", count);
+  if (count != 1)
+    {
+      /* For more than 1 candidate, print an introductory line
+         followed by the indented candidates. */
+      error (str);
+      str = " ";
+    }
+
   for (; candidates; candidates = candidates->next)
     {
       if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE)
@@ -2380,8 +2396,7 @@ print_z_candidates (candidates)
 	error ("%s %T <conversion>", str, candidates->fn);
       else
 	cp_error_at ("%s %+#D%s", str, candidates->fn,
-		     candidates->viable == -1 ? " <near match>" : "");
-      str = "               "; 
+		     candidates->viable == -1 ? _(" <near match>") : "");
     }
 }
 
@@ -2792,10 +2807,10 @@ build_object_call (obj, args)
 }
 
 static void
-op_error (code, code2, arg1, arg2, arg3, problem)
+op_error (code, code2, arg1, arg2, arg3, match)
      enum tree_code code, code2;
      tree arg1, arg2, arg3;
-     const char *problem;
+     int match;
 {
   const char *opname;
 
@@ -2807,23 +2822,45 @@ op_error (code, code2, arg1, arg2, arg3,
   switch (code)
     {
     case COND_EXPR:
-      error ("%s for `%T ? %T : %T' operator", problem,
+      if (match)
+        error ("ambiguous overload for `%T ? %T : %T' operator",
+		error_type (arg1), error_type (arg2), error_type (arg3));
+      else
+        error ("no match for `%T ? %T : %T' operator",
 		error_type (arg1), error_type (arg2), error_type (arg3));
       break;
     case POSTINCREMENT_EXPR:
     case POSTDECREMENT_EXPR:
-      error ("%s for `%T %s' operator", problem, error_type (arg1), opname);
+      if (match)
+        error ("ambiguous overload for `%T %s' operator",
+		error_type (arg1), opname);
+      else
+        error ("no match for `%T %s' operator",
+		error_type (arg1), opname);
       break;
     case ARRAY_REF:
-      error ("%s for `%T [%T]' operator", problem,
+      if (match)
+        error ("ambiguous overload for `%T [%T]' operator",
+		error_type (arg1), error_type (arg2));
+      else
+        error ("no match for `%T [%T]' operator",
 		error_type (arg1), error_type (arg2));
       break;
     default:
       if (arg2)
-	error ("%s for `%T %s %T' operator", problem,
+        if (match)
+          error ("ambiguous overload for `%T %s %T' operator",
+		  error_type (arg1), opname, error_type (arg2));
+        else
+          error ("no match for `%T %s %T' operator",
 		  error_type (arg1), opname, error_type (arg2));
       else
-	error ("%s for `%s %T' operator", problem, opname, error_type (arg1));
+        if (match)
+          error ("ambiguous overload for `%s %T' operator",
+		  opname, error_type (arg1));
+        else
+          error ("no match for `%s %T' operator",
+		  opname, error_type (arg1));
     }
 }
 
@@ -3079,7 +3116,7 @@ build_conditional_expr (arg1, arg2, arg3
 	 ill-formed.  */
       if (!any_viable (candidates))
 	{
-	  op_error (COND_EXPR, NOP_EXPR, arg1, arg2, arg3, "no match");
+	  op_error (COND_EXPR, NOP_EXPR, arg1, arg2, arg3, FALSE);
 	  print_z_candidates (candidates);
 	  return error_mark_node;
 	}
@@ -3087,7 +3124,7 @@ build_conditional_expr (arg1, arg2, arg3
       cand = tourney (candidates);
       if (!cand)
 	{
-	  op_error (COND_EXPR, NOP_EXPR, arg1, arg2, arg3, "no match");
+	  op_error (COND_EXPR, NOP_EXPR, arg1, arg2, arg3, FALSE);
 	  print_z_candidates (candidates);
 	  return error_mark_node;
 	}
@@ -3200,7 +3237,7 @@ build_conditional_expr (arg1, arg2, arg3
 	       && TYPE_PTRMEMFUNC_P (arg3_type)))
     {
       result_type = composite_pointer_type (arg2_type, arg3_type, arg2,
-					    arg3, "conditional expression");
+					    arg3, I18N_COND_EXPR);
       arg2 = perform_implicit_conversion (result_type, arg2);
       arg3 = perform_implicit_conversion (result_type, arg3);
     }
@@ -3450,7 +3487,7 @@ build_new_op (code, flags, arg1, arg2, a
 	}
       if (flags & LOOKUP_COMPLAIN)
 	{
-	  op_error (code, code2, arg1, arg2, arg3, "no match");
+	  op_error (code, code2, arg1, arg2, arg3, FALSE);
 	  print_z_candidates (candidates);
 	}
       return error_mark_node;
@@ -3462,7 +3499,7 @@ build_new_op (code, flags, arg1, arg2, a
     {
       if (flags & LOOKUP_COMPLAIN)
 	{
-	  op_error (code, code2, arg1, arg2, arg3, "ambiguous overload");
+	  op_error (code, code2, arg1, arg2, arg3, TRUE);
 	  print_z_candidates (candidates);
 	}
       return error_mark_node;
@@ -3543,7 +3580,7 @@ builtin:
       return build_modify_expr (arg1, code2, arg2);
 
     case INDIRECT_REF:
-      return build_indirect_ref (arg1, "unary *");
+      return build_indirect_ref (arg1, I18N_UNARY_STAR);
 
     case PLUS_EXPR:
     case MINUS_EXPR:
@@ -3587,7 +3624,7 @@ builtin:
 
     case MEMBER_REF:
       return build_m_component_ref
-	(build_indirect_ref (arg1, NULL), arg2);
+	(build_indirect_ref (arg1, I18N_NULL), arg2);
 
       /* The caller will deal with these.  */
     case ADDR_EXPR:
@@ -3819,7 +3856,7 @@ convert_like_real (convs, expr, fn, argn
   
   if (!inner)
     expr = dubious_conversion_warnings
-             (totype, expr, "argument", fn, argnum);
+             (totype, expr, I18N_ARGUMENT, fn, argnum);
   switch (TREE_CODE (convs))
     {
     case USER_CONV:
@@ -3937,7 +3974,7 @@ convert_like_real (convs, expr, fn, argn
 	  /* Build an expression for `*((base*) &expr)'.  */
 	  expr = build_unary_op (ADDR_EXPR, expr, 0);
 	  expr = perform_implicit_conversion (base_ptr, expr);
-	  expr = build_indirect_ref (expr, "implicit conversion");
+	  expr = build_indirect_ref (expr, I18N_IMPLICIT_CONVERSION);
 	  return expr;
 	}
 
@@ -4118,7 +4155,7 @@ convert_default_arg (type, arg, fn, parm
     {
       arg = digest_init (type, arg, 0);
       arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
-					"default argument", fn, parmnum);
+					I18N_DEFAULT_ARGUMENT, fn, parmnum);
     }
   else
     {
@@ -4127,7 +4164,7 @@ convert_default_arg (type, arg, fn, parm
 	arg = copy_node (arg);
 
       arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
-					"default argument", fn, parmnum);
+					I18N_DEFAULT_ARGUMENT, fn, parmnum);
       if (PROMOTE_PROTOTYPES
 	  && INTEGRAL_TYPE_P (type)
 	  && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
@@ -4282,7 +4319,7 @@ build_over_call (cand, args, flags)
       if (targ)
 	arg = targ;
       else
-	arg = build_indirect_ref (arg, 0);
+	arg = build_indirect_ref (arg, I18N_NULL);
 
       /* [class.copy]: the copy constructor is implicitly defined even if
 	 the implementation elided its use.  */
@@ -4313,7 +4350,7 @@ build_over_call (cand, args, flags)
 	{
 	  tree address;
 	  tree to = stabilize_reference
-	    (build_indirect_ref (TREE_VALUE (args), 0));
+	    (build_indirect_ref (TREE_VALUE (args), I18N_NULL));
 
 	  val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
 	  address = build_unary_op (ADDR_EXPR, val, 0);
@@ -4328,9 +4365,10 @@ build_over_call (cand, args, flags)
 	   && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
     {
       tree to = stabilize_reference
-	(build_indirect_ref (TREE_VALUE (converted_args), 0));
+	(build_indirect_ref (TREE_VALUE (converted_args), I18N_NULL));
 
-      arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
+      arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 
+		      		I18N_NULL);
       if (is_empty_class (TREE_TYPE (to)))
 	{
 	  TREE_USED (arg) = 1;
@@ -4369,7 +4407,8 @@ build_over_call (cand, args, flags)
       if (DECL_CONTEXT (fn) && TYPE_JAVA_INTERFACE (DECL_CONTEXT (fn)))
 	fn = build_java_interface_fn_ref (fn, *p);
       else
-	fn = build_vfn_ref (build_indirect_ref (*p, 0), DECL_VINDEX (fn));
+	fn = build_vfn_ref (build_indirect_ref (*p, I18N_NULL),
+			    DECL_VINDEX (fn));
       TREE_TYPE (fn) = t;
     }
   else if (DECL_INLINE (fn))
@@ -4433,7 +4472,7 @@ build_java_interface_fn_ref (fn, instanc
 
   /* Look up the pointer to the runtime java.lang.Class object for `instance'. 
      This is the first entry in the vtable. */
-  klass_ref = build_vtbl_ref (build_indirect_ref (instance, 0), 
+  klass_ref = build_vtbl_ref (build_indirect_ref (instance, I18N_NULL), 
 			      integer_zero_node);
 
   /* Get the java.lang.Class pointer for the interface being called. */
diff -rpNU3 gcc-checkout/cp-old/class.c gcc-checkout/gcc/gcc/cp/class.c
--- gcc-checkout/cp-old/class.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/class.c	Mon Jun 17 10:34:19 2002
@@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "flags.h"
 #include "rtl.h"
 #include "output.h"
@@ -305,7 +306,7 @@ build_base_path (code, expr, binfo, nonn
       /* Going via virtual base V_BINFO.  We need the static offset
          from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
          V_BINFO.  That offset is an entry in D_BINFO's vtable.  */
-      tree v_offset = build_vfield_ref (build_indirect_ref (expr, NULL),
+      tree v_offset = build_vfield_ref (build_indirect_ref (expr, I18N_NULL),
 					TREE_TYPE (TREE_TYPE (expr)));
       
       v_binfo = binfo_for_vbase (BINFO_TYPE (v_binfo), BINFO_TYPE (d_binfo));
@@ -315,7 +316,7 @@ build_base_path (code, expr, binfo, nonn
       v_offset = build1 (NOP_EXPR, 
 			 build_pointer_type (ptrdiff_type_node),
 			 v_offset);
-      v_offset = build_indirect_ref (v_offset, NULL);
+      v_offset = build_indirect_ref (v_offset, I18N_NULL);
       TREE_CONSTANT (v_offset) = 1;
 
       offset = cp_convert (ptrdiff_type_node,
@@ -353,7 +354,7 @@ build_base_path (code, expr, binfo, nonn
     null_test = NULL;
   
   if (!want_pointer)
-    expr = build_indirect_ref (expr, NULL);
+    expr = build_indirect_ref (expr, I18N_NULL);
 
   if (null_test)
     expr = build (COND_EXPR, target_type, null_test,
diff -rpNU3 gcc-checkout/cp-old/cp-i18n.c gcc-checkout/gcc/gcc/cp/cp-i18n.c
--- gcc-checkout/cp-old/cp-i18n.c	Wed Dec 31 19:00:00 1969
+++ gcc-checkout/gcc/gcc/cp/cp-i18n.c	Wed Jun 19 09:16:07 2002
@@ -0,0 +1,341 @@
+/* Strings with preposition for internationalization of parameterized strings.
+   Copyright (C) 2002  Free Software Foundation, Inc.
+   Contributed by Paolo Bonzini (bonzini@gnu.org)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+#include "config.h"
+#include "system.h"
+#include "intl.h"
+#include "cp-i18n.h"
+
+const char *i18n_within[I18N_LAST + 1] = {
+  NULL,
+  N_("within conversion"),
+  N_("within comparison"),
+  N_("within unary *"),
+  N_("within implicit conversion"),
+  N_("within argument passing"),
+  N_("within argument"),
+  N_("within array indexing"),
+  N_("within conditional expression"),
+  N_("within assignment"),
+  N_("within statement"),
+  N_("within default argument"),
+  N_("within initialization"),
+  N_("within return"),
+  N_("within cast"),
+  N_("within void cast"),
+  N_("within void context"),
+  N_("within left-hand operand of comma"),
+  N_("within function"),
+  N_("within member function"),
+  N_("within destructor"),
+  N_("within constructor"),
+  N_("within copy constructor"),
+  N_("within static member function"),
+  N_("within return type"),
+  N_("within static_cast"),
+  N_("within dynamic_cast"),
+  N_("within reinterpret_cast"),
+  N_("within const_cast"),
+  N_("within typeid"),
+  N_("within sizeof"),
+  N_("within alignof"),
+  N_("within new"),
+  N_("within delete"),
+  N_("within exception declarations"),
+  N_("within exception specifier"),
+  N_("within argument list"),
+  N_("within __builtin_va_arg"),
+  N_("within field"),
+  N_("within type"),
+  N_("within parameter"),
+  N_("within variable"),
+  N_("within unary &"),
+  N_("within increment"),
+  N_("within decrement")
+};
+
+const char *i18n_in[I18N_LAST + 1] = {
+  NULL,
+  N_("in conversion"),
+  N_("in comparison"),
+  N_("in unary *"),
+  N_("in implicit conversion"),
+  N_("in array indexing"),
+  N_("in conditional expression"),
+  N_("in argument passing"),
+  N_("in argument"),
+  N_("in assignment"),
+  N_("in statement"),
+  N_("in default argument"),
+  N_("in initialization"),
+  N_("in return"),
+  N_("in cast"),
+  N_("in void cast"),
+  N_("in void context"),
+  N_("in left-hand operand of comma"),
+  N_("in function"),
+  N_("in member function"),
+  N_("in destructor"),
+  N_("in constructor"),
+  N_("in copy constructor"),
+  N_("in static member function"),
+  N_("in return type"),
+  N_("in static_cast"),
+  N_("in dynamic_cast"),
+  N_("in reinterpret_cast"),
+  N_("in const_cast"),
+  N_("in typeid"),
+  N_("in sizeof"),
+  N_("in alignof"),
+  N_("in new"),
+  N_("in delete"),
+  N_("in exception declarations"),
+  N_("in exception specifier"),
+  N_("in argument list"),
+  N_("in __builtin_va_arg"),
+  N_("in field"),
+  N_("in type"),
+  N_("in parameter"),
+  N_("in variable"),
+  N_("in unary &"),
+  N_("in increment"),
+  N_("in decrement")
+};
+
+const char *i18n_to[I18N_LAST + 1] = {
+  NULL,
+  N_("to conversion"),
+  N_("to comparison"),
+  N_("to unary *"),
+  N_("to implicit conversion"),
+  N_("to argument passing"),
+  N_("to argument"),
+  N_("to array indexing"),
+  N_("to conditional expression"),
+  N_("to assignment"),
+  N_("to statement"),
+  N_("to default argument"),
+  N_("to initialization"),
+  N_("to return"),
+  N_("to cast"),
+  N_("to void cast"),
+  N_("to void context"),
+  N_("to left-hand operand of comma"),
+  N_("to function"),
+  N_("to member function"),
+  N_("to destructor"),
+  N_("to constructor"),
+  N_("to copy constructor"),
+  N_("to static member function"),
+  N_("to return type"),
+  N_("to static_cast"),
+  N_("to dynamic_cast"),
+  N_("to reinterpret_cast"),
+  N_("to const_cast"),
+  N_("to typeid"),
+  N_("to sizeof"),
+  N_("to alignof"),
+  N_("to new"),
+  N_("to delete"),
+  N_("to exception declarations"),
+  N_("to exception specifier"),
+  N_("to argument list"),
+  N_("to __builtin_va_arg"),
+  N_("to field"),
+  N_("to type"),
+  N_("to parameter"),
+  N_("to variable"),
+  N_("to unary &"),
+  N_("to increment"),
+  N_("to decrement")
+};
+
+const char *i18n_of[I18N_LAST + 1] = {
+  NULL,
+  N_("of conversion"),
+  N_("of comparison"),
+  N_("of unary *"),
+  N_("of implicit conversion"),
+  N_("of argument passing"),
+  N_("of argument"),
+  N_("of array indexing"),
+  N_("of conditional expression"),
+  N_("of assignment"),
+  N_("of statement"),
+  N_("of default argument"),
+  N_("of initialization"),
+  N_("of return"),
+  N_("of cast"),
+  N_("of void cast"),
+  N_("of void context"),
+  N_("of left-hand operand of comma"),
+  N_("of function"),
+  N_("of member function"),
+  N_("of destructor"),
+  N_("of constructor"),
+  N_("of copy constructor"),
+  N_("of static member function"),
+  N_("of return type"),
+  N_("of static_cast"),
+  N_("of dynamic_cast"),
+  N_("of reinterpret_cast"),
+  N_("of const_cast"),
+  N_("of typeid"),
+  N_("of sizeof"),
+  N_("of alignof"),
+  N_("of new"),
+  N_("of delete"),
+  N_("of exception declarations"),
+  N_("of exception specifier"),
+  N_("of argument list"),
+  N_("of __builtin_va_arg"),
+  N_("of field"),
+  N_("of type"),
+  N_("of parameter"),
+  N_("of variable"),
+  N_("of unary &"),
+  N_("of increment"),
+  N_("of decrement")
+};
+
+const char *i18n_subject[I18N_LAST + 1] = {
+  NULL,
+  N_("conversion"),
+  N_("comparison"),
+  N_("unary *"),
+  N_("implicit conversion"),
+  N_("array indexing"),
+  N_("conditional expression"),
+  N_("argument passing"),
+  N_("argument"),
+  N_("assignment"),
+  N_("statement"),
+  N_("default argument"),
+  N_("initialization"),
+  N_("return"),
+  N_("cast"),
+  N_("void cast"),
+  N_("void context"),
+  N_("left-hand operand of comma"),
+  N_("function"),
+  N_("member function"),
+  N_("destructor"),
+  N_("constructor"),
+  N_("copy constructor"),
+  N_("static member function"),
+  N_("return type"),
+  N_("static_cast"),
+  N_("dynamic_cast"),
+  N_("reinterpret_cast"),
+  N_("const_cast"),
+  N_("typeid"),
+  N_("sizeof"),
+  N_("alignof"),
+  N_("new"),
+  N_("delete"),
+  N_("exception declarations"),
+  N_("exception specifier"),
+  N_("argument list"),
+  N_("__builtin_va_arg"),
+  N_("field"),
+  N_("type"),
+  N_("parameter"),
+  N_("variable"),
+  N_("unary &"),
+  N_("increment"),
+  N_("decrement")
+};
+
+
+const char *i18n_accus[I18N_LAST + 1] = {
+  NULL,
+  /* TRANSLATORS: leave the "accus: " prefix, it is necessary so that gettext
+     distinguishes these strings from the above ones.  These strings go into
+     accusative for languages that distinguish accusative and nominative
+     (e.g. German, Finnish).  */
+  N_("accus: conversion"),
+  N_("accus: comparison"),
+  N_("accus: unary *"),
+  N_("accus: implicit conversion"),
+  N_("accus: array indexing"),
+  N_("accus: conditional expression"),
+  N_("accus: argument passing"),
+  N_("accus: argument"),
+  N_("accus: assignment"),
+  N_("accus: statement"),
+  N_("accus: default argument"),
+  N_("accus: initialization"),
+  N_("accus: return"),
+  N_("accus: cast"),
+  N_("accus: void cast"),
+  N_("accus: void context"),
+  N_("accus: left-hand operand of comma"),
+  N_("accus: function"),
+  N_("accus: member function"),
+  N_("accus: destructor"),
+  N_("accus: constructor"),
+  N_("accus: copy constructor"),
+  N_("accus: static member function"),
+  N_("accus: return type"),
+  N_("accus: static_cast"),
+  N_("accus: dynamic_cast"),
+  N_("accus: reinterpret_cast"),
+  N_("accus: const_cast"),
+  N_("accus: typeid"),
+  N_("accus: sizeof"),
+  N_("accus: alignof"),
+  N_("accus: new"),
+  N_("accus: delete"),
+  N_("accus: exception declarations"),
+  N_("accus: exception specifier"),
+  N_("accus: argument list"),
+  N_("accus: __builtin_va_arg"),
+  N_("accus: field"),
+  N_("accus: type"),
+  N_("accus: parameter"),
+  N_("accus: variable"),
+  N_("accus: unary &"),
+  N_("accus: increment"),
+  N_("accus: decrement")
+};
+
+void
+init_cp_i18n ()
+{
+  int i;
+  static int initialized = FALSE;
+
+  if (initialized)
+    return;
+
+  initialized = TRUE;
+  for (i = I18N_NULL + 1; i <= I18N_LAST; i++)
+    {
+      i18n_within[i] = gettext(i18n_within[i]);
+      i18n_in[i] = gettext(i18n_in[i]);
+      i18n_to[i] = gettext(i18n_to[i]);
+      i18n_of[i] = gettext(i18n_of[i]);
+      i18n_subject[i] = gettext(i18n_subject[i]);
+      i18n_accus[i] = gettext(i18n_accus[i]) + 7;   /* remove the "accus: " prefix */
+    }
+}
+
diff -rpNU3 gcc-checkout/cp-old/cp-i18n.h gcc-checkout/gcc/gcc/cp/cp-i18n.h
--- gcc-checkout/cp-old/cp-i18n.h	Wed Dec 31 19:00:00 1969
+++ gcc-checkout/gcc/gcc/cp/cp-i18n.h	Wed Jun 19 09:11:35 2002
@@ -0,0 +1,92 @@
+/* Strings with preposition for internationalization of parameterized strings.
+   Copyright (C) 2002  Free Software Foundation, Inc.
+   Contributed by Paolo Bonzini (bonzini@gnu.org)
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifndef GCC_CP_I18N_H
+#define GCC_CP_I18N_H
+
+enum i18n_string {
+  I18N_NULL,
+  I18N_CONVERSION,
+  I18N_COMPARISON,
+  I18N_UNARY_STAR,
+  I18N_IMPLICIT_CONVERSION,
+  I18N_ARRAY_INDEXING,
+  I18N_COND_EXPR,
+  I18N_ARGUMENT_PASSING,
+  I18N_ARGUMENT,
+  I18N_ASSIGNMENT,
+  I18N_STATEMENT,
+  I18N_DEFAULT_ARGUMENT,
+  I18N_INITIALIZATION,
+  I18N_RETURN,
+  I18N_CAST,
+  I18N_VOID_CAST,
+  I18N_VOID_CONTEXT,
+  I18N_COMMA_LHS,
+  I18N_FUNCTION,
+  I18N_MEMBER_FUNCTION,
+  I18N_DESTRUCTOR,
+  I18N_CONSTRUCTOR,
+  I18N_COPY_CONSTRUCTOR,
+  I18N_STATIC_MEMBER_FUNCTION,
+  I18N_RETURN_TYPE,
+  I18N_STATIC_CAST,
+  I18N_DYNAMIC_CAST,
+  I18N_REINTERPRET_CAST,
+  I18N_CONST_CAST,
+  I18N_TYPEID,
+  I18N_SIZEOF,
+  I18N_ALIGNOF,
+  I18N_NEW,
+  I18N_DELETE,
+  I18N_EXCEPTION_DECLARATIONS,
+  I18N_EXCEPTION_SPECIFIER,
+  I18N_ARGUMENT_LIST,
+  I18N_BUILTIN_VA_ARG,
+  I18N_FIELD,
+  I18N_TYPE,
+  I18N_PARAMETER,
+  I18N_VARIABLE,
+  I18N_UNARY_AMP,
+  I18N_INCREMENT,
+  I18N_DECREMENT,
+  I18N_LAST = I18N_DECREMENT
+};
+
+/* These variables hold strings for the various entities that
+   can appear in a C++ program (feel free to add them if there is
+   need for more), further specified in different grammatical
+   meanings so that translators can use the appropriate prepositions
+   or cases.  Note that there are languages such as Finnish that
+   don't use a preposition for "in".
+   
+   In the future there might be a need for more prepositions
+   (more arrays). */
+extern const char *i18n_within[];
+extern const char *i18n_in[];
+extern const char *i18n_of[];
+extern const char *i18n_to[];
+extern const char *i18n_subject[];
+extern const char *i18n_accus[];
+
+extern void init_cp_i18n PARAMS((void));
+
+#endif /* GCC_CP_I18N_H */
diff -rpNU3 gcc-checkout/cp-old/cp-tree.h gcc-checkout/gcc/gcc/cp/cp-tree.h
--- gcc-checkout/cp-old/cp-tree.h	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/cp-tree.h	Mon Jun 17 10:37:29 2002
@@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #include "c-common.h"
+#include "cp-i18n.h"
 
 struct diagnostic_context;
 
@@ -3726,7 +3727,7 @@ extern tree convert_from_reference		PARA
 extern tree convert_lvalue			PARAMS ((tree, tree));
 extern tree ocp_convert				PARAMS ((tree, tree, int, int));
 extern tree cp_convert				PARAMS ((tree, tree));
-extern tree convert_to_void			PARAMS ((tree, const char */*implicit context*/));
+extern tree convert_to_void			PARAMS ((tree, enum i18n_string/*implicit context*/));
 extern tree convert_force			PARAMS ((tree, tree, int));
 extern tree build_type_conversion		PARAMS ((tree, tree, int));
 extern tree build_expr_type_conversion		PARAMS ((int, tree, int));
@@ -4423,8 +4424,8 @@ extern tree build_object_ref			PARAMS ((
 extern tree build_component_ref_1		PARAMS ((tree, tree, int));
 extern tree build_component_ref			PARAMS ((tree, tree, tree, int));
 extern tree build_x_component_ref		PARAMS ((tree, tree, tree, int));
-extern tree build_x_indirect_ref		PARAMS ((tree, const char *));
-extern tree build_indirect_ref			PARAMS ((tree, const char *));
+extern tree build_x_indirect_ref		PARAMS ((tree, enum i18n_string));
+extern tree build_indirect_ref			PARAMS ((tree, enum i18n_string));
 extern tree build_array_ref			PARAMS ((tree, tree));
 extern tree build_x_function_call		PARAMS ((tree, tree, tree));
 extern tree get_member_function_from_ptrfunc	PARAMS ((tree *, tree));
@@ -4443,8 +4444,8 @@ extern tree build_const_cast			PARAMS ((
 extern tree build_c_cast			PARAMS ((tree, tree));
 extern tree build_x_modify_expr			PARAMS ((tree, enum tree_code, tree));
 extern tree build_modify_expr			PARAMS ((tree, enum tree_code, tree));
-extern tree dubious_conversion_warnings         PARAMS ((tree, tree, const char *, tree, int));
-extern tree convert_for_initialization		PARAMS ((tree, tree, tree, int, const char *, tree, int));
+extern tree dubious_conversion_warnings         PARAMS ((tree, tree, enum i18n_string, tree, int));
+extern tree convert_for_initialization		PARAMS ((tree, tree, tree, int, enum i18n_string, tree, int));
 extern int comp_ptr_ttypes			PARAMS ((tree, tree));
 extern int ptr_reasonably_similar		PARAMS ((tree, tree));
 extern tree build_ptrmemfunc			PARAMS ((tree, tree, int));
@@ -4457,7 +4458,7 @@ extern void expand_ptrmemfunc_cst       
 extern tree pfn_from_ptrmemfunc                 PARAMS ((tree));
 extern tree type_after_usual_arithmetic_conversions PARAMS ((tree, tree));
 extern tree composite_pointer_type              PARAMS ((tree, tree, tree, tree,
-						       const char*));
+						       enum i18n_string));
 extern tree merge_types				PARAMS ((tree, tree));
 extern tree check_return_expr                   PARAMS ((tree));
 #define cp_build_binary_op(code, arg1, arg2) \
@@ -4484,7 +4485,7 @@ extern tree build_scoped_ref			PARAMS ((
 extern tree build_x_arrow			PARAMS ((tree));
 extern tree build_m_component_ref		PARAMS ((tree, tree));
 extern tree build_functional_cast		PARAMS ((tree, tree));
-extern void check_for_new_type			PARAMS ((const char *, flagged_type_tree));
+extern void check_for_new_type			PARAMS ((enum i18n_string, flagged_type_tree));
 extern tree add_exception_specifier             PARAMS ((tree, tree, int));
 extern tree merge_exception_specifiers          PARAMS ((tree, tree));
 
diff -rpNU3 gcc-checkout/cp-old/cvt.c gcc-checkout/gcc/gcc/cp/cvt.c
--- gcc-checkout/cp-old/cvt.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/cvt.c	Mon Jun 17 09:31:28 2002
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #include "flags.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "convert.h"
 #include "toplev.h"
 #include "decl.h"
@@ -549,7 +550,7 @@ convert_to_reference (reftype, expr, con
   else
     {
       rval = convert_for_initialization (NULL_TREE, type, expr, flags,
-					 "converting", 0, 0);
+					 I18N_CONVERSION, 0, 0);
       if (rval == NULL_TREE || rval == error_mark_node)
 	return rval;
       warn_ref_binding (reftype, intype, decl);
@@ -585,7 +586,7 @@ convert_from_reference (val)
   if (TREE_CODE (type) == OFFSET_TYPE)
     type = TREE_TYPE (type);
   if (TREE_CODE (type) == REFERENCE_TYPE)
-    return build_indirect_ref (val, NULL);
+    return build_indirect_ref (val, I18N_NULL);
   return val;
 }
 
@@ -659,7 +660,7 @@ ocp_convert (type, expr, convtype, flags
 
   if (code == VOID_TYPE && (convtype & CONV_STATIC))
     {
-      e = convert_to_void (e, /*implicit=*/NULL);
+      e = convert_to_void (e, I18N_NULL);
       return e;
     }
 
@@ -813,7 +814,7 @@ ocp_convert (type, expr, convtype, flags
 tree
 convert_to_void (expr, implicit)
      tree expr;
-     const char *implicit;
+     enum i18n_string implicit;
 {
   if (expr == error_mark_node 
       || TREE_TYPE (expr) == error_mark_node)
@@ -872,12 +873,12 @@ convert_to_void (expr, implicit)
         int is_complete = COMPLETE_TYPE_P (complete_type (type));
         
         if (is_volatile && !is_complete)
-          warning ("object of incomplete type `%T' will not be accessed in %s",
-                      type, implicit ? implicit : "void context");
+          warning ("object of incomplete type `%T' will not be accessed %s",
+                      type, i18n_in[implicit ? implicit : I18N_VOID_CONTEXT]);
         else if (is_reference && is_volatile)
-          warning ("object of type `%T' will not be accessed in %s",
+          warning ("object of type `%T' will not be accessed %s",
                       TREE_TYPE (TREE_OPERAND (expr, 0)),
-                      implicit ? implicit : "void context");
+                      i18n_in[implicit ? implicit : I18N_VOID_CONTEXT]);
         if (is_reference || !is_volatile || !is_complete)
           expr = TREE_OPERAND (expr, 0);
       
@@ -891,8 +892,8 @@ convert_to_void (expr, implicit)
         int is_complete = COMPLETE_TYPE_P (complete_type (type));
         
         if (TYPE_VOLATILE (type) && !is_complete)
-          warning ("object `%E' of incomplete type `%T' will not be accessed in %s",
-                      expr, type, implicit ? implicit : "void context");
+          warning ("object `%E' of incomplete type `%T' will not be accessed %s",
+                      expr, type, i18n_in[implicit ? implicit : I18N_VOID_CONTEXT]);
         break;
       }
 
@@ -912,12 +913,12 @@ convert_to_void (expr, implicit)
 	/* [over.over] enumerates the places where we can take the address
 	   of an overloaded function, and this is not one of them.  */
 	pedwarn ("%s cannot resolve address of overloaded function",
-		    implicit ? implicit : "void cast");
+		    i18n_subject[implicit ? implicit : I18N_VOID_CAST]);
       }
     else if (implicit && probe == expr && is_overloaded_fn (probe))
       /* Only warn when there is no &.  */
       warning ("%s is a reference, not call, to function `%E'",
-		  implicit, expr);
+		  i18n_subject[implicit], expr);
   }
   
   if (expr != error_mark_node && !VOID_TYPE_P (TREE_TYPE (expr)))
diff -rpNU3 gcc-checkout/cp-old/decl.c gcc-checkout/gcc/gcc/cp/decl.c
--- gcc-checkout/cp-old/decl.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/decl.c	Mon Jun 17 10:41:29 2002
@@ -35,8 +35,10 @@ Boston, MA 02111-1307, USA.  */
 #include "expr.h"
 #include "flags.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "tree-inline.h"
 #include "decl.h"
+#include "intl.h"
 #include "lex.h"
 #include "output.h"
 #include "except.h"
@@ -86,7 +88,7 @@ static tree builtin_function_1 PARAMS ((
                                       enum built_in_class, const char *));
 static tree build_library_fn_1 PARAMS ((tree, enum tree_code, tree));
 static int member_function_or_else PARAMS ((tree, tree, enum overload_flags));
-static void bad_specifiers PARAMS ((tree, const char *, int, int, int, int,
+static void bad_specifiers PARAMS ((tree, enum i18n_string, int, int, int, int,
 				  int));
 static tree maybe_process_template_type_declaration PARAMS ((tree, int, struct cp_binding_level*));
 static void check_for_uninitialized_const_var PARAMS ((tree));
@@ -3060,9 +3062,11 @@ duplicate_decls (newdecl, olddecl)
 	  if (! TREE_PUBLIC (newdecl))
 	    {
 	      if (warn_shadow)
-		warning ("shadowing %s function `%#D'",
-			    DECL_BUILT_IN (olddecl) ? "built-in" : "library",
-			    olddecl);
+		if (DECL_BUILT_IN (olddecl))
+		  warning ("shadowing built-in function `%#D'", olddecl);
+	        else
+		  warning ("shadowing library function `%#D'", olddecl);
+
 	      /* Discard the old built-in function.  */
 	      return 0;
 	    }
@@ -3098,9 +3102,10 @@ duplicate_decls (newdecl, olddecl)
 			      olddecl);
 		}
 	      else if (warn_shadow)
-		warning ("shadowing %s function `%#D'",
-			    DECL_BUILT_IN (olddecl) ? "built-in" : "library",
-			    olddecl);
+		if (DECL_BUILT_IN (olddecl))
+		  warning ("shadowing built-in function `%#D'", olddecl);
+	        else
+		  warning ("shadowing library function `%#D'", olddecl);
 	    }
 	  else
 	    /* Discard the old built-in function.  */
@@ -8747,16 +8752,16 @@ member_function_or_else (ctype, cur_type
 static void
 bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
      tree object;
-     const char *type;
+     enum i18n_string type;
      int virtualp, quals, friendp, raises, inlinep;
 {
   if (virtualp)
-    error ("`%D' declared as a `virtual' %s", object, type);
+    error ("`%D' declared as a `virtual' %s", object, i18n_subject[type]);
   if (inlinep)
-    error ("`%D' declared as an `inline' %s", object, type);
+    error ("`%D' declared as an `inline' %s", object, i18n_subject[type]);
   if (quals)
     error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
-	      object, type);
+	      object, i18n_subject[type]);
   if (friendp)
     cp_error_at ("`%D' declared as a friend", object);
   if (raises
@@ -8906,8 +8911,13 @@ grokfndecl (ctype, type, declarator, ori
   DECL_EXTERNAL (decl) = 1;
   if (quals != NULL_TREE && TREE_CODE (type) == FUNCTION_TYPE)
     {
-      error ("%smember function `%D' cannot have `%T' method qualifier",
-		(ctype ? "static " : "non-"), decl, TREE_VALUE (quals));
+      if (ctype)
+	error ("static member function `%D' cannot have `%T' method qualifier",
+		decl, TREE_VALUE (quals));
+      else
+	error ("non-member function `%D' cannot have `%T' method qualifier",
+		decl, TREE_VALUE (quals));
+
       quals = NULL_TREE;
     }
 
@@ -9439,23 +9449,23 @@ create_array_type_for_decl (name, type, 
   switch (TREE_CODE (type))
     {
     case VOID_TYPE:
-      error_msg = "array of void";
+      error_msg = N_("array of void");
       break;
 
     case FUNCTION_TYPE:
-      error_msg = "array of functions";
+      error_msg = N_("array of functions");
       break;
 
     case REFERENCE_TYPE:
-      error_msg = "array of references";
+      error_msg = N_("array of references");
       break;
 
     case OFFSET_TYPE:
-      error_msg = "array of data members";
+      error_msg = N_("array of data members");
       break;
 
     case METHOD_TYPE:
-      error_msg = "array of function members";
+      error_msg = N_("array of function members");
       break;
 
     default:
@@ -10459,9 +10469,10 @@ grokdeclarator (declarator, declspecs, d
 			name = "<invalid operator>";
 		    }
 		}
-	      error ("storage class specified for %s `%s'",
-		     op ? "member operator" : "field",
-		     name);
+	      if (op)
+		error ("storage class specified for member operator `%s'", name);
+	      else
+		error ("storage class specified for field `%s'", name);
 	    }
 	  else
 	    {
@@ -10815,9 +10826,11 @@ grokdeclarator (declarator, declspecs, d
 
 	  if (TREE_CODE (type) == REFERENCE_TYPE)
 	    {
-	      error ("cannot declare %s to references",
-		     TREE_CODE (declarator) == ADDR_EXPR
-		     ? "references" : "pointers");
+	      if (TREE_CODE (declarator) == ADDR_EXPR)
+	        error ("cannot declare references to references");
+	      else
+	        error ("cannot declare pointers to references");
+
 	      declarator = TREE_OPERAND (declarator, 0);
 	      continue;
 	    }
@@ -11240,7 +11253,7 @@ grokdeclarator (declarator, declspecs, d
 	  || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl)))
 	C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1;
 
-      bad_specifiers (decl, "type", virtualp, quals != NULL_TREE,
+      bad_specifiers (decl, I18N_TYPE, virtualp, quals != NULL_TREE,
 		      inlinep, friendp, raises != NULL_TREE);
 
       if (initialized)
@@ -11416,7 +11429,7 @@ friend declaration requires class-key, i
       {
 	decl = build_decl (PARM_DECL, declarator, type);
 
-	bad_specifiers (decl, "parameter", virtualp, quals != NULL_TREE,
+	bad_specifiers (decl, I18N_ARGUMENT, virtualp, quals != NULL_TREE,
 			inlinep, friendp, raises != NULL_TREE);
 
 	/* Compute the type actually passed in the parmlist,
@@ -11683,7 +11696,7 @@ friend declaration requires class-key, i
 		  }
 	      }
 
-	    bad_specifiers (decl, "field", virtualp, quals != NULL_TREE,
+	    bad_specifiers (decl, I18N_FIELD, virtualp, quals != NULL_TREE,
 			    inlinep, friendp, raises != NULL_TREE);
 	  }
       }
@@ -11780,7 +11793,7 @@ friend declaration requires class-key, i
 			    initialized,
 			    (type_quals & TYPE_QUAL_CONST) != 0,
 			    in_namespace);
-	bad_specifiers (decl, "variable", virtualp, quals != NULL_TREE,
+	bad_specifiers (decl, I18N_VARIABLE, virtualp, quals != NULL_TREE,
 			inlinep, friendp, raises != NULL_TREE);
 
 	if (ctype)
@@ -12106,8 +12119,14 @@ grokparms (first_parm)
 	          t = TREE_TYPE (t);
 	        }
 	      if (TREE_CODE (t) == ARRAY_TYPE)
-		error ("parameter `%D' includes %s to array of unknown bound `%T'",
-			  decl, ptr ? "pointer" : "reference", t);
+		{
+		  if (ptr)
+		    error ("parameter `%D' includes pointer to array of unknown bound `%T'",
+			    decl, t);
+		  else
+		    error ("parameter `%D' includes reference to array of unknown bound `%T'",
+			    decl, t);
+	        }
 	    }
 
 	  DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
@@ -12469,18 +12488,18 @@ grok_op_properties (decl, friendp)
 		t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
 
 	      if (TREE_CODE (t) == VOID_TYPE)
-	        what = "void";
+	        what = ref ? N_("a reference to void") : N_("void");
 	      else if (t == current_class_type)
-		what = "the same type";
+		what = ref ? N_("a reference to the same type") : N_("the same type");
 	      /* Don't force t to be complete here.  */
 	      else if (IS_AGGR_TYPE (t)
 		       && COMPLETE_TYPE_P (t)
 		       && DERIVED_FROM_P (t, current_class_type))
-		what = "a base class";
+		what = ref ? N_("a reference to a base class") : N_("a base class");
 
 	      if (what)
-		warning ("conversion to %s%s will never use a type conversion operator",
-			 ref ? "a reference to " : "", what);
+		warning ("conversion to %s will never use a type conversion operator",
+			 what);
 	    }
 	}
       if (operator_code == COND_EXPR)
@@ -13701,7 +13720,7 @@ start_function (declspecs, declarator, a
 			  19990811);
 
       cp_function_chain->x_current_class_ref
-	= build_indirect_ref (t, NULL);
+	= build_indirect_ref (t, I18N_NULL);
       cp_function_chain->x_current_class_ptr = t;
 
       /* Constructors and destructors need to know whether they're "in
diff -rpNU3 gcc-checkout/cp-old/decl2.c gcc-checkout/gcc/gcc/cp/decl2.c
--- gcc-checkout/cp-old/decl2.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/decl2.c	Wed Jun 19 09:08:00 2002
@@ -35,7 +35,9 @@ Boston, MA 02111-1307, USA.  */
 #include "expr.h"
 #include "flags.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "decl.h"
+#include "intl.h"
 #include "lex.h"
 #include "output.h"
 #include "except.h"
@@ -742,9 +744,12 @@ grok_method_quals (ctype, function, qual
   while (quals);
 
   if (dup_quals != TYPE_UNQUALIFIED)
-    error ("duplicate type qualifiers in %s declaration",
-	      TREE_CODE (function) == FUNCTION_DECL 
-	      ? "member function" : "type");
+    {
+      if (TREE_CODE (function) == FUNCTION_DECL)
+        error ("duplicate type qualifiers in member function declaration");
+      else
+        error ("duplicate type qualifiers in type declaration");
+    }
 
   ctype = cp_build_qualified_type (ctype, type_quals);
   fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype),
@@ -1334,13 +1339,28 @@ check_classfn (ctype, function)
 
   if (methods != end && *methods)
     {
-      tree fndecl = *methods;
+      tree fndecl;
+      const char *str;
+      int count;
+      for (fndecl = *methods, count = 0; fndecl; fndecl = OVL_NEXT (fndecl))
+	count++;
+
       error ("prototype for `%#D' does not match any in class `%T'",
 		function, ctype);
-      cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is",
-		   OVL_CURRENT (fndecl));
-      while (fndecl = OVL_NEXT (fndecl), fndecl)
-	cp_error_at ("                %#D", OVL_CURRENT(fndecl));
+
+      str = ngettext("candidate is:", "candidates are:", count);
+      if (count != 1)
+        {
+	  error (str);
+	  str = " ";
+	}
+      
+      for (fndecl = *methods; fndecl; fndecl = OVL_NEXT (fndecl));
+	{
+	  cp_error_at ("%s %#D", str, OVL_CURRENT(fndecl));
+	  fndecl = OVL_NEXT (fndecl);
+	  str = " ";
+	}
     }
   else
     {
@@ -3667,7 +3687,7 @@ build_expr_from_tree (t)
 
     case INDIRECT_REF:
       return build_x_indirect_ref
-	(build_expr_from_tree (TREE_OPERAND (t, 0)), "unary *");
+	(build_expr_from_tree (TREE_OPERAND (t, 0)), I18N_UNARY_STAR);
 
     case CAST_EXPR:
       return build_functional_cast
diff -rpNU3 gcc-checkout/cp-old/error.c gcc-checkout/gcc/gcc/cp/error.c
--- gcc-checkout/cp-old/error.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/error.c	Fri Jun 14 10:20:22 2002
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "intl.h"
 #include "real.h"
 #include "obstack.h"
 #include "toplev.h"
@@ -104,7 +105,7 @@ static void dump_template_bindings PARAM
 static void dump_scope PARAMS ((tree, int));
 static void dump_template_parms PARAMS ((tree, int, int));
 
-static const char *function_category PARAMS ((tree));
+static const char *in_function PARAMS ((tree));
 static void maybe_print_instantiation_context PARAMS ((diagnostic_context *));
 static void print_instantiation_full_context PARAMS ((diagnostic_context *));
 static void print_instantiation_partial_context PARAMS ((diagnostic_context *,
@@ -802,16 +803,13 @@ static void
 dump_global_iord (t)
      tree t;
 {
-  const char *p = NULL;
-
   if (DECL_GLOBAL_CTOR_P (t))
-    p = "initializers";
+    output_printf (scratch_buffer, "(static initializers for %s)", input_filename);
   else if (DECL_GLOBAL_DTOR_P (t))
-    p = "destructors";
+    output_printf (scratch_buffer, "(static destructors for %s)", input_filename);
   else
     abort ();
 
-  output_printf (scratch_buffer, "(static %s for %s)", p, input_filename);
 }
 
 static void
@@ -2423,8 +2421,7 @@ cp_print_error_function (context, diagno
       if (current_function_decl == NULL)
         output_add_string (&context->buffer, "At global scope:");
       else
-        output_printf (&context->buffer, "In %s `%s':",
-                       function_category (current_function_decl),
+        output_printf (&context->buffer, in_function (current_function_decl),
                        cxx_printable_name (current_function_decl, 2));
       output_add_newline (&context->buffer);
 
@@ -2433,27 +2430,26 @@ cp_print_error_function (context, diagno
       context->buffer.state.prefix = old_prefix;
     }
 }
-
 /* Returns a description of FUNCTION using standard terminology.  */
 static const char *
-function_category (fn)
+in_function (fn)
      tree fn;
 {
   if (DECL_FUNCTION_MEMBER_P (fn))
     {
       if (DECL_STATIC_FUNCTION_P (fn))
-        return "static member function";
+        return N_("In static member function `%s':");
       else if (DECL_COPY_CONSTRUCTOR_P (fn))
-        return "copy constructor";
+        return N_("In copy constructor `%s':");
       else if (DECL_CONSTRUCTOR_P (fn))
-        return "constructor";
+        return N_("In constructor `%s':");
       else if (DECL_DESTRUCTOR_P (fn))
-        return "destructor";
+        return N_("In destructor `%s':");
       else
-        return "member function";
+        return N_("In member function `%s':");
     }
   else
-    return "function";
+    return N_("In function `%s':");
 }
 
 /* Report the full context of a current template instantiation,
diff -rpNU3 gcc-checkout/cp-old/except.c gcc-checkout/gcc/gcc/cp/except.c
--- gcc-checkout/cp-old/except.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/except.c	Mon Jun 17 10:34:57 2002
@@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA.  */
 #include "expr.h"
 #include "libfuncs.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "flags.h"
 #include "obstack.h"
 #include "output.h"
@@ -419,7 +420,7 @@ expand_start_catch_block (decl)
 	  init = build1 (NOP_EXPR, build_pointer_type (type), init);
 	  init = build (MINUS_EXPR, TREE_TYPE (init), init,
 			TYPE_SIZE_UNIT (TREE_TYPE (init)));
-	  init = build_indirect_ref (init, NULL);
+	  init = build_indirect_ref (init, I18N_NULL);
 	  is_java = true;
 	}
       else
@@ -723,7 +724,7 @@ build_throw (exp)
       allocate_expr = get_target_expr (allocate_expr);
       ptr = TARGET_EXPR_SLOT (allocate_expr);
       object = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (exp)), ptr);
-      object = build_indirect_ref (object, NULL);
+      object = build_indirect_ref (object, I18N_NULL);
 
       /* And initialize the exception object.  */
       exp = build_init (object, exp, LOOKUP_ONLYCONVERTING);
diff -rpNU3 gcc-checkout/cp-old/init.c gcc-checkout/gcc/gcc/cp/init.c
--- gcc-checkout/cp-old/init.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/init.c	Mon Jun 17 10:35:01 2002
@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA.  */
 #include "rtl.h"
 #include "expr.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "flags.h"
 #include "output.h"
 #include "except.h"
@@ -703,7 +704,7 @@ emit_base_init (mem_init_list, base_init
 	  member = build_base_path (PLUS_EXPR, current_class_ptr,
 				    base_binfo, 1);
 	  expand_aggr_init_1 (base_binfo, NULL_TREE,
-			      build_indirect_ref (member, NULL), init,
+			      build_indirect_ref (member, I18N_NULL), init,
 			      LOOKUP_NORMAL);
 	}
 
@@ -826,7 +827,7 @@ expand_virtual_init (binfo, decl)
     }
 
   /* Compute the location of the vtpr.  */
-  vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL),
+  vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, I18N_NULL),
 			       TREE_TYPE (binfo));
   my_friendly_assert (vtbl_ptr != error_mark_node, 20010730);
 
@@ -871,7 +872,7 @@ expand_aggr_vbase_init_1 (binfo, exp, ad
      tree binfo, exp, addr, init_list;
 {
   tree init = purpose_member (binfo, init_list);
-  tree ref = build_indirect_ref (addr, NULL);
+  tree ref = build_indirect_ref (addr, I18N_NULL);
 
   if (init)
     init = TREE_VALUE (init);
@@ -1870,7 +1871,7 @@ resolve_offset_ref (exp)
       member = cp_convert (ptrdiff_type_node, member);
 
       addr = build (PLUS_EXPR, build_pointer_type (type), addr, member);
-      return build_indirect_ref (addr, 0);
+      return build_indirect_ref (addr, I18N_NULL);
     }
   else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member)))
     {
@@ -2396,7 +2397,7 @@ build_new_1 (exp)
 	 (size_t) bytes to store the number of elements.  */
       cookie = build (MINUS_EXPR, build_pointer_type (sizetype),
 		      alloc_node, size_in_bytes (sizetype));
-      cookie = build_indirect_ref (cookie, NULL);
+      cookie = build_indirect_ref (cookie, I18N_NULL);
 
       cookie_expr = build (MODIFY_EXPR, void_type_node, cookie, nelts);
       TREE_SIDE_EFFECTS (cookie_expr) = 1;
@@ -2408,7 +2409,7 @@ build_new_1 (exp)
   init_expr = NULL_TREE;
   if (TYPE_NEEDS_CONSTRUCTING (type) || init)
     {
-      init_expr = build_indirect_ref (alloc_node, NULL);
+      init_expr = build_indirect_ref (alloc_node, I18N_NULL);
 
       if (init == void_zero_node)
 	init = build_default_init (full_type);
@@ -3218,7 +3219,7 @@ build_delete (type, addr, auto_delete, f
 				LOOKUP_NORMAL, NULL_TREE);
 	}
 
-      expr = build_dtor_call (build_indirect_ref (addr, NULL),
+      expr = build_dtor_call (build_indirect_ref (addr, I18N_NULL),
 			      auto_delete, flags);
       if (do_delete)
 	expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete);
@@ -3391,7 +3392,7 @@ build_vec_delete (base, maxindex, auto_d
 			   build_pointer_type (sizetype),
 			   base,
 			   TYPE_SIZE_UNIT (sizetype));
-      maxindex = build_indirect_ref (cookie_addr, NULL);
+      maxindex = build_indirect_ref (cookie_addr, I18N_NULL);
     }
   else if (TREE_CODE (type) == ARRAY_TYPE)
     {
diff -rpNU3 gcc-checkout/cp-old/lex.c gcc-checkout/gcc/gcc/cp/lex.c
--- gcc-checkout/cp-old/lex.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/lex.c	Mon Jun 17 08:30:51 2002
@@ -635,6 +635,7 @@ cxx_init (filename)
 {
   input_filename = "<internal>";
 
+  init_cp_i18n ();
   init_reswords ();
   init_spew ();
   init_tree ();
@@ -920,8 +921,10 @@ check_for_missing_semicolon (type)
       || yychar == 0  /* EOF */)
     {
       if (TYPE_ANONYMOUS_P (type))
-	error ("semicolon missing after %s declaration",
-	       TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct");
+	if (TREE_CODE (type) == ENUMERAL_TYPE)
+	  error ("semicolon missing after enum declaration");
+	else
+	  error ("semicolon missing after struct declaration");
       else
 	error ("semicolon missing after declaration of `%T'", type);
       shadow_tag (build_tree_list (0, type));
diff -rpNU3 gcc-checkout/cp-old/method.c gcc-checkout/gcc/gcc/cp/method.c
--- gcc-checkout/cp-old/method.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/method.c	Fri Jun 14 10:27:45 2002
@@ -220,9 +220,11 @@ hack_identifier (value, name)
       if (context != NULL_TREE && context != current_function_decl
 	  && ! TREE_STATIC (value))
 	{
-	  error ("use of %s from containing function",
-		      (TREE_CODE (value) == VAR_DECL
-		       ? "`auto' variable" : "parameter"));
+	  if (TREE_CODE (value) == VAR_DECL)
+	    error ("use of `auto' variable from containing function");
+	  else
+	    error ("use of parameter from containing function");
+		       
 	  cp_error_at ("  `%#D' declared here", value);
 	  value = error_mark_node;
 	}
diff -rpNU3 gcc-checkout/cp-old/parse.y gcc-checkout/gcc/gcc/cp/parse.y
--- gcc-checkout/cp-old/parse.y	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/parse.y	Mon Jun 17 09:37:48 2002
@@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA.  */
 #include "input.h"
 #include "flags.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "lex.h"
 #include "c-pragma.h"		/* For YYDEBUG definition.  */
 #include "output.h"
@@ -863,7 +864,7 @@ constructor_declarator:
 
 fn.def1:
 	  typed_declspecs declarator
-		{ check_for_new_type ("return type", $1);
+		{ check_for_new_type (I18N_RETURN_TYPE, $1);
 		  if (!begin_function_definition ($1.t, $2))
 		    YYERROR1; }
 	| declmods notype_declarator
@@ -1274,7 +1275,7 @@ unary_expr:
 		{ $$ = $2;
 		  pedantic = $1; }
 	| '*' cast_expr   %prec UNARY
-		{ $$ = build_x_indirect_ref ($2, "unary *"); }
+		{ $$ = build_x_indirect_ref ($2, I18N_UNARY_STAR); }
 	| '&' cast_expr   %prec UNARY
 		{ $$ = build_x_unary_op (ADDR_EXPR, $2); }
 	| '~' cast_expr
@@ -1288,41 +1289,41 @@ unary_expr:
 		{ $$ = finish_sizeof ($2); }
 	| SIZEOF '(' type_id ')'  %prec HYPERUNARY
 		{ $$ = finish_sizeof (groktypename ($3.t));
-		  check_for_new_type ("sizeof", $3); }
+		  check_for_new_type (I18N_SIZEOF, $3); }
 	| ALIGNOF unary_expr  %prec UNARY
 		{ $$ = finish_alignof ($2); }
 	| ALIGNOF '(' type_id ')'  %prec HYPERUNARY
 		{ $$ = finish_alignof (groktypename ($3.t)); 
-		  check_for_new_type ("alignof", $3); }
+		  check_for_new_type (I18N_ALIGNOF, $3); }
 
 	/* The %prec EMPTY's here are required by the = init initializer
 	   syntax extension; see below.  */
 	| new new_type_id  %prec EMPTY
 		{ $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1); 
-		  check_for_new_type ("new", $2); }
+		  check_for_new_type (I18N_NEW, $2); }
 	| new new_type_id new_initializer
 		{ $$ = build_new (NULL_TREE, $2.t, $3, $1); 
-		  check_for_new_type ("new", $2); }
+		  check_for_new_type (I18N_NEW, $2); }
 	| new new_placement new_type_id  %prec EMPTY
 		{ $$ = build_new ($2, $3.t, NULL_TREE, $1); 
-		  check_for_new_type ("new", $3); }
+		  check_for_new_type (I18N_NEW, $3); }
 	| new new_placement new_type_id new_initializer
 		{ $$ = build_new ($2, $3.t, $4, $1); 
-		  check_for_new_type ("new", $3); }
+		  check_for_new_type (I18N_NEW, $3); }
 	| new '(' type_id ')'
             %prec EMPTY
 		{ $$ = build_new (NULL_TREE, groktypename($3.t),
 				  NULL_TREE, $1); 
-		  check_for_new_type ("new", $3); }
+		  check_for_new_type (I18N_NEW, $3); }
 	| new '(' type_id ')' new_initializer
 		{ $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1); 
-		  check_for_new_type ("new", $3); }
+		  check_for_new_type (I18N_NEW, $3); }
 	| new new_placement '(' type_id ')' %prec EMPTY
 		{ $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1); 
-		  check_for_new_type ("new", $4); }
+		  check_for_new_type (I18N_NEW, $4); }
 	| new new_placement '(' type_id ')' new_initializer
 		{ $$ = build_new ($2, groktypename($4.t), $6, $1); 
-		  check_for_new_type ("new", $4); }
+		  check_for_new_type (I18N_NEW, $4); }
 
 	| delete cast_expr  %prec UNARY
 		{ $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
@@ -1381,11 +1382,11 @@ regcast_or_absdcl:
 	  '(' type_id ')'  %prec EMPTY
 		{ $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0);
 		  $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
-		  check_for_new_type ("cast", $2); }
+		  check_for_new_type (I18N_CAST, $2); }
 	| regcast_or_absdcl '(' type_id ')'  %prec EMPTY
 		{ $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0); 
 		  $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
-		  check_for_new_type ("cast", $3); }
+		  check_for_new_type (I18N_CAST, $3); }
 	;
 
 cast_expr:
@@ -1657,7 +1658,7 @@ primary:
                { $$ = finish_call_expr ($1, NULL_TREE, 0); }
 	| VA_ARG '(' expr_no_commas ',' type_id ')'
 		{ $$ = build_x_va_arg ($3, groktypename ($5.t));
-		  check_for_new_type ("__builtin_va_arg", $5); }
+		  check_for_new_type (I18N_BUILTIN_VA_ARG, $5); }
 	| primary '[' expr ']'
 		{ $$ = grok_array_decl ($$, $3); }
 	| primary PLUSPLUS
@@ -1681,25 +1682,25 @@ primary:
 	| functional_cast
 	| DYNAMIC_CAST '<' type_id '>' '(' expr ')'
 		{ tree type = groktypename ($3.t);
-		  check_for_new_type ("dynamic_cast", $3);
+		  check_for_new_type (I18N_DYNAMIC_CAST, $3);
 		  $$ = build_dynamic_cast (type, $6); }
 	| STATIC_CAST '<' type_id '>' '(' expr ')'
 		{ tree type = groktypename ($3.t);
-		  check_for_new_type ("static_cast", $3);
+		  check_for_new_type (I18N_STATIC_CAST, $3);
 		  $$ = build_static_cast (type, $6); }
 	| REINTERPRET_CAST '<' type_id '>' '(' expr ')'
 		{ tree type = groktypename ($3.t);
-		  check_for_new_type ("reinterpret_cast", $3);
+		  check_for_new_type (I18N_REINTERPRET_CAST, $3);
 		  $$ = build_reinterpret_cast (type, $6); }
 	| CONST_CAST '<' type_id '>' '(' expr ')'
 		{ tree type = groktypename ($3.t);
-		  check_for_new_type ("const_cast", $3);
+		  check_for_new_type (I18N_CONST_CAST, $3);
 		  $$ = build_const_cast (type, $6); }
 	| TYPEID '(' expr ')'
 		{ $$ = build_typeid ($3); }
 	| TYPEID '(' type_id ')'
 		{ tree type = groktypename ($3.t);
-		  check_for_new_type ("typeid", $3);
+		  check_for_new_type (TYPEID, $3);
 		  $$ = get_typeid (type); }
 	| global_scope IDENTIFIER
 		{ $$ = do_scoped_id ($2, 1); }
@@ -3588,21 +3589,21 @@ handler_args:
 		{ $$ = NULL_TREE; }
 	/* This doesn't allow reference parameters, the below does.
 	| '(' type_specifier_seq absdcl ')'
-		{ check_for_new_type ("inside exception declarations", $2);
+		{ check_for_new_type (I18N_EXCEPTION_DECLARATIONS, $2);
 		  expand_start_catch_block ($2.t, $3); }
 	| '(' type_specifier_seq ')'
-		{ check_for_new_type ("inside exception declarations", $2);
+		{ check_for_new_type (I18N_EXCEPTION_DECLARATIONS, $2);
 		  expand_start_catch_block ($2.t, NULL_TREE); }
 	| '(' type_specifier_seq notype_declarator ')'
-		{ check_for_new_type ("inside exception declarations", $2);
+		{ check_for_new_type (I18N_EXCEPTION_DECLARATIONS, $2);
 		  expand_start_catch_block ($2.t, $3); }
 	| '(' typed_typespecs after_type_declarator ')'
-		{ check_for_new_type ("inside exception declarations", $2);
+		{ check_for_new_type (I18N_EXCEPTION_DECLARATIONS, $2);
 		  expand_start_catch_block ($2.t, $3); }
 	This allows reference parameters...  */
 	| '(' parm ')'
 		{ 
-		  check_for_new_type ("inside exception declarations", $2);
+		  check_for_new_type (I18N_EXCEPTION_DECLARATIONS, $2);
 		  $$ = start_handler_parms (TREE_PURPOSE ($2.t),
 					    TREE_VALUE ($2.t));
 		}
@@ -3689,7 +3690,7 @@ parmlist:
 	| complex_parmlist
 	| type_id
 		{ $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0);
-		  check_for_new_type ("inside parameter list", $1); }
+		  check_for_new_type (I18N_ARGUMENT_LIST, $1); }
 	;
 
 /* This nonterminal does not include the common sequence '(' type_id ')',
@@ -3746,13 +3747,13 @@ defarg1:
 /* A nonempty list of parameter declarations or type names.  */
 parms:
 	  named_parm
-		{ check_for_new_type ("in a parameter list", $1);
+		{ check_for_new_type (I18N_ARGUMENT_LIST, $1);
 		  $$ = build_tree_list (NULL_TREE, $1.t); }
 	| parm defarg
-		{ check_for_new_type ("in a parameter list", $1);
+		{ check_for_new_type (I18N_ARGUMENT_LIST, $1);
 		  $$ = build_tree_list ($2, $1.t); }
 	| parms_comma full_parm
-		{ check_for_new_type ("in a parameter list", $2);
+		{ check_for_new_type (I18N_ARGUMENT_LIST, $2);
 		  $$ = chainon ($$, $2.t); }
 	| parms_comma bad_parm
 		{ $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
@@ -3763,7 +3764,7 @@ parms:
 parms_comma:
 	  parms ','
 	| type_id ','
-		{ check_for_new_type ("in a parameter list", $1);
+		{ check_for_new_type (I18N_ARGUMENT_LIST, $1);
 		  $$ = build_tree_list (NULL_TREE, $1.t); }
 	;
 
@@ -3866,7 +3867,7 @@ exception_specification_opt:
 ansi_raise_identifier:
 	  type_id
 		{
-		  check_for_new_type ("exception specifier", $1);
+		  check_for_new_type (I18N_ARGUMENT_LIST, $1);
 		  $$ = groktypename ($1.t);
 		}
 	  | error
diff -rpNU3 gcc-checkout/cp-old/pt.c gcc-checkout/gcc/gcc/cp/pt.c
--- gcc-checkout/cp-old/pt.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/pt.c	Mon Jun 17 10:51:36 2002
@@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "except.h"
 #include "toplev.h"
+#include "intl.h"
 #include "rtl.h"
 #include "ggc.h"
 #include "timevar.h"
@@ -932,8 +933,25 @@ print_candidates (fns)
      tree fns;
 {
   tree fn;
+  int count = 0;
+  const char *str;
 
-  const char *str = "candidates are:";
+  for (fn = fns; fn != NULL_TREE; fn = TREE_CHAIN (fn))
+    {
+      tree f;
+
+      for (f = TREE_VALUE (fn); f; f = OVL_NEXT (f))
+	count++;
+    }
+
+  str = ngettext("candidate is:", "candidates are:", count);
+  if (count != 1)
+    {
+      error (str);
+      str = " ";
+    }
+
+  cp_error_at(str);
 
   for (fn = fns; fn != NULL_TREE; fn = TREE_CHAIN (fn))
     {
@@ -941,7 +959,6 @@ print_candidates (fns)
 
       for (f = TREE_VALUE (fn); f; f = OVL_NEXT (f))
 	cp_error_at ("%s %+#D", str, OVL_CURRENT (f));
-      str = "               ";
     }
 }
 
@@ -2803,10 +2820,11 @@ redeclare_class_template (type, parms)
   if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms))
     {
       cp_error_at ("previous declaration `%D'", tmpl);
-      error ("used %d template parameter%s instead of %d",
-		TREE_VEC_LENGTH (tmpl_parms), 
-		TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s",
-		TREE_VEC_LENGTH (parms));
+      error (ngettext("used %d template parameter instead of %d",
+		      "used %d template parameters instead of %d", 
+		      TREE_VEC_LENGTH (tmpl_parms)),
+	     TREE_VEC_LENGTH (tmpl_parms), 
+	     TREE_VEC_LENGTH (parms));
       return;
     }
 
@@ -4964,18 +4982,30 @@ instantiate_class_template (type)
 
       if (t == error_mark_node)
 	{
-	  const char *str = "candidates are:";
-	  error ("ambiguous class template instantiation for `%#T'", type);
+	  int count = 0;
+	  const char *str;
+
 	  for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t; 
 	       t = TREE_CHAIN (t))
+	    if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
+				    args))
+	      count++;
+
+	  error ("ambiguous class template instantiation for `%#T'", type);
+
+	  str = ngettext ("candidate is:", "candidates are:", count);
+	  if (count != 1)
 	    {
-	      if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
-				      args))
-		{
-		  cp_error_at ("%s %+#T", str, TREE_TYPE (t));
-		  str = "               ";
-		}
+	      error (str);
+	      str = " ";
 	    }
+
+	  for (t = DECL_TEMPLATE_SPECIALIZATIONS (template); t; 
+	       t = TREE_CHAIN (t))
+	    if (get_class_bindings (TREE_VALUE (t), TREE_PURPOSE (t),
+				      args))
+	      cp_error_at ("%s %#T", str, TREE_TYPE (t));
+
 	  TYPE_BEING_DEFINED (type) = 1;
 	  return error_mark_node;
 	}
@@ -6638,10 +6668,11 @@ tsubst (t, args, complain, in_decl)
 	      {
 		if (TREE_CODE (type) == VOID_TYPE)
 		  error ("forming reference to void");
+		else if (code == POINTER_TYPE)
+		  error ("forming pointer to reference type `%T'");
 		else
-		  error ("forming %s to reference type `%T'",
-			    (code == POINTER_TYPE) ? "pointer" : "reference",
-			    type);
+		  error ("forming reference to reference type `%T'");
+
 		last_line = lineno;
 		last_file = input_filename;
 	      }
diff -rpNU3 gcc-checkout/cp-old/rtti.c gcc-checkout/gcc/gcc/cp/rtti.c
--- gcc-checkout/cp-old/rtti.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/rtti.c	Mon Jun 17 10:35:04 2002
@@ -23,8 +23,10 @@ Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
+#include "intl.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "flags.h"
 #include "output.h"
 #include "assert.h"
@@ -104,7 +106,7 @@ build_headof (exp)
   /* The offset-to-top field is at index -2 from the vptr.  */
   index = build_int_2 (-2, -1);
 
-  offset = build_vtbl_ref (build_indirect_ref (exp, NULL), index);
+  offset = build_vtbl_ref (build_indirect_ref (exp, I18N_NULL), index);
 
   type = build_qualified_type (ptr_type_node, 
 			       cp_type_quals (TREE_TYPE (exp)));
@@ -238,7 +240,7 @@ build_typeid (exp)
   if (exp == error_mark_node)
     return error_mark_node;
 
-  exp = build_indirect_ref (exp, NULL);
+  exp = build_indirect_ref (exp, I18N_NULL);
 
   if (cond)
     {
@@ -388,18 +390,18 @@ build_dynamic_cast_1 (type, expr)
     case REFERENCE_TYPE:
       if (! IS_AGGR_TYPE (TREE_TYPE (type)))
 	{
-	  errstr = "target is not pointer or reference to class";
+	  errstr = N_("target is not pointer or reference to class");
 	  goto fail;
 	}
       if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (type))))
 	{
-	  errstr = "target is not pointer or reference to complete type";
+	  errstr = N_("target is not pointer or reference to complete type");
 	  goto fail;
 	}
       break;
 
     default:
-      errstr = "target is not pointer or reference";
+      errstr = N_("target is not pointer or reference");
       goto fail;
     }
 
@@ -428,17 +430,17 @@ build_dynamic_cast_1 (type, expr)
 
       if (TREE_CODE (exprtype) != POINTER_TYPE)
 	{
-	  errstr = "source is not a pointer";
+	  errstr = N_("source is not a pointer");
 	  goto fail;
 	}
       if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
 	{
-	  errstr = "source is not a pointer to class";
+	  errstr = N_("source is not a pointer to class");
 	  goto fail;
 	}
       if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
 	{
-	  errstr = "source is a pointer to incomplete type";
+	  errstr = N_("source is a pointer to incomplete type");
 	  goto fail;
 	}
     }
@@ -449,12 +451,12 @@ build_dynamic_cast_1 (type, expr)
 
       if (! IS_AGGR_TYPE (TREE_TYPE (exprtype)))
 	{
-	  errstr = "source is not of class type";
+	  errstr = N_("source is not of class type");
 	  goto fail;
 	}
       if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype))))
 	{
-	  errstr = "source is of incomplete class type";
+	  errstr = N_("source is of incomplete class type");
 	  goto fail;
 	}
       
@@ -464,7 +466,7 @@ build_dynamic_cast_1 (type, expr)
   if (!at_least_as_qualified_p (TREE_TYPE (type),
 				TREE_TYPE (exprtype)))
     {
-      errstr = "conversion casts away constness";
+      errstr = N_("conversion casts away constness");
       goto fail;
     }
 
@@ -607,7 +609,7 @@ build_dynamic_cast_1 (type, expr)
 	}
     }
   else
-    errstr = "source type is not polymorphic";
+    errstr = N_("source type is not polymorphic");
 
  fail:
   error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T' (%s)",
diff -rpNU3 gcc-checkout/cp-old/semantics.c gcc-checkout/gcc/gcc/cp/semantics.c
--- gcc-checkout/cp-old/semantics.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/semantics.c	Mon Jun 17 10:35:08 2002
@@ -28,6 +28,7 @@
 #include "system.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "tree-inline.h"
 #include "except.h"
 #include "lex.h"
@@ -218,7 +219,7 @@ finish_expr_stmt (expr)
       expr_type = TREE_TYPE (expr);
 
       if (stmts_are_full_exprs_p ())
-	expr = convert_to_void (expr, "statement");
+	expr = convert_to_void (expr, I18N_STATEMENT);
       
       r = add_stmt (build_stmt (EXPR_STMT, expr));
     }
diff -rpNU3 gcc-checkout/cp-old/tree.c gcc-checkout/gcc/gcc/cp/tree.c
--- gcc-checkout/cp-old/tree.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/tree.c	Wed Jun 19 09:15:40 2002
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA.  */
 #include "obstack.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "flags.h"
 #include "real.h"
 #include "rtl.h"
@@ -215,13 +216,13 @@ lvalue_p (ref)
    otherwise, print an error message and return zero.  */
 
 int
-lvalue_or_else (ref, string)
+lvalue_or_else (ref, msgid)
      tree ref;
-     const char *string;
+     const char *msgid;
 {
   int win = lvalue_p (ref);
   if (! win)
-    error ("non-lvalue in %s", string);
+    error (msgid);
   return win;
 }
 
@@ -1813,7 +1814,7 @@ build_dummy_object (type)
      tree type;
 {
   tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_zero_node);
-  return build_indirect_ref (decl, NULL);
+  return build_indirect_ref (decl, I18N_NULL);
 }
 
 /* We've gotten a reference to a member of TYPE.  Return *this if appropriate,
@@ -2538,7 +2539,7 @@ stabilize_expr (exp, initp)
       exp = build_unary_op (ADDR_EXPR, exp, 1);
       init_expr = get_target_expr (exp);
       exp = TARGET_EXPR_SLOT (init_expr);
-      exp = build_indirect_ref (exp, 0);
+      exp = build_indirect_ref (exp, I18N_NULL);
     }
 
   *initp = init_expr;
diff -rpNU3 gcc-checkout/cp-old/typeck.c gcc-checkout/gcc/gcc/cp/typeck.c
--- gcc-checkout/cp-old/typeck.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/typeck.c	Wed Jun 19 09:14:20 2002
@@ -33,9 +33,11 @@ Boston, MA 02111-1307, USA.  */
 #include "config.h"
 #include "system.h"
 #include "tree.h"
+#include "intl.h"
 #include "rtl.h"
 #include "expr.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "tm_p.h"
 #include "flags.h"
 #include "output.h"
@@ -43,7 +45,7 @@ Boston, MA 02111-1307, USA.  */
 #include "diagnostic.h"
 #include "target.h"
 
-static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
+static tree convert_for_assignment PARAMS ((tree, tree, enum i18n_string, tree,
 					  int));
 static tree cp_pointer_int_sum PARAMS ((enum tree_code, tree, tree));
 static tree rationalize_conditional_expr PARAMS ((enum tree_code, tree));
@@ -472,7 +474,7 @@ composite_pointer_type (t1, t2, arg1, ar
      tree t2;
      tree arg1;
      tree arg2;
-     const char* location;
+     enum i18n_string location;
 {
   tree result_type;
   tree attributes;
@@ -517,7 +519,7 @@ composite_pointer_type (t1, t2, arg1, ar
   if (VOID_TYPE_P (TREE_TYPE (t1)))
     {
       if (pedantic && TYPE_PTRFN_P (t2))
-	pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", location);
+	pedwarn ("ISO C++ forbids %s between pointer of type `void *' and pointer-to-function", i18n_accus[location]);
       t1 = TREE_TYPE (t1);
       t2 = TREE_TYPE (t2);
       result_type = cp_build_qualified_type (void_type_node,
@@ -539,7 +541,7 @@ composite_pointer_type (t1, t2, arg1, ar
       else
 	{
 	  pedwarn ("%s between distinct pointer types `%T' and `%T' lacks a cast",
-		      location, t1, t2);
+		      i18n_subject[location], t1, t2);
 	  result_type = ptr_type_node;
 	}
     }
@@ -726,7 +728,7 @@ common_type (t1, t2)
 	   || (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2))
 	   || (TYPE_PTRMEMFUNC_P (t1) && TYPE_PTRMEMFUNC_P (t2)))
     return composite_pointer_type (t1, t2, error_mark_node, error_mark_node,
-				   "conversion");
+				   I18N_CONVERSION);
 
   else
     abort ();
@@ -2270,15 +2272,15 @@ build_x_component_ref (datum, component,
 
 /* Given an expression PTR for a pointer, return an expression
    for the value pointed to.
-   ERRORSTRING is the name of the operator to appear in error messages.
+   ERRTYPE is the operator name to be used in error messages.
 
    This function may need to overload OPERATOR_FNNAME.
    Must also handle REFERENCE_TYPEs for C++.  */
 
 tree
-build_x_indirect_ref (ptr, errorstring)
+build_x_indirect_ref (ptr, errtype)
      tree ptr;
-     const char *errorstring;
+     enum i18n_string errtype;
 {
   tree rval;
 
@@ -2289,13 +2291,13 @@ build_x_indirect_ref (ptr, errorstring)
 			 NULL_TREE);
   if (rval)
     return rval;
-  return build_indirect_ref (ptr, errorstring);
+  return build_indirect_ref (ptr, errtype);
 }
 
 tree
-build_indirect_ref (ptr, errorstring)
+build_indirect_ref (ptr, errtype)
      tree ptr;
-     const char *errorstring;
+     enum i18n_string errtype;
 {
   register tree pointer, type;
 
@@ -2352,11 +2354,14 @@ build_indirect_ref (ptr, errorstring)
   /* `pointer' won't be an error_mark_node if we were given a
      pointer to member, so it's cool to check for this here.  */
   else if (TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type))
-    error ("invalid use of `%s' on pointer to member", errorstring);
+    {
+      if (errtype)
+        error ("invalid use %s on pointer to member", i18n_of[errtype]);
+    }
   else if (pointer != error_mark_node)
     {
-      if (errorstring)
-	error ("invalid type argument of `%s'", errorstring);
+      if (errtype)
+	error ("invalid type argument %s", i18n_of[errtype]);
       else
 	error ("invalid type argument");
     }
@@ -2515,7 +2520,7 @@ build_array_ref (array, idx)
       }
 
     return build_indirect_ref (cp_build_binary_op (PLUS_EXPR, ar, ind),
-			       "array indexing");
+			       I18N_ARRAY_INDEXING);
   }
 }
 
@@ -2908,11 +2913,11 @@ get_member_function_from_ptrfunc (instan
       /* Next extract the vtable pointer from the object.  */
       vtbl = build1 (NOP_EXPR, build_pointer_type (vtbl_ptr_type_node),
 		     instance_ptr);
-      vtbl = build_indirect_ref (vtbl, NULL);
+      vtbl = build_indirect_ref (vtbl, I18N_NULL);
 
       /* Finally, extract the function pointer from the vtable.  */
       e2 = fold (build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx));
-      e2 = build_indirect_ref (e2, NULL);
+      e2 = build_indirect_ref (e2, I18N_NULL);
       TREE_CONSTANT (e2) = 1;
 
       /* When using function descriptors, the address of the
@@ -3093,7 +3098,7 @@ convert_arguments (typelist, values, fnd
 {
   register tree typetail, valtail;
   register tree result = NULL_TREE;
-  const char *called_thing = 0;
+  enum i18n_string called_thing = 0;
   int i = 0;
 
   /* Argument passing is always copy-initialization.  */
@@ -3105,12 +3110,12 @@ convert_arguments (typelist, values, fnd
 	{
 	  if (DECL_NAME (fndecl) == NULL_TREE
 	      || IDENTIFIER_HAS_TYPE_VALUE (DECL_NAME (fndecl)))
-	    called_thing = "constructor";
+	    called_thing = I18N_CONSTRUCTOR;
 	  else
-	    called_thing = "member function";
+	    called_thing = I18N_MEMBER_FUNCTION;
 	}
       else
-	called_thing = "function";
+	called_thing = I18N_FUNCTION;
     }
 
   for (valtail = values, typetail = typelist;
@@ -3127,8 +3132,8 @@ convert_arguments (typelist, values, fnd
 	{
 	  if (fndecl)
 	    {
-	      cp_error_at ("too many arguments to %s `%+#D'", called_thing,
-			   fndecl);
+	      cp_error_at ("too many arguments %s `%+#D'", 
+			   i18n_to[called_thing], fndecl);
 	      error ("at this point in file");
 	    }
 	  else
@@ -3175,7 +3180,7 @@ convert_arguments (typelist, values, fnd
 	    {
 	      parmval = convert_for_initialization
 		(NULL_TREE, type, val, flags,
-		 "argument passing", fndecl, i);
+		 I18N_ARGUMENT_PASSING, fndecl, i);
 	      if (PROMOTE_PROTOTYPES
 		  && INTEGRAL_TYPE_P (type)
 		  && (TYPE_PRECISION (type)
@@ -3235,8 +3240,8 @@ convert_arguments (typelist, values, fnd
 	{
 	  if (fndecl)
 	    {
-	      cp_error_at ("too few arguments to %s `%+#D'",
-	                   called_thing, fndecl);
+	      cp_error_at ("too few arguments %s `%+#D'",
+	                   i18n_to[called_thing], fndecl);
 	      error ("at this point in file");
 	    }
 	  else
@@ -3547,12 +3552,21 @@ build_binary_op (code, orig_op0, orig_op
 	  if (TREE_CODE (op1) == INTEGER_CST)
 	    {
 	      if (tree_int_cst_lt (op1, integer_zero_node))
-		warning ("%s rotate count is negative",
-			 (code == LROTATE_EXPR) ? "left" : "right");
+		{
+		  if (code == LROTATE_EXPR)
+		    warning ("left rotate count is negative");
+	          else
+		    warning ("right rotate count is negative");
+		}
 	      else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
-		warning ("%s rotate count >= width of type",
-			 (code == LROTATE_EXPR) ? "left" : "right");
+		{
+		  if (code == LROTATE_EXPR)
+		    warning ("left rotate count is >= width of type");
+	          else
+		    warning ("right rotate count is >= width of type");
+		}
 	    }
+
 	  /* Convert the shift-count to an integer, regardless of
 	     size of value being shifted.  */
 	  if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
@@ -3573,7 +3587,7 @@ build_binary_op (code, orig_op0, orig_op
 	short_compare = 1;
       else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
 	result_type = composite_pointer_type (type0, type1, op0, op1,
-					      "comparison");
+					      I18N_COMPARISON);
       else if (code0 == POINTER_TYPE && null_ptr_cst_p (op1))
 	result_type = type0;
       else if (code1 == POINTER_TYPE && null_ptr_cst_p (op0))
@@ -3654,7 +3668,7 @@ build_binary_op (code, orig_op0, orig_op
 	shorten = 1;
       else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
 	result_type = composite_pointer_type (type0, type1, op0, op1,
-					      "comparison");
+					      I18N_COMPARISON);
       break;
 
     case LE_EXPR:
@@ -3667,7 +3681,7 @@ build_binary_op (code, orig_op0, orig_op
 	short_compare = 1;
       else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
 	result_type = composite_pointer_type (type0, type1, op0, op1,
-					      "comparison");
+					      I18N_COMPARISON);
       else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST
 	       && integer_zerop (op1))
 	result_type = type0;
@@ -4254,7 +4268,7 @@ build_unary_op (code, xarg, noconvert)
 	 associativity, but won't generate any code.  */
       if (!(arg = build_expr_type_conversion
 	    (WANT_ARITH | WANT_ENUM | WANT_POINTER, arg, 1)))
-	errstring = "wrong type argument to unary plus";
+	errstring = N_("wrong type argument to unary plus");
       else
 	{
 	  if (!noconvert)
@@ -4266,7 +4280,7 @@ build_unary_op (code, xarg, noconvert)
 
     case NEGATE_EXPR:
       if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
-	errstring = "wrong type argument to unary minus";
+	errstring = N_("wrong type argument to unary minus");
       else if (!noconvert)
 	arg = default_conversion (arg);
       break;
@@ -4280,14 +4294,14 @@ build_unary_op (code, xarg, noconvert)
 	}
       else if (!(arg = build_expr_type_conversion (WANT_INT | WANT_ENUM,
 						   arg, 1)))
-	errstring = "wrong type argument to bit-complement";
+	errstring = N_("wrong type argument to bit-complement");
       else if (!noconvert)
 	arg = default_conversion (arg);
       break;
 
     case ABS_EXPR:
       if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
-	errstring = "wrong type argument to abs";
+	errstring = N_("wrong type argument to abs");
       else if (!noconvert)
 	arg = default_conversion (arg);
       break;
@@ -4295,7 +4309,7 @@ build_unary_op (code, xarg, noconvert)
     case CONJ_EXPR:
       /* Conjugating a real value is a no-op, but allow it anyway.  */
       if (!(arg = build_expr_type_conversion (WANT_ARITH | WANT_ENUM, arg, 1)))
-	errstring = "wrong type argument to conjugation";
+	errstring = N_("wrong type argument to conjugation");
       else if (!noconvert)
 	arg = default_conversion (arg);
       break;
@@ -4305,7 +4319,7 @@ build_unary_op (code, xarg, noconvert)
       val = invert_truthvalue (arg);
       if (arg != error_mark_node)
 	return val;
-      errstring = "in argument to unary !";
+      errstring = N_("in argument to unary !");
       break;
 
     case NOP_EXPR:
@@ -4357,13 +4371,13 @@ build_unary_op (code, xarg, noconvert)
 					      arg, 1)))
 	{
 	  if (code == PREINCREMENT_EXPR)
-	    errstring ="no pre-increment operator for type";
+	    errstring = N_("no pre-increment operator for type");
 	  else if (code == POSTINCREMENT_EXPR)
-	    errstring ="no post-increment operator for type";
+	    errstring = N_("no post-increment operator for type");
 	  else if (code == PREDECREMENT_EXPR)
-	    errstring ="no pre-decrement operator for type";
+	    errstring = N_("no pre-decrement operator for type");
 	  else
-	    errstring ="no post-decrement operator for type";
+	    errstring = N_("no post-decrement operator for type");
 	  break;
 	}
 
@@ -4385,9 +4399,12 @@ build_unary_op (code, xarg, noconvert)
 
 	/* ARM $5.2.5 last annotation says this should be forbidden.  */
 	if (TREE_CODE (argtype) == ENUMERAL_TYPE)
-	  pedwarn ("ISO C++ forbids %sing an enum",
-		   (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR)
-		   ? "increment" : "decrement");
+	  {
+	    if (code == PREINCREMENT_EXPR)
+	      pedwarn ("ISO C++ forbids incrementing an enum");
+	    else
+	      pedwarn ("ISO C++ forbids decrementing an enum");
+	  }
 	    
 	/* Compute the increment.  */
 
@@ -4397,17 +4414,26 @@ build_unary_op (code, xarg, noconvert)
 	    tree type = complete_type (TREE_TYPE (argtype));
 	    
 	    if (!COMPLETE_OR_VOID_TYPE_P (type))
-	      error ("cannot %s a pointer to incomplete type `%T'",
-			((code == PREINCREMENT_EXPR
-			  || code == POSTINCREMENT_EXPR)
-			 ? "increment" : "decrement"), TREE_TYPE (argtype));
+	      {
+	        if (code == PREINCREMENT_EXPR)
+	          pedwarn ("cannot increment a pointer to incomplete type `%T'",
+			   TREE_TYPE (argtype));
+	        else
+	          pedwarn ("cannot decrement a pointer to incomplete type `%T'",
+			   TREE_TYPE (argtype));
+	      }
 	    else if ((pedantic || warn_pointer_arith)
 		     && (tmp == FUNCTION_TYPE || tmp == METHOD_TYPE
 			 || tmp == VOID_TYPE || tmp == OFFSET_TYPE))
-	      pedwarn ("ISO C++ forbids %sing a pointer of type `%T'",
-			  ((code == PREINCREMENT_EXPR
-			    || code == POSTINCREMENT_EXPR)
-			   ? "increment" : "decrement"), argtype);
+	      {
+	        if (code == PREINCREMENT_EXPR)
+	          pedwarn ("ISO C++ forbids incrementing a pointer of type `%T'",
+			   TREE_TYPE (argtype));
+	        else
+	          pedwarn ("ISO C++ forbids decrementing a pointer of type `%T'",
+			   TREE_TYPE (argtype));
+	      }
+			   
 	    inc = c_sizeof_nowarn (TREE_TYPE (argtype));
 	  }
 	else
@@ -4455,7 +4481,8 @@ build_unary_op (code, xarg, noconvert)
 	/* Complain about anything else that is not a true lvalue.  */
 	if (!lvalue_or_else (arg, ((code == PREINCREMENT_EXPR
 				    || code == POSTINCREMENT_EXPR)
-				   ? "increment" : "decrement")))
+				   ? "non-lvalue in increment" 
+				   : "non-lvalue in increment")))
 	  return error_mark_node;
 
 	/* Forbid using -- on `bool'.  */
@@ -4605,7 +4632,7 @@ build_unary_op (code, xarg, noconvert)
 	 is an error.  */
       else if (TREE_CODE (argtype) != FUNCTION_TYPE
 	       && TREE_CODE (argtype) != METHOD_TYPE
-	       && !lvalue_or_else (arg, "unary `&'"))
+	       && !lvalue_or_else (arg, "non-lvalue in unary &"))
 	return error_mark_node;
 
       if (argtype != error_mark_node)
@@ -4942,7 +4969,7 @@ build_compound_expr (list)
     }
 
   first = TREE_VALUE (list);
-  first = convert_to_void (first, "left-hand operand of comma");
+  first = convert_to_void (first, I18N_COMMA_LHS);
   if (first == error_mark_node)
     return error_mark_node;
   
@@ -4985,7 +5012,7 @@ build_static_cast (type, expr)
 
   if (TREE_CODE (type) == VOID_TYPE)
     {
-      expr = convert_to_void (expr, /*implicit=*/NULL);
+      expr = convert_to_void (expr, I18N_NULL);
       return expr;
     }
 
@@ -5113,7 +5140,7 @@ build_reinterpret_cast (type, expr)
 	expr = build_reinterpret_cast
 	  (build_pointer_type (TREE_TYPE (type)), expr);
       if (expr != error_mark_node)
-	expr = build_indirect_ref (expr, 0);
+	expr = build_indirect_ref (expr, I18N_NULL);
       return expr;
     }
   else if (same_type_ignoring_top_level_qualifiers_p (intype, type))
@@ -5286,7 +5313,7 @@ build_c_cast (type, expr)
       /* Conversion to void does not cause any of the normal function to
        * pointer, array to pointer and lvalue to rvalue decays.  */
       
-      value = convert_to_void (value, /*implicit=*/NULL);
+      value = convert_to_void (value, I18N_NULL);
       return value;
     }
   /* Convert functions and arrays to pointers and
@@ -5452,7 +5479,7 @@ build_modify_expr (lhs, modifycode, rhs)
 	
 	/* Check this here to avoid odd errors when trying to convert
 	   a throw to the type of the COND_EXPR.  */
-	if (!lvalue_or_else (lhs, "assignment"))
+	if (!lvalue_or_else (lhs, "non-lvalue in assignment"))
 	  return error_mark_node;
 
 	cond = build_conditional_expr
@@ -5603,7 +5630,7 @@ build_modify_expr (lhs, modifycode, rhs)
   /* Now we have handled acceptable kinds of LHS that are not truly lvalues.
      Reject anything strange now.  */
 
-  if (!lvalue_or_else (lhs, "assignment"))
+  if (!lvalue_or_else (lhs, "non-lvalue in assignment"))
     return error_mark_node;
 
   /* Warn about modifying something that is `const'.  Don't warn if
@@ -5674,19 +5701,19 @@ build_modify_expr (lhs, modifycode, rhs)
 
   if (modifycode == INIT_EXPR)
     newrhs = convert_for_initialization (lhs, lhstype, newrhs, LOOKUP_NORMAL,
-					 "initialization", NULL_TREE, 0);
+					 I18N_INITIALIZATION, NULL_TREE, 0);
   else
     {
       /* Avoid warnings on enum bit fields.  */
       if (TREE_CODE (olhstype) == ENUMERAL_TYPE
 	  && TREE_CODE (lhstype) == INTEGER_TYPE)
 	{
-	  newrhs = convert_for_assignment (olhstype, newrhs, "assignment",
+	  newrhs = convert_for_assignment (olhstype, newrhs, I18N_ASSIGNMENT,
 					   NULL_TREE, 0);
 	  newrhs = convert_force (lhstype, newrhs, 0);
 	}
       else
-	newrhs = convert_for_assignment (lhstype, newrhs, "assignment",
+	newrhs = convert_for_assignment (lhstype, newrhs, I18N_ASSIGNMENT,
 					 NULL_TREE, 0);
       if (TREE_CODE (newrhs) == CALL_EXPR
 	  && TYPE_NEEDS_CONSTRUCTING (lhstype))
@@ -5761,7 +5788,7 @@ build_modify_expr (lhs, modifycode, rhs)
       TREE_NO_UNUSED_WARNING (result) = 1;
       return result;
     }
-  return convert_for_assignment (olhstype, result, "assignment",
+  return convert_for_assignment (olhstype, result, I18N_ASSIGNMENT,
 				 NULL_TREE, 0);
 }
 
@@ -6074,7 +6101,7 @@ tree
 dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
      tree type;
      tree expr;
-     const char *errtype;
+     enum i18n_string errtype;
      tree fndecl;
      int parmnum;
 {
@@ -6085,10 +6112,10 @@ dubious_conversion_warnings (type, expr,
   if (ARITHMETIC_TYPE_P (type) && expr == null_node)
     {
       if (fndecl)
-        warning ("passing NULL used for non-pointer %s %P of `%D'",
-                    errtype, parmnum, fndecl);
+        warning ("passing NULL used as non-pointer %s %P of `%D'",
+                    i18n_accus[errtype], parmnum, fndecl);
       else
-        warning ("%s to non-pointer type `%T' from NULL", errtype, type);
+        warning ("%s to non-pointer type `%T' from NULL", i18n_subject[errtype], type);
     }
   
   /* Warn about assigning a floating-point type to an integer type.  */
@@ -6096,10 +6123,10 @@ dubious_conversion_warnings (type, expr,
       && TREE_CODE (type) == INTEGER_TYPE)
     {
       if (fndecl)
-	warning ("passing `%T' for %s %P of `%D'",
-		    TREE_TYPE (expr), errtype, parmnum, fndecl);
+	warning ("passing `%T' as %s %P of `%D'",
+		    TREE_TYPE (expr), i18n_accus[errtype], parmnum, fndecl);
       else
-	warning ("%s to `%T' from `%T'", errtype, type, TREE_TYPE (expr));
+	warning ("%s to `%T' from `%T'", i18n_subject[errtype], type, TREE_TYPE (expr));
     }
   /* And warn about assigning a negative value to an unsigned
      variable.  */
@@ -6109,11 +6136,11 @@ dubious_conversion_warnings (type, expr,
 	  && TREE_NEGATED_INT (expr))
 	{
 	  if (fndecl)
-	    warning ("passing negative value `%E' for %s %P of `%D'",
-			expr, errtype, parmnum, fndecl);
+	    warning ("passing negative value `%E' as %s %P of `%D'",
+			expr, i18n_accus[errtype], parmnum, fndecl);
 	  else
 	    warning ("%s of negative value `%E' to `%T'",
-			errtype, expr, type);
+			i18n_subject[errtype], expr, type);
 	}
 
       overflow_warning (expr);
@@ -6133,7 +6160,7 @@ dubious_conversion_warnings (type, expr,
 static tree
 convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
      tree type, rhs;
-     const char *errtype;
+     enum i18n_string errtype;
      tree fndecl;
      int parmnum;
 {
@@ -6202,8 +6229,8 @@ convert_for_assignment (type, rhs, errty
 	    error ("cannot convert `%T' to `%T' for argument `%P' to `%D'",
 		      rhstype, type, parmnum, fndecl);
 	  else
-	    error ("cannot convert `%T' to `%T' in %s", rhstype, type, 
-		      errtype);
+	    error ("cannot convert `%T' to `%T' %s", rhstype, type, 
+		      i18n_in[errtype]);
 	  return error_mark_node;
 	}
     }
@@ -6230,7 +6257,7 @@ tree
 convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
      tree exp, type, rhs;
      int flags;
-     const char *errtype;
+     enum i18n_string errtype;
      tree fndecl;
      int parmnum;
 {
@@ -6589,7 +6616,7 @@ check_return_expr (retval)
          case that functype is smaller than the valtype. */
       retval = convert_for_initialization
 	(NULL_TREE, functype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
-	 "return", NULL_TREE, 0);
+	 I18N_RETURN, NULL_TREE, 0);
       retval = convert (valtype, retval);
 
       /* If the conversion failed, treat this just like `return;'.  */
diff -rpNU3 gcc-checkout/cp-old/typeck2.c gcc-checkout/gcc/gcc/cp/typeck2.c
--- gcc-checkout/cp-old/typeck2.c	Fri Jun 14 08:45:00 2002
+++ gcc-checkout/gcc/gcc/cp/typeck2.c	Wed Jun 19 09:08:24 2002
@@ -35,7 +35,9 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "cp-tree.h"
+#include "cp-i18n.h"
 #include "flags.h"
+#include "intl.h"
 #include "toplev.h"
 #include "output.h"
 #include "diagnostic.h"
@@ -90,9 +92,11 @@ readonly_error (arg, string, soft)
   if (TREE_CODE (arg) == COMPONENT_REF)
     {
       if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
-        fmt = "%s of data-member `%D' in read-only structure";
+	/* TRANSLATORS: This and the next 8 translations have %s replaced
+	   by either "assignment" or "modification by `asm'." */
+        fmt = N_("%s of data-member `%D' in read-only structure");
       else
-        fmt = "%s of read-only data-member `%D'";
+        fmt = N_("%s of read-only data-member `%D'");
       (*fn) (fmt, string, TREE_OPERAND (arg, 1));
     }
   else if (TREE_CODE (arg) == VAR_DECL)
@@ -100,9 +104,9 @@ readonly_error (arg, string, soft)
       if (DECL_LANG_SPECIFIC (arg)
 	  && DECL_IN_AGGR_P (arg)
 	  && !TREE_STATIC (arg))
-	fmt = "%s of constant field `%D'";
+	fmt = N_("%s of constant field `%D'");
       else
-	fmt = "%s of read-only variable `%D'";
+	fmt = N_("%s of read-only variable `%D'");
       (*fn) (fmt, string, arg);
     }
   else if (TREE_CODE (arg) == PARM_DECL)
@@ -614,7 +618,7 @@ digest_init (type, init, tail)
 	}
 
       return convert_for_initialization (0, type, init, LOOKUP_NORMAL,
-					 "initialization", NULL_TREE, 0);
+					 I18N_INITIALIZATION, NULL_TREE, 0);
     }
 
   /* Come here only for records and arrays (and unions with constructors).  */
@@ -654,7 +658,7 @@ digest_init (type, init, tail)
 	    flags |= LOOKUP_ONLYCONVERTING;
 
 	  return convert_for_initialization (NULL_TREE, type, init, flags,
-					     "initialization", NULL_TREE, 0);
+					     I18N_INITIALIZATION, NULL_TREE, 0);
 	}
     }
 
@@ -1128,7 +1132,7 @@ build_x_arrow (datum)
     last_rval = default_conversion (rval);
 
   if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
-    return build_indirect_ref (last_rval, NULL);
+    return build_indirect_ref (last_rval, I18N_NULL);
 
   if (types_memoized)
     error ("result of `operator->()' yields non-pointer result");
@@ -1319,13 +1323,13 @@ build_functional_cast (exp, parms)
    exception for C-style casts, to accommodate GNU C stylings.  */
 
 void
-check_for_new_type (string, inptree)
-     const char *string;
+check_for_new_type (where, inptree)
+     enum i18n_string where;
      flagged_type_tree inptree;
 {
   if (inptree.new_type_flag
-      && (pedantic || strcmp (string, "cast") != 0))
-    pedwarn ("ISO C++ forbids defining types within %s", string);
+      && (pedantic || where != I18N_CAST))
+    pedwarn ("ISO C++ forbids defining types %s", i18n_within[where]);
 }
 
 /* Add new exception specifier SPEC, to the LIST we currently have.



More information about the Gcc-patches mailing list