* [PATCH] gdb: Move definitions of std::string overloads in ui_out to the header
@ 2021-05-19 13:40 Marco Barisione
2021-05-19 14:30 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: Marco Barisione @ 2021-05-19 13:40 UTC (permalink / raw)
To: gdb-patches
gdb/ChangeLog:
* ui-out.c (ui_out::field_string): Move to ui-out.h.
(ui_out::text): Ditto.
* ui-out.h (class ui_out): Add definitions of
ui_out::field_string and ui_out::text which were previously
defined in ui-out.c.
---
gdb/ui-out.c | 13 -------------
gdb/ui-out.h | 7 +++++--
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index c091af6cad3..982d157a932 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -527,13 +527,6 @@ ui_out::field_string (const char *fldname, const char *string,
do_field_string (fldno, width, align, fldname, string, style);
}
-void
-ui_out::field_string (const char *fldname, const std::string &string,
- const ui_file_style &style)
-{
- field_string (fldname, string.c_str (), style);
-}
-
/* VARARGS */
void
ui_out::field_fmt (const char *fldname, const char *format, ...)
@@ -582,12 +575,6 @@ ui_out::text (const char *string)
do_text (string);
}
-void
-ui_out::text (const std::string &string)
-{
- text (string.c_str ());
-}
-
void
ui_out::call_do_message (const ui_file_style &style, const char *format,
...)
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 46dfe28c1e1..ecf62e8b601 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -192,7 +192,10 @@ class ui_out
void field_string (const char *fldname, const char *string,
const ui_file_style &style = ui_file_style ());
void field_string (const char *fldname, const std::string &string,
- const ui_file_style &style = ui_file_style ());
+ const ui_file_style &style = ui_file_style ())
+ {
+ field_string (fldname, string.c_str (), style);
+ }
void field_stream (const char *fldname, string_file &stream,
const ui_file_style &style = ui_file_style ());
void field_skip (const char *fldname);
@@ -204,7 +207,7 @@ class ui_out
void spaces (int numspaces);
void text (const char *string);
- void text (const std::string &string);
+ void text (const std::string &string) { text (string.c_str ()); }
/* Output a printf-style formatted string. In addition to the usual
printf format specs, this supports a few GDB-specific
--
2.28.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: Move definitions of std::string overloads in ui_out to the header
2021-05-19 13:40 [PATCH] gdb: Move definitions of std::string overloads in ui_out to the header Marco Barisione
@ 2021-05-19 14:30 ` Simon Marchi
2021-05-19 15:53 ` Marco Barisione
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2021-05-19 14:30 UTC (permalink / raw)
To: Marco Barisione, gdb-patches
On 2021-05-19 9:40 a.m., Marco Barisione via Gdb-patches wrote:
> gdb/ChangeLog:
>
> * ui-out.c (ui_out::field_string): Move to ui-out.h.
> (ui_out::text): Ditto.
> * ui-out.h (class ui_out): Add definitions of
> ui_out::field_string and ui_out::text which were previously
> defined in ui-out.c.
This is ok, but please add a commit message explaining the intent (the
why) of this commit. In this case, it's so that the compiler has a
chance to inline these calls, which are just trivial wrappers around the
other methods of the same name.
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: Move definitions of std::string overloads in ui_out to the header
2021-05-19 14:30 ` Simon Marchi
@ 2021-05-19 15:53 ` Marco Barisione
0 siblings, 0 replies; 3+ messages in thread
From: Marco Barisione @ 2021-05-19 15:53 UTC (permalink / raw)
To: Simon Marchi; +Cc: GDB patches mailing list
On 19 May 2021, at 15:30, Simon Marchi <simon.marchi@polymtl.ca> wrote:
>
> On 2021-05-19 9:40 a.m., Marco Barisione via Gdb-patches wrote:
>> gdb/ChangeLog:
>>
>> * ui-out.c (ui_out::field_string): Move to ui-out.h.
>> (ui_out::text): Ditto.
>> * ui-out.h (class ui_out): Add definitions of
>> ui_out::field_string and ui_out::text which were previously
>> defined in ui-out.c.
>
> This is ok, but please add a commit message explaining the intent (the
> why) of this commit. In this case, it's so that the compiler has a
> chance to inline these calls, which are just trivial wrappers around the
> other methods of the same name.
Done, thank you!
--
Marco Barisione
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-19 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 13:40 [PATCH] gdb: Move definitions of std::string overloads in ui_out to the header Marco Barisione
2021-05-19 14:30 ` Simon Marchi
2021-05-19 15:53 ` Marco Barisione
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).