From d2a6f3c03ee1da2110de65370db171f1548d6d66 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Mon, 7 Apr 2003 05:33:12 +0000 Subject: [PATCH] call.c: Include intl.h. * call.c: Include intl.h. (print_z_candidate): Always use inform; get rid of errfn argument. Reorganize so that all the strings get picked up by xgettext. Note obligation of caller to pass first argument through gettext. (print_z_candidates): Update to match. Indent second and successive candidates by strlen() of translated message. (joust): Restructure ambiguous-conversion pedwarn so that translators see a complete sentence. Update calls to print_z_candidate. * Make-lang.in (cp/call.o): Update dependencies. From-SVN: r65320 --- gcc/cp/ChangeLog | 91 ++++++++++++++++++++++++++++-------------------- gcc/cp/call.c | 79 ++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 67 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d8464aa5724b..ce68f07756a8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +2003-04-06 Zack Weinberg + + * call.c: Include intl.h. + (print_z_candidate): Always use inform; get rid of errfn + argument. Reorganize so that all the strings get picked up + by xgettext. Note obligation of caller to pass first argument + through gettext. + (print_z_candidates): Update to match. Indent second and + successive candidates by strlen() of translated message. + (joust): Restructure ambiguous-conversion pedwarn so that + translators see a complete sentence. Update calls to + print_z_candidate. + + * Make-lang.in (cp/call.o): Update dependencies. + 2003-04-05 Kaveh R. Ghazi * decl.c (set_current_binding_level): Delete, revert last change. @@ -73,7 +88,7 @@ of ggc_alloc. Include gt-cp-name-lookup.h at the end of the file. * Make-lang.in: (gt-cp-name-lookup.h): Is generated by gengtype. (cp/name-lookup.o): Depends on gt-cp-name-lookup.h. - + 2003-03-31 Jason Merrill PR java/10145 @@ -93,7 +108,7 @@ 2003-03-30 Gabriel Dos Reis * cp-tree.h (binding_for_name: Move to name-lookup.h Adjust - prototype. + prototype. (cxx_scope_find_binding_for_name): Likewise. * decl.c (find_binding: Move to name-lookup.c. (binding_for_name): Likewise. @@ -195,7 +210,7 @@ (joust): Add comment for translators. 2003-03-24 Nathan Sidwell - + PR c++/9898, PR c++/383, DR 322 * pt.c (maybe_adjust_types_for_deduction) : Look through reference types on both PARM and ARG. @@ -6925,7 +6940,7 @@ * decl.c: Include c-common.h. (shadow_warning): Move to c-common.c. -Wed Dec 5 17:00:49 2001 Richard Kenner +2001-12-05 Richard Kenner * decl.c (duplicate_decls): Don't copy DECL_NO_CHECK_MEMORY_USAGE. @@ -7042,7 +7057,7 @@ Wed Dec 5 17:00:49 2001 Richard Kenner * Make-lang.in (c++.generated-manpages): New dummy target. -Tue Nov 27 09:03:47 2001 Richard Kenner +2001-11-27 Richard Kenner * Make-lang.in (cp-lang.o): Depends on c-common.h. * cp-lang.c (c-common.h): Include. @@ -7306,7 +7321,7 @@ Tue Nov 27 09:03:47 2001 Richard Kenner * cp-lang.c: Redefine LANG_HOOKS_CLEAR_BINDING_STACK to pop_everything. -Tue Oct 23 14:00:20 2001 Richard Kenner +2001-10-23 Richard Kenner * cp-lang.c (cxx_get_alias_set): New function. Point LANG_HOOKS_GET_ALIAS_SET to it. @@ -7578,7 +7593,7 @@ Tue Oct 23 14:00:20 2001 Richard Kenner instead of deleted print_* routines. Handle %C, %L, %O, %Q also. (init_error): Adjust to match. -Sat Sep 22 09:15:31 2001 Richard Kenner +2001-09-22 Richard Kenner * Make-lang.in (CXX_C_OBJS): Add attribs.o. @@ -7592,7 +7607,7 @@ Sat Sep 22 09:15:31 2001 Richard Kenner * decl2.c (mark_vtable_entries): Mark FDESC_EXPR. * typeck.c (get_member_function_from_ptrfunc): Mind descriptors. -Fri Sep 21 08:16:19 2001 J"orn Rennecke +2001-09-21 J"orn Rennecke * decl.c (grokdeclarator): Use C syntax for attr_flags declaration. @@ -8806,7 +8821,7 @@ Fri Sep 21 08:16:19 2001 J"orn Rennecke * gxxint.texi: Remove. * Make-lang.in: Remove all traces of gxxint.texi. -Mon Apr 30 16:14:10 2001 Mark P Mitchell +2001-04-30 Mark P Mitchell * decl2.c (start_static_initialization_or_destruction): Correct logic to handle the -fno-use-cxa-atexit case. @@ -9096,7 +9111,7 @@ Mon Apr 30 16:14:10 2001 Mark P Mitchell * lang-specs.h: Add __DEPRECATED. -Thu Apr 5 16:54:29 2001 J"orn Rennecke +2001-04-05 J"orn Rennecke * search.c (get_dynamic_cast_base_type): When building a new constant, set its type to ssizetype. @@ -9997,7 +10012,7 @@ Thu Apr 5 16:54:29 2001 J"orn Rennecke * Makefile.in (g++spec.o): Adjust use of DRIVER_DEFINES. -Sun Feb 4 15:52:44 2001 Richard Kenner +2001-02-04 Richard Kenner * decl.c (pushdecl): Call abort instead of fatal. * except.c (decl_is_java_type): Call fatal_error instead of fatal. @@ -10952,7 +10967,7 @@ Sun Feb 4 15:52:44 2001 Richard Kenner Cope when there is no partial instantiation of a template template member. -Thu Nov 23 02:16:47 2000 J"orn Rennecke +2000-11-23 J"orn Rennecke * Make-lang.in (g++spec.o, cxxmain.o): Depend on $(CONFIG_H). @@ -11283,7 +11298,7 @@ Thu Nov 23 02:16:47 2000 J"orn Rennecke * typeck2.c (abstract_virtuals_error): Use "because" instead of "since" in error message. -Fri Oct 20 13:54:59 2000 Richard Kenner +2000-10-20 Richard Kenner * typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE. @@ -11352,7 +11367,7 @@ Fri Oct 20 13:54:59 2000 Richard Kenner * dump.c (dequeue_and_dump): Dump TREE_USED. -Tue Oct 17 20:19:06 2000 Brad Lucier +2000-10-17 Brad Lucier * spew.c (snarf_defarg): Cast 2nd arg to obstack_blank to (int). @@ -11590,7 +11605,7 @@ Tue Oct 17 20:19:06 2000 Brad Lucier * lex.c (reswords): Add _Complex. -Thu Sep 14 12:10:45 2000 Richard Kenner +2000-09-14 Richard Kenner * Make-lang.in (cplib2.txt): Depend on cp/Makefile. @@ -12604,7 +12619,7 @@ Thu Sep 14 12:10:45 2000 Richard Kenner rest_of_decl_compilation, for local guards. * lex.c (do_identifier): Remove unused variable. -Wed Jul 26 15:05:51 CEST 2000 Marc Espie +2000-07-26 Marc Espie * parse.y: Add missing ';'. @@ -13629,7 +13644,7 @@ Wed Jul 26 15:05:51 CEST 2000 Marc Espie * cp-tree.h (struct lang_type): Add user_align member. (CLASSTYPE_USER_ALIGN): Define. -Tue Jun 13 15:48:03 2000 Maciej W. Rozycki +2000-06-13 Maciej W. Rozycki * Make-lang.in (c++.install-common): Install g++-cross in $(gcc_tooldir)/bin as g++ and c++; g++ in $(bindir) as @@ -13805,7 +13820,7 @@ Tue Jun 13 15:48:03 2000 Maciej W. Rozycki Avoid unnecessary searching. (__dynamic_cast): Adjust for __dyncast_result::whole_details. -Mon Jun 5 06:48:55 2000 Richard Kenner +2000-06-05 Richard Kenner * decl.c (init_decl_processing): Don't call record_component_aliases. * tree.c (build_cplus_array_type_1): Likewise. @@ -13946,7 +13961,7 @@ Mon Jun 5 06:48:55 2000 Richard Kenner * init.c (resolve_offset_ref): Remove check for TREE_ADDRESSABLE on FIELD_DECLs. -Wed May 31 14:09:00 2000 Richard Kenner +2000-05-31 Richard Kenner * cp-tree.h (c_get_alias_set): Deleted. * Makefile.in (decl.o): Include ../expr.h. @@ -14114,7 +14129,7 @@ Wed May 31 14:09:00 2000 Richard Kenner * Make-lang.in (cplib2.ready): Eradicate. -Sat May 27 11:25:46 2000 Richard Kenner +2000-05-27 Richard Kenner * method.c (mangle_expression): Use TREE_CODE_LENGTH. * tree.c (break_out_calls, build_min_nt): Use TREE_CODE_LENGTH. @@ -14272,7 +14287,7 @@ Sat May 27 11:25:46 2000 Richard Kenner * init.c (sort_member_init): Fix typo in error message generation code. -Mon May 15 11:46:29 2000 Donald Lindsay +2000-05-15 Donald Lindsay * semantics.c (begin_class_definition): make the packed attribute be sensitive to the "-fpack-struct" command line flag @@ -14492,7 +14507,7 @@ Mon May 15 11:46:29 2000 Donald Lindsay reference. * typeck.c (build_component_ref): Fix formatting. -Wed May 17 17:27:44 2000 Andrew Cagney +2000-05-17 Andrew Cagney * decl.c (pop_label): Replace warn_unused with warn_unused_label. * typeck.c (build_x_compound_expr): Replace warn_unused with @@ -14914,7 +14929,7 @@ Wed May 17 17:27:44 2000 Andrew Cagney * decl2.c (grokfield): Issue error on illegal data member declaration. -Mon Apr 17 17:11:16 2000 Mark P Mitchell +2000-04-17 Mark P Mitchell * method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL. @@ -14951,7 +14966,7 @@ Mon Apr 17 17:11:16 2000 Mark P Mitchell Use int_size_in_bytes. (emit_thunk): Handle vcall offset thunks. -Sat Apr 15 16:00:01 2000 Richard Kenner +2000-04-15 Richard Kenner * decl2.c (parse_time, varconst_time): Delete declarations. (finish_file): Delete LINENO declaration. @@ -15639,7 +15654,7 @@ Wed Apr 5 15:12:18 MET DST 2000 Jan Hubicka * tinfo.cc (__dynamic_cast): Look for vtable_prefix at appropriate negative offset. -Sun Mar 26 20:15:26 2000 Richard Kenner +2000-03-26 Richard Kenner * class.c (check_field_decl): Fix typo. (build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS. @@ -15674,7 +15689,7 @@ Sun Mar 26 20:15:26 2000 Richard Kenner * dump.c (dequeue_and_dump): Dump DECL_TEMPLATE_RESULT. -Sat Mar 25 09:12:10 2000 Richard Kenner +2000-03-25 Richard Kenner * class.c (build_vbase_pointer_fields): layout_field now place_field. (get_vfield_offset): Use byte_position. @@ -15913,7 +15928,7 @@ Sat Mar 25 09:12:10 2000 Richard Kenner (note_name_declared_in_class): Use OVL_CURRENT to get at a potential overload. -Fri Mar 17 08:09:14 2000 Richard Kenner +2000-03-17 Richard Kenner * class.c (build_vbase_path): Use integer_zerop. (build_vtable_entry): Use tree_low_cst. @@ -16192,7 +16207,7 @@ Fri Mar 17 08:09:14 2000 Richard Kenner * typeck.c (dubious_conversion_warnings): Look through REFERENCE_TYPE. -Mon Mar 6 08:46:47 2000 Richard Kenner +2000-03-06 Richard Kenner * class.c (dfs_modify_vtables): I is now unsigned. (check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int. @@ -16337,7 +16352,7 @@ Mon Mar 6 08:46:47 2000 Richard Kenner push_eh_cleanup() when handling a Java-style "catch". Pass Java class reference to build_catch_block. -Thu Mar 2 13:32:01 2000 Richard Kenner +2000-03-02 Richard Kenner * typeck.c (comptypes): Treat sizetype like its language equivalent. @@ -16366,7 +16381,7 @@ Thu Mar 2 13:32:01 2000 Richard Kenner * class.c (resolve_address_of_overloaded_function): Pass desired return type to fn_type_unification. -Mon Feb 28 08:15:23 2000 Richard Kenner +2000-02-28 Richard Kenner * class.c (build_vtbl_or_vbase_field, check_methods): Don't clear DECL_FIELD_SIZE. @@ -16384,7 +16399,7 @@ Mon Feb 28 08:15:23 2000 Richard Kenner (friend_accessible_p): Lose TYPE parm. (accessible_p): Adjust. -Sun Feb 27 16:40:33 2000 Richard Kenner +2000-02-27 Richard Kenner * class.c (dfs_build_vtable_offset_vtbl_entries): Don't use size_binop on things that are not sizes; ssize_binop deleted. @@ -16471,7 +16486,7 @@ Sun Feb 27 16:40:33 2000 Richard Kenner * lex.c (check_newline): Tweak filename/lineno setting. * semantics.c (begin_while_stmt): Fix typo in comment. -Sat Feb 26 19:50:23 2000 Richard Kenner +2000-02-26 Richard Kenner * lang-options.h (-fmessage-length=): Add missing option. @@ -16481,7 +16496,7 @@ Sat Feb 26 19:50:23 2000 Richard Kenner * Make-lang.in: Delete refs to LIBGCC2_DEPS. -Fri Feb 25 14:52:33 2000 Jim Wilson +2000-02-25 Jim Wilson * optimize.c (expand_call_inline): Emit the return label before evaluating the return value. @@ -16610,7 +16625,7 @@ Fri Feb 25 14:52:33 2000 Jim Wilson * pt.c (tsubst_decl): Fix formatting. -Sat Feb 19 18:43:13 2000 Richard Kenner +2000-02-19 Richard Kenner * class.c (build_primary_vtable, layout_vtable_decl): Likewise. (avoid_overlap, build_base_field): Likewise. @@ -16881,7 +16896,7 @@ Sat Feb 19 18:43:13 2000 Richard Kenner * parse.y (simple_stmt): Allow :: token in asm parameter list. * parse.c: Rebuilt. -Mon Jan 31 15:35:29 2000 Jim Wilson +2000-01-31 Jim Wilson * class.c (build_vtbl_or_vbase_field): New parameter fcontext. Store it in DECL_FCONTEXT. @@ -17093,12 +17108,12 @@ Mon Jan 31 15:35:29 2000 Jim Wilson (build_vtbl_initializer): Likewise. * decl2.c (finish_file): Likewise. -Thu Jan 27 20:53:36 2000 Jim Wilson +2000-01-27 Jim Wilson * optimize.c (remap_decl): Add walk_tree calls for DECL_SIZE (t) and TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))). -Thu Jan 27 13:54:12 2000 Mike Stump +2000-01-27 Mike Stump * decl.c (pushdecl): Fix up shadow warnings with respect to implicit for scopes. @@ -17107,7 +17122,7 @@ Thu Jan 27 13:54:12 2000 Mike Stump * pt.c (unify): Use fold, not maybe_fold_nontype_arg. -Wed Jan 26 22:19:14 2000 J"orn Rennecke +2000-01-26 J"orn Rennecke * optimize.c (calls_setjmp_r): Supply new argument to special_function_p. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b2f9291139fd..fd669f8d892e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "expr.h" #include "diagnostic.h" +#include "intl.h" extern int inhibit_warnings; @@ -56,8 +57,7 @@ static void op_error (enum tree_code, enum tree_code, tree, tree, static tree build_object_call (tree, tree); static tree resolve_args (tree); static struct z_candidate *build_user_type_conversion_1 (tree, tree, int); -static void print_z_candidate (const char *msgid, struct z_candidate *, - void (*)(const char *, ...)); +static void print_z_candidate (const char *, struct z_candidate *); static void print_z_candidates (struct z_candidate *); static tree build_this (tree); static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *); @@ -2437,34 +2437,39 @@ equal_functions (tree fn1, tree fn2) return fn1 == fn2; } -/* Print information about one overload candidate CANDIDATE. STR is the - text to print before the candidate itself and ERRFN is the routine - (i.e. error, warning or pedwarn) used to do the printing. */ +/* Print information about one overload candidate CANDIDATE. MSGSTR + is the text to print before the candidate itself. + + NOTE: Unlike most diagnostic functions in GCC, MSGSTR is expected + to have been run through gettext by the caller. This wart makes + life simpler in print_z_candidates and for the translators. */ static void -print_z_candidate (const char *msgid, struct z_candidate *candidate, - void (*errfn)(const char *, ...)) +print_z_candidate (const char *msgstr, struct z_candidate *candidate) { if (TREE_CODE (candidate->fn) == IDENTIFIER_NODE) { if (TREE_VEC_LENGTH (candidate->convs) == 3) - errfn ("%s %D(%T, %T, %T) ", msgid, candidate->fn, - TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)), - TREE_TYPE (TREE_VEC_ELT (candidate->convs, 1)), - TREE_TYPE (TREE_VEC_ELT (candidate->convs, 2))); + inform ("%s %D(%T, %T, %T) ", msgstr, candidate->fn, + TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)), + TREE_TYPE (TREE_VEC_ELT (candidate->convs, 1)), + TREE_TYPE (TREE_VEC_ELT (candidate->convs, 2))); else if (TREE_VEC_LENGTH (candidate->convs) == 2) - errfn ("%s %D(%T, %T) ", msgid, candidate->fn, - TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)), - TREE_TYPE (TREE_VEC_ELT (candidate->convs, 1))); + inform ("%s %D(%T, %T) ", msgstr, candidate->fn, + TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0)), + TREE_TYPE (TREE_VEC_ELT (candidate->convs, 1))); else - errfn ("%s %D(%T) ", msgid, candidate->fn, - TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0))); + inform ("%s %D(%T) ", msgstr, candidate->fn, + TREE_TYPE (TREE_VEC_ELT (candidate->convs, 0))); } else if (TYPE_P (candidate->fn)) - errfn ("%s %T ", msgid, candidate->fn); + inform ("%s %T ", msgstr, candidate->fn); + else if (candidate->viable == -1) + inform ("%H%s %+#D ", + &DECL_SOURCE_LOCATION (candidate->fn), msgstr, candidate->fn); else - errfn ("%H%s %+#D%s", &DECL_SOURCE_LOCATION (candidate->fn), msgid, - candidate->fn, candidate->viable == -1 ? " " : ""); + inform ("%H%s %+#D", + &DECL_SOURCE_LOCATION (candidate->fn), msgstr, candidate->fn); } static void @@ -2496,11 +2501,27 @@ print_z_candidates (struct z_candidate *candidates) } } - str = "candidates are:"; - for (; candidates; candidates = candidates->next) + if (!candidates) + return; + + str = _("candidates are:"); + print_z_candidate (str, candidates); + if (candidates->next) { - print_z_candidate (str, candidates, error); - str = " "; + /* Indent successive candidates by the length of the translation of + the above string. */ + size_t len = strlen (str) + 1; + char *spaces = alloca (len); + memset (spaces, ' ', len-1); + spaces[len] = '\0'; + + candidates = candidates->next; + do + { + print_z_candidate (spaces, candidates); + candidates = candidates->next; + } + while (candidates); } } @@ -5866,12 +5887,12 @@ tweak: { if (warn) { - print_z_candidate ("ISO C++ says that ", w, pedwarn); - /* Translators note: This message is a continuation of the - previous one, aligned on the right. */ - print_z_candidate (" and ", l, pedwarn); - pedwarn ("are ambiguous even though the worst conversion \ -for the former is better than the worst conversion for the latter"); + pedwarn ("\ +ISO C++ says that these are ambiguous, even \ +though the worst conversion for the first is better than \ +the worst conversion for the second:"); + print_z_candidate (_("candidate 1:"), w); + print_z_candidate (_("candidate 2:"), l); } else add_warning (w, l); -- 2.43.5