Move declaration of lang_frame_mismatch_warn to header.
Commit Message
gdb/ChangeLog:
2019-10-07 Christian Biesinger <cbiesinger@google.com>
* language.c (lang_frame_mismatch_warn): Make const and move
comment...
* language.h (lang_frame_mismatch_warn): ... here. Also add
declaration.
* top.c (lang_frame_mismatch_warn): Remove declaration.
---
gdb/language.c | 5 ++---
gdb/language.h | 5 +++++
gdb/top.c | 2 --
3 files changed, 7 insertions(+), 5 deletions(-)
Comments
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
Christian> gdb/ChangeLog:
Christian> 2019-10-07 Christian Biesinger <cbiesinger@google.com>
Christian> * language.c (lang_frame_mismatch_warn): Make const and move
Christian> comment...
Christian> * language.h (lang_frame_mismatch_warn): ... here. Also add
Christian> declaration.
Christian> * top.c (lang_frame_mismatch_warn): Remove declaration.
Thanks.
Maybe it would be better to just have a function to print this message.
That would make it easier to gettext-ize.
It can be done as-is though by changing it to a const char *, then
wrapping the literal in N_(...), and changing the uses to _(...).
Tom
On Mon, Oct 7, 2019 at 5:19 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> gdb/ChangeLog:
> Christian> 2019-10-07 Christian Biesinger <cbiesinger@google.com>
>
> Christian> * language.c (lang_frame_mismatch_warn): Make const and move
> Christian> comment...
> Christian> * language.h (lang_frame_mismatch_warn): ... here. Also add
> Christian> declaration.
> Christian> * top.c (lang_frame_mismatch_warn): Remove declaration.
>
> Thanks.
>
> Maybe it would be better to just have a function to print this message.
> That would make it easier to gettext-ize.
>
> It can be done as-is though by changing it to a const char *, then
> wrapping the literal in N_(...), and changing the uses to _(...).
Thanks. It seems to work for me even without changing to const char*,
so I'll send a patch momentarily which does that.
Christian
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>> It can be done as-is though by changing it to a const char *, then
>> wrapping the literal in N_(...), and changing the uses to _(...).
Christian> Thanks. It seems to work for me even without changing to const char*,
Christian> so I'll send a patch momentarily which does that.
Oh yeah, duh. N_ is just a marker for xgettext, and doesn't actually do
anything.
Tom
@@ -112,9 +112,8 @@ static const char *language;
static const char *range;
static const char *case_sensitive;
-/* Warning issued when current_language and the language of the current
- frame do not match. */
-char lang_frame_mismatch_warn[] =
+/* See language.h. */
+const char lang_frame_mismatch_warn[] =
"Warning: the current language does not match this frame.";
/* This page contains the functions corresponding to GDB commands
@@ -483,6 +483,11 @@ extern const struct language_defn *current_language;
extern const struct language_defn *expected_language;
+/* Warning issued when current_language and the language of the current
+ frame do not match. */
+
+extern const char lang_frame_mismatch_warn[];
+
/* language_mode ==
language_mode_auto: current_language automatically set upon selection
of scope (e.g. stack frame)
@@ -110,8 +110,6 @@ gen_ret_current_ui_field_ptr (struct ui_out *, current_uiout)
int inhibit_gdbinit = 0;
-extern char lang_frame_mismatch_warn[]; /* language.c */
-
/* Flag for whether we want to confirm potentially dangerous
operations. Default is yes. */