* [PATCH] Move declaration of lang_frame_mismatch_warn to header.
@ 2019-10-07 17:57 Christian Biesinger via gdb-patches
2019-10-07 22:20 ` Tom Tromey
0 siblings, 1 reply; 7+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-10-07 17:57 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
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(-)
diff --git a/gdb/language.c b/gdb/language.c
index e95084f1154..2bebc05a1f3 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -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.";
\f
/* This page contains the functions corresponding to GDB commands
diff --git a/gdb/language.h b/gdb/language.h
index 0088e5de2dd..aa19f8ee9b4 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -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)
diff --git a/gdb/top.c b/gdb/top.c
index a1a08e0b99e..0c1a213e9d5 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -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. */
--
2.23.0.581.g78d2f28ef7-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move declaration of lang_frame_mismatch_warn to header.
2019-10-07 17:57 [PATCH] Move declaration of lang_frame_mismatch_warn to header Christian Biesinger via gdb-patches
@ 2019-10-07 22:20 ` Tom Tromey
2019-10-07 22:27 ` Christian Biesinger via gdb-patches
0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2019-10-07 22:20 UTC (permalink / raw)
To: Christian Biesinger via gdb-patches; +Cc: Christian Biesinger
>>>>> "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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move declaration of lang_frame_mismatch_warn to header.
2019-10-07 22:20 ` Tom Tromey
@ 2019-10-07 22:27 ` Christian Biesinger via gdb-patches
2019-10-07 22:28 ` Christian Biesinger via gdb-patches
2019-10-08 12:46 ` Tom Tromey
0 siblings, 2 replies; 7+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-10-07 22:27 UTC (permalink / raw)
To: Tom Tromey; +Cc: Christian Biesinger via gdb-patches
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Move declaration of lang_frame_mismatch_warn to header.
2019-10-07 22:27 ` Christian Biesinger via gdb-patches
@ 2019-10-07 22:28 ` Christian Biesinger via gdb-patches
2019-10-08 12:46 ` Tom Tromey
2019-10-08 12:46 ` Tom Tromey
1 sibling, 1 reply; 7+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-10-07 22:28 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
Also makes it localizable.
gdb/ChangeLog:
2019-10-07 Christian Biesinger <cbiesinger@google.com>
* language.c (show_language_command): Pass lang_frame_mismatch_warn
through _().
(lang_frame_mismatch_warn): Make const, mark with N_(), and
move comment...
* language.h (lang_frame_mismatch_warn): ... here. Also add
declaration.
* top.c (lang_frame_mismatch_warn): Remove declaration.
(check_frame_language_change): Pass lang_frame_mismatch_warn
through _().
---
gdb/language.c | 9 ++++-----
gdb/language.h | 5 +++++
gdb/top.c | 4 +---
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/gdb/language.c b/gdb/language.c
index e95084f115..02c448fb1d 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -112,10 +112,9 @@ 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[] =
-"Warning: the current language does not match this frame.";
+/* See language.h. */
+const char lang_frame_mismatch_warn[] =
+N_("Warning: the current language does not match this frame.");
\f
/* This page contains the functions corresponding to GDB commands
and their helpers. */
@@ -147,7 +146,7 @@ show_language_command (struct ui_file *file, int from_tty,
if (flang != language_unknown
&& language_mode == language_mode_manual
&& current_language->la_language != flang)
- printf_filtered ("%s\n", lang_frame_mismatch_warn);
+ printf_filtered ("%s\n", _(lang_frame_mismatch_warn));
}
}
diff --git a/gdb/language.h b/gdb/language.h
index 0088e5de2d..aa19f8ee9b 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -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)
diff --git a/gdb/top.c b/gdb/top.c
index a1a08e0b99..78355a0315 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -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. */
@@ -492,7 +490,7 @@ check_frame_language_change (void)
&& flang != language_unknown
&& flang != current_language->la_language)
{
- printf_filtered ("%s\n", lang_frame_mismatch_warn);
+ printf_filtered ("%s\n", _(lang_frame_mismatch_warn));
warned = 1;
}
}
--
2.23.0.581.g78d2f28ef7-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move declaration of lang_frame_mismatch_warn to header.
2019-10-07 22:28 ` Christian Biesinger via gdb-patches
@ 2019-10-08 12:46 ` Tom Tromey
2019-10-08 15:16 ` Christian Biesinger via gdb-patches
0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2019-10-08 12:46 UTC (permalink / raw)
To: Christian Biesinger via gdb-patches; +Cc: Christian Biesinger
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
Christian> Also makes it localizable.
Christian> gdb/ChangeLog:
Christian> 2019-10-07 Christian Biesinger <cbiesinger@google.com>
Christian> * language.c (show_language_command): Pass lang_frame_mismatch_warn
Christian> through _().
Christian> (lang_frame_mismatch_warn): Make const, mark with N_(), and
Christian> move comment...
Christian> * language.h (lang_frame_mismatch_warn): ... here. Also add
Christian> declaration.
Christian> * top.c (lang_frame_mismatch_warn): Remove declaration.
Christian> (check_frame_language_change): Pass lang_frame_mismatch_warn
Christian> through _().
Thanks, this is ok.
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move declaration of lang_frame_mismatch_warn to header.
2019-10-07 22:27 ` Christian Biesinger via gdb-patches
2019-10-07 22:28 ` Christian Biesinger via gdb-patches
@ 2019-10-08 12:46 ` Tom Tromey
1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2019-10-08 12:46 UTC (permalink / raw)
To: Christian Biesinger via gdb-patches; +Cc: Tom Tromey, Christian Biesinger
>>>>> "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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move declaration of lang_frame_mismatch_warn to header.
2019-10-08 12:46 ` Tom Tromey
@ 2019-10-08 15:16 ` Christian Biesinger via gdb-patches
0 siblings, 0 replies; 7+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-10-08 15:16 UTC (permalink / raw)
To: Tom Tromey; +Cc: Christian Biesinger via gdb-patches
On Tue, Oct 8, 2019 at 7:46 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> Also makes it localizable.
> Christian> gdb/ChangeLog:
>
> Christian> 2019-10-07 Christian Biesinger <cbiesinger@google.com>
>
> Christian> * language.c (show_language_command): Pass lang_frame_mismatch_warn
> Christian> through _().
> Christian> (lang_frame_mismatch_warn): Make const, mark with N_(), and
> Christian> move comment...
> Christian> * language.h (lang_frame_mismatch_warn): ... here. Also add
> Christian> declaration.
> Christian> * top.c (lang_frame_mismatch_warn): Remove declaration.
> Christian> (check_frame_language_change): Pass lang_frame_mismatch_warn
> Christian> through _().
>
> Thanks, this is ok.
Thanks, pushed.
To ssh://sourceware.org/git/binutils-gdb.git
b7d9d3ee59..34916edc47 HEAD -> master
Christian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-08 15:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 17:57 [PATCH] Move declaration of lang_frame_mismatch_warn to header Christian Biesinger via gdb-patches
2019-10-07 22:20 ` Tom Tromey
2019-10-07 22:27 ` Christian Biesinger via gdb-patches
2019-10-07 22:28 ` Christian Biesinger via gdb-patches
2019-10-08 12:46 ` Tom Tromey
2019-10-08 15:16 ` Christian Biesinger via gdb-patches
2019-10-08 12:46 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox