Re: [commit] mark up quit et.al.

Eli Zaretskii
2005-02-12T13:10:48Z

> Date: Fri, 11 Feb 2005 13:15:26 -0500
> From: Andrew Cagney <cagney@gnu.org>
>
> FYI,
> committed,

Thanks, although I'd prefer this to be an RFA and be reviewed by
others. i18n changes are almost never obvious, IMHO.

> Mark up error_no_arg, query, perror_with_name, complaint, and
> internal_error.

IMHO, it doesn't make sense to translate strings passed to `query' and
`complaint' without taking care of the code of those functions
themselves. For example, `query' assumes 'y', 'n', and 'a' as
possible responses (which are not translated); we should probably
replace those single-character responses by translatable strings, and
we should make strings internal to `query', like "Please answer y or
n", use the translations of 'y' and 'n'. As for `complaint', it
prefixes the string with some other strings whose relation to the
complaint is not visible by the translators. Similar problems exist
in internal_error and its subroutines.

> @@ -966,7 +966,7 @@ set_namestring (struct objfile *objfile,
> if (((unsigned) nlist.n_strx + file_string_table_offset) >=
> DBX_STRINGTAB_SIZE (objfile))
> {
> - complaint (&symfile_complaints, "bad string table offset in symbol %d",
> + complaint (&symfile_complaints, _("bad string table offset in symbol %d"),
> symnum);
> namestring = "<bad string table offset>";

The value of namestring should be marked up for translation here.

> @@ -784,7 +784,7 @@ gdb_wait_for_event (void)
> FD_ZERO (&gdb_notifier.ready_masks[2]);
> /* Dont print anything is we got a signal, let gdb handle it. */
> if (errno != EINTR)
> - perror_with_name ("Select");
> + perror_with_name (("select"));

This hunk should have only change "Select" into "select" (since the
original string was a bug: it's complaining about `select' the system
call). The extra parens added by this hunk should be removed, and no
translation of `select' is needed.

> @@ -291,7 +291,7 @@ fork_inferior (char *exec_file_arg, char
> pid = vfork ();
>
> if (pid < 0)
> - perror_with_name ("vfork");
> + perror_with_name (("vfork"));

Same here: this call to perror_with_name should be left alone.

> @@ -1050,7 +1050,7 @@ frv_extract_return_value (struct type *t
> store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, regval);
> }
> else
> - internal_error (__FILE__, __LINE__, "Illegal return value length: %d", len);
> + internal_error (__FILE__, __LINE__, _("Illegal return value length: %d"), len);
> }

Here, "Illegal" should be replaced with "Invalid".

> @@ -5633,7 +5633,7 @@ hpread_process_one_debug_symbol (union d
> case DNTT_TYPE_COMMON:
> /* End a FORTRAN common block. We don't currently handle these */
> complaint (&symfile_complaints,
> - "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n");
> + _("unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n"));
> break;

Here (and in other places in hpread.c), the error messages mention a
wrong source file hp-symtab-read.c. They should instead use __FILE__.

> @@ -810,7 +810,7 @@ child_resume (ptid_t ptid, int step, enu
> }
>
> if (ptrace (request, pid, 0, target_signal_to_host (signal)) == -1)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));

Another case of bad parens (a bug in the script that did the
transformation?).

> @@ -75,7 +75,7 @@ i386fbsd_resume (ptid_t ptid, int step,
> written a new PC value to the child.) */
> if (ptrace (request, pid, (caddr_t) 1,
> target_signal_to_host (signal)) == -1)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));

And another one.

> @@ -95,7 +95,7 @@ inf_ptrace_resume (ptid_t ptid, int step
> errno = 0;
> ptrace (request, pid, (PTRACE_TYPE_ARG3) 1, target_signal_to_host (signal));
> if (errno != 0)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));

And another.

> @@ -215,7 +215,7 @@ inf_ptrace_attach (char *args, int from_
> errno = 0;
> ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
> if (errno != 0)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));

And another.

> @@ -265,7 +265,7 @@ inf_ptrace_detach (char *args, int from_
> errno = 0;
> ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, sig);
> if (errno != 0)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));

And another.

> @@ -98,17 +98,17 @@ inf_ttrace_enable_syscall_events (pid_t
>
> if (ttrace (TT_PROC_GET_EVENT_MASK, pid, 0,
> (uintptr_t)&tte, sizeof tte, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> tte.tte_events |= (TTEVT_SYSCALL_ENTRY | TTEVT_SYSCALL_RETURN);
>
> if (ttrace (TT_PROC_SET_EVENT_MASK, pid, 0,
> (uintptr_t)&tte, sizeof tte, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> if (ttrace (TT_PROC_GET_FIRST_LWP_STATE, pid, 0,
> (uintptr_t)&tts, sizeof tts, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> if (tts.tts_flags & TTS_INSYSCALL)
> inf_ttrace_num_lwps_in_syscall++;
> @@ -127,13 +127,13 @@ inf_ttrace_disable_syscall_events (pid_t
>
> if (ttrace (TT_PROC_GET_EVENT_MASK, pid, 0,
> (uintptr_t)&tte, sizeof tte, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> tte.tte_events &= ~(TTEVT_SYSCALL_ENTRY | TTEVT_SYSCALL_RETURN);
>
> if (ttrace (TT_PROC_SET_EVENT_MASK, pid, 0,
> (uintptr_t)&tte, sizeof tte, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> inf_ttrace_num_lwps_in_syscall = 0;
> }
> @@ -190,7 +190,7 @@ inf_ttrace_add_page (pid_t pid, CORE_ADD
>
> if (ttrace (TT_PROC_GET_MPROTECT, pid, 0,
> addr, 0, (uintptr_t)&prot) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> page = XMALLOC (struct inf_ttrace_page);
> page->addr = addr;
> @@ -209,7 +209,7 @@ inf_ttrace_add_page (pid_t pid, CORE_ADD
> {
> if (ttrace (TT_PROC_SET_MPROTECT, pid, 0,
> addr, pagesize, prot & ~PROT_WRITE) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
> }
> }
>
> @@ -249,7 +249,7 @@ inf_ttrace_remove_page (pid_t pid, CORE_
> {
> if (ttrace (TT_PROC_SET_MPROTECT, pid, 0,
> addr, pagesize, page->prot) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
> }
>
> inf_ttrace_page_dict.count--;
> @@ -283,7 +283,7 @@ inf_ttrace_mask_page_protections (pid_t
> {
> if (ttrace (TT_PROC_SET_MPROTECT, pid, 0,
> page->addr, pagesize, page->prot & ~prot) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> page = page->next;
> }
> @@ -379,7 +379,7 @@ inf_ttrace_stopped_by_watchpoint (void)
> {
> if (ttrace (TT_LWP_GET_STATE, pid, lwpid,
> (uintptr_t)&tts, sizeof tts, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> if (tts.tts_event == TTEVT_SIGNAL
> && tts.tts_u.tts_signal.tts_signo == SIGBUS)
> @@ -435,15 +435,15 @@ inf_ttrace_me (void)
>
> /* "Trace me, Dr. Memory!" */
> if (ttrace (TT_PROC_SETTRC, 0, 0, 0, TT_VERSION, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> /* Tell our parent that we are ready to be traced. */
> if (write (inf_ttrace_pfd1[1], &c, sizeof c) != sizeof c)
> - perror_with_name ("write");
> + perror_with_name (("write"));
>
> /* Wait until our parent has set the initial event mask. */
> if (read (inf_ttrace_pfd2[0], &c, sizeof c) != sizeof c)
> - perror_with_name ("read");
> + perror_with_name (("read"));
>
> do_cleanups (old_chain);
> }
> @@ -459,7 +459,7 @@ inf_ttrace_him (int pid)
>
> /* Wait until our child is ready to be traced. */
> if (read (inf_ttrace_pfd1[0], &c, sizeof c) != sizeof c)
> - perror_with_name ("read");
> + perror_with_name (("read"));
>
> /* Set the initial event mask. */
> memset (&tte, 0, sizeof (tte));
> @@ -471,11 +471,11 @@ inf_ttrace_him (int pid)
> tte.tte_opts = TTEO_NOSTRCCHLD;
> if (ttrace (TT_PROC_SET_EVENT_MASK, pid, 0,
> (uintptr_t)&tte, sizeof tte, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> /* Tell our child that we have set the initial event mask. */
> if (write (inf_ttrace_pfd2[1], &c, sizeof c) != sizeof c)
> - perror_with_name ("write");
> + perror_with_name (("write"));
>
> do_cleanups (old_chain);
>
> @@ -526,7 +526,7 @@ inf_ttrace_kill_inferior (void)
> return;
>
> if (ttrace (TT_PROC_EXIT, pid, 0, 0, 0, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
> /* ??? Is it necessary to call ttrace_wait() here? */
> target_mourn_inferior ();
> }
> @@ -596,7 +596,7 @@ inf_ttrace_attach (char *args, int from_
> gdb_assert (inf_ttrace_num_lwps_in_syscall == 0);
>
> if (ttrace (TT_PROC_ATTACH, pid, 0, TT_KILL_ON_EXIT, TT_VERSION, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
> attach_flag = 1;
>
> /* Set the initial event mask. */
> @@ -609,7 +609,7 @@ inf_ttrace_attach (char *args, int from_
> tte.tte_opts = TTEO_NOSTRCCHLD;
> if (ttrace (TT_PROC_SET_EVENT_MASK, pid, 0,
> (uintptr_t)&tte, sizeof tte, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> inferior_ptid = pid_to_ptid (pid);
> push_target (ttrace_ops_hack);
> @@ -640,7 +640,7 @@ inf_ttrace_detach (char *args, int from_
> /* ??? The HP-UX 11.0 ttrace(2) manual page doesn't mention that we
> can pass a signal number here. Does this really work? */
> if (ttrace (TT_PROC_DETACH, pid, 0, 0, sig, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> inf_ttrace_num_lwps = 0;
> inf_ttrace_num_lwps_in_syscall = 0;
> @@ -658,7 +658,7 @@ inf_ttrace_resume_callback (struct threa
> lwpid_t lwpid = ptid_get_lwp (info->ptid);
>
> if (ttrace (TT_LWP_CONTINUE, pid, lwpid, TT_NOPC, 0, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
> }
>
> return 0;
> @@ -679,7 +679,7 @@ inf_ttrace_resume (ptid_t ptid, int step
> }
>
> if (ttrace (request, pid, lwpid, TT_NOPC, sig, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> if (ptid_equal (ptid, minus_one_ptid) && inf_ttrace_num_lwps > 0)
> {
> @@ -821,7 +821,7 @@ inf_ttrace_wait (ptid_t ptid, struct tar
>
> /* Make sure all threads within the process are stopped. */
> if (ttrace (TT_PROC_STOP, tts.tts_pid, 0, 0, 0, 0) == -1)
> - perror_with_name ("ttrace");
> + perror_with_name (("ttrace"));
>
> /* HACK: Twiddle INFERIOR_PTID such that the initial thread of a
> process isn't recognized as a new thread. */

All of the above is wrong as well.

> Index: infptrace.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infptrace.c,v
> retrieving revision 1.51
> diff -p -u -r1.51 infptrace.c
> --- infptrace.c 11 Feb 2005 04:05:55 -0000 1.51
> +++ infptrace.c 11 Feb 2005 18:10:45 -0000
> @@ -144,7 +144,7 @@ child_resume (ptid_t ptid, int step, enu
> errno = 0;
> ptrace (request, pid, (PTRACE_TYPE_ARG3)1, target_signal_to_host (signal));
> if (errno != 0)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));
> }
> #endif /* DEPRECATED_CHILD_RESUME */
> \f
> @@ -158,7 +158,7 @@ attach (int pid)
> errno = 0;
> ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
> if (errno != 0)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));
> attach_flag = 1;
> return pid;
> #else
> @@ -178,7 +178,7 @@ detach (int signal)
> errno = 0;
> ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, signal);
> if (errno != 0)
> - perror_with_name ("ptrace");
> + perror_with_name (("ptrace"));

And these also.

> @@ -186,7 +186,7 @@ interp_set (struct interp *interp)
> {
> if (old_interp == NULL || !interp_set (old_interp))
> internal_error (__FILE__, __LINE__,
> - "Failed to initialize new interp \"%s\" %s",
> + _("Failed to initialize new interp \"%s\" %s"),
> interp->name, "and could not restore old interp!\n");
> return 0;

First, I suggest to replace "interp" with "interpreter" here. And
second, the "and could not restore old interp!\n" part should be
translated as well.

> @@ -988,7 +988,7 @@ add_language (const struct language_defn
> {
> fprintf_unfiltered (gdb_stderr, "Magic number of %s language struct wrong\n",
> lang->la_name);
> - internal_error (__FILE__, __LINE__, "failed internal consistency check");
> + internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
> }

The string in fprintf_unfiltered should be marked up for translation.

> @@ -193,14 +193,14 @@ linux_test_for_tracefork (int original_p
>
> child_pid = fork ();
> if (child_pid == -1)
> - perror_with_name ("linux_test_for_tracefork: fork");
> + perror_with_name (("fork"));

Bad parens.

> - perror_with_name ("linux_test_for_tracefork: waitpid");
> + perror_with_name (("waitpid"));

Bad parens.

> @@ -125,7 +125,7 @@ m68k_register_name (int regnum)
> if (regnum < 0 ||
> regnum >= sizeof (register_names) / sizeof (register_names[0]))
> internal_error (__FILE__, __LINE__,
> - "m68k_register_name: illegal register number %d", regnum);
> + _("m68k_register_name: illegal register number %d"), regnum);

"illegal" should be replaced with "invalid".

> @@ -4282,7 +4282,7 @@ cross_ref (int fd, union aux_ext *ax, st
> &tir);
> if (tir.tq0 != tqNil)
> complaint (&symfile_complaints,
> - "illegal tq0 in forward typedef for %s", sym_name);
> + _("illegal tq0 in forward typedef for %s"), sym_name);
> switch (tir.bt)
> {
> case btVoid:
> @@ -4320,7 +4320,7 @@ cross_ref (int fd, union aux_ext *ax, st
>
> default:
> complaint (&symfile_complaints,
> - "illegal bt %d in forward typedef for %s", tir.bt,
> + _("illegal bt %d in forward typedef for %s"), tir.bt,
> sym_name);
> *tpp = init_type (type_code, 0, 0, (char *) NULL,
> current_objfile);

Same here.

> @@ -140,7 +140,7 @@ mem_command (char *args, int from_tty)
> struct mem_attrib attrib;
>
> if (!args)
> - error_no_arg ("No mem");
> + error_no_arg (_("No mem"));

Suggest to change the cryptic "No mem" to "No memory".

> @@ -252,9 +252,9 @@ gdbarch_lookup_osabi (bfd *abfd)
> {
> internal_error
> (__FILE__, __LINE__,
> - "gdbarch_lookup_osabi: multiple %sspecific OS ABI "
> + _("gdbarch_lookup_osabi: multiple %sspecific OS ABI "
> "match for architecture %s flavour %d: first "
> - "match \"%s\", second match \"%s\"",
> + "match \"%s\", second match \"%s\""),
> match_specific ? "" : "non-",
> bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
> (int) bfd_get_flavour (abfd),

This should be refactored so as not to use the (untranslated and
untranslatable) "non-" prefix.

> @@ -302,7 +302,7 @@ or target st2000 <host> <port>\n"));
> #if defined (LOG_FILE)
> log_file = fopen (LOG_FILE, "w");
> if (log_file == NULL)
> - perror_with_name (LOG_FILE);
> + perror_with_name ((LOG_FILE));
> #endif
>
> /* Hello? Are you there? */
> @@ -710,13 +710,13 @@ connect_command (char *args, int fromtty
> while (numfds == 0);
>
> if (numfds < 0)
> - perror_with_name ("select");
> + perror_with_name (("select"));
>
> if (FD_ISSET (0, &readfds))
> { /* tty input, send to stdebug */
> c = getchar ();
> if (c < 0)
> - perror_with_name ("connect");
> + perror_with_name (("connect"));

Several cases of bogus extra parens.

> @@ -2751,7 +2751,7 @@ read_one_struct_field (struct field_info
> it is a field which has been optimized out. The correct stab for
> this case is to use VISIBILITY_IGNORE, but that is a recent
> invention. (2) It is a 0-size array. For example
> - union { int num; char str[0]; } foo. Printing "<no value>" for
> + union { int num; char str[0]; } foo. Printing _("<no value>" for

This hunk is bogus: the text is inside a comment.

> --- cli/cli-logging.c 11 Feb 2005 04:06:10 -0000 1.6
> +++ cli/cli-logging.c 11 Feb 2005 18:10:50 -0000
> @@ -74,14 +74,14 @@ handle_redirections (int from_tty)
>
> output = gdb_fopen (logging_filename, logging_overwrite ? "w" : "a");
> if (output == NULL)
> - perror_with_name ("set logging");
> + perror_with_name (_("set logging"));
>
> /* Redirects everything to gdb_stdout while this is running. */
> if (!logging_redirect)
> {
> output = tee_file_new (gdb_stdout, 0, output, 1);
> if (output == NULL)
> - perror_with_name ("set logging");
> + perror_with_name (_("set logging"));
> if (from_tty)
> fprintf_unfiltered (gdb_stdout, "Copying output to %s.\n",
> logging_filename);

Doesn't "set logging" here cite the name of a GDB command? If so, it
should be left untranslated.

Also, the "Copying output to %s.\n" part should be marked up for
translation.

> @@ -156,7 +156,7 @@ do_setshow_command (char *arg, int from_
> break;
> case var_filename:
> if (arg == NULL)
> - error_no_arg ("filename to set it to.");
> + error_no_arg (_("filename to set it to."));

The message text could use some work to make it more self-explanatory.

> case var_uinteger:
> if (arg == NULL)
> - error_no_arg ("integer to set it to.");
> + error_no_arg (_("integer to set it to."));

Same here.

> @@ -178,7 +178,7 @@ do_setshow_command (char *arg, int from_
> {
> unsigned int val;
> if (arg == NULL)
> - error_no_arg ("integer to set it to.");
> + error_no_arg (_("integer to set it to."));

And here.

> case var_zinteger:
> if (arg == NULL)
> - error_no_arg ("integer to set it to.");
> + error_no_arg (_("integer to set it to."));

And here.

> @@ -758,10 +758,10 @@ gdb_wait_for_event (void)
> /* Don't print anything if we get out of poll because of a
> signal. */
> if (num_found == -1 && errno != EINTR)
> - perror_with_name ("Poll");
> + perror_with_name (("poll"));

Bogus extra parens.