From: Pedro Alves <pedro@palves.net>
To: Keith Seitz <keiths@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] Always pass an explicit language down to c_type_print
Date: Fri, 6 May 2022 13:33:47 +0100 [thread overview]
Message-ID: <439b8ed0-076a-9ffe-777d-677650f5ec5e@palves.net> (raw)
In-Reply-To: <e63c839c-3f9e-c056-928e-e02a84751114@redhat.com>
On 2022-05-05 21:47, Keith Seitz wrote:
> On 5/5/22 11:50, Pedro Alves wrote:
>> diff --git a/gdb/c-lang.h b/gdb/c-lang.h
>> index 46e562df055..c81c3bbc3b8 100644
>> --- a/gdb/c-lang.h
>> +++ b/gdb/c-lang.h
>> @@ -65,16 +65,17 @@ extern int c_parse (struct parser_state *);
>> extern int c_parse_escape (const char **, struct obstack *);
>> /* Defined in c-typeprint.c */
>> -extern void c_print_type (struct type *, const char *,
>> - struct ui_file *, int, int,
>> - const struct type_print_options *);
>> -/* Print a type but allow the precise language to be specified. */
>> +/* LEVEL is the depth to indent lines by. Allows the precise language
>> + to be specified, because many languages defer to C type
>> + printing. */
>
> The actual description of the function (if brief) has been removed. The new
> comment explains the LEVEL argument, but the decl only contains types. A
> casual reader (like myself) would have to go figure out to which argument this
> refers.
>
> I have to ask: Is this what you intended? It seems like a cut-n-paste
> error?
Yeah, I had just blindly moved the comment from the .c file to the .h file:
-/* LEVEL is the depth to indent lines by. */
-
-void
-c_print_type (struct type *type,
- const char *varstring,
If it was good there, it must still be good in the .h file! :-) 1/2 kidding.
The "Print a type but allow the precise language to be specified."
comment was saying that that overload was the same as the one without
the language, except it takes a language. I dropped that one, and didn't
even realize that the comment in the other overload didn't refer to
type printing.
I've changed this now to look like this:
--- c/gdb/c-lang.h
+++ w/gdb/c-lang.h
@@ -65,16 +65,17 @@ extern int c_parse (struct parser_state *);
extern int c_parse_escape (const char **, struct obstack *);
/* Defined in c-typeprint.c */
-extern void c_print_type (struct type *, const char *,
- struct ui_file *, int, int,
- const struct type_print_options *);
-/* Print a type but allow the precise language to be specified. */
+/* Print TYPE to STREAM using syntax appropriate for LANGUAGE, a
+ C-like language. The other parameters are like
+ type_language_defn::print_type's. */
-extern void c_print_type (struct type *, const char *,
- struct ui_file *, int, int,
- enum language,
- const struct type_print_options *);
+extern void c_print_type (struct type *type,
+ const char *varstring,
+ struct ui_file *stream,
+ int show, int level,
+ enum language language,
+ const struct type_print_options *flags);
extern void c_print_typedef (struct type *,
struct symbol *,
next prev parent reply other threads:[~2022-05-06 12:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 18:50 [PATCH 0/3] Fix "b func(std::string)", DMGL_VERBOSE, gdb.cp/no-dmgl-verbose.exp Pedro Alves
2022-05-05 18:50 ` [PATCH 1/3] Fix "b f(std::string)", always use DMGL_VERBOSE Pedro Alves
2022-05-05 20:31 ` Keith Seitz via Gdb-patches
2022-05-05 21:49 ` Carl Love via Gdb-patches
2022-05-06 13:21 ` Pedro Alves
2022-05-06 8:10 ` Lancelot SIX via Gdb-patches
2022-05-06 13:09 ` Pedro Alves
2022-05-05 18:50 ` [PATCH 2/3] Always pass an explicit language down to c_type_print Pedro Alves
2022-05-05 20:47 ` Keith Seitz via Gdb-patches
2022-05-06 12:33 ` Pedro Alves [this message]
2022-05-05 18:50 ` [PATCH 3/3] Fix "b f(std::string)" when current language is C Pedro Alves
2022-05-05 20:50 ` Keith Seitz via Gdb-patches
2022-05-06 8:34 ` Lancelot SIX via Gdb-patches
2022-05-06 13:09 ` Pedro Alves
2022-05-09 16:54 ` [PATCH 0/3] Fix "b func(std::string)", DMGL_VERBOSE, gdb.cp/no-dmgl-verbose.exp Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=439b8ed0-076a-9ffe-777d-677650f5ec5e@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox