Re: [PATCH] MI error messages

Eli Zaretskii
2005-06-21T03:40:45Z

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Tue, 21 Jun 2005 09:42:10 +1200
> Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sources.redhat.com
>
> > I like this idea; in fact, this is the style I was going to recommend
> > to you (until I went through and noticed that it is only used for
> > functions with arguments, not without, at the moment).
>
> Here's a patch for mi-cmd-stack.c and mi-cmd-var.c to start with. Only the
> word "Usage" should be translated so e.g
>
> error (_("Usage: -stack-list-locals PRINT_VALUES"));
>
> should be something like:
>
> error (_("Usage")(": -stack-list-locals PRINT_VALUES"));
>
> but I don't what the correct way to do this is.

Andreas suggested one way to do this. But I think it would be better
to add a function called, say, mi_error, that would do

error (_("Usage: %s."), msg);

where `msg' is a char * string passed as its argument, and then
replace each call to `error' with a call to `mi_error', like so:

mi_error ("-stack-list-locals PRINT_VALUES");

The advantage of this is that "Usage: %s" is not repeated dozens of
times in the message catalog and in the program.

> Also, in mi-cmd-stack.c, I've given get_selected_frame the message string
> "No stack." but presumably this also gets translated so should it be:
>
> get_selected_frame (_("No stack.")) ?

Yes.

> Some error messages are terminated with a period, others aren't. I don't
> know which style is preferred but clearly it would be best to just use
> one.

They should all end with a period, I think.