[PATCH 2/3] Always pass an explicit language down to c_type_print
Keith Seitz
keiths@redhat.com
Thu May 5 20:47:48 GMT 2022
On 5/5/22 11:50, Pedro Alves wrote:
> In gnuv3_print_method_ptr, I wasn't sure whether we could hardcode C++
> here, and we don't have an enum language handy, so I made it use the
> current language, just like today. Can always be improved later.
I like this philosophy. :-)
I just have one comment for you to double-check. Otherwise, I also
encourage you to approve your patch.
Keith
> Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b
> ---
> gdb/ada-typeprint.c | 2 +-
> gdb/c-exp.y | 1 +
> gdb/c-lang.c | 8 ++++----
> gdb/c-lang.h | 17 +++++++++--------
> gdb/c-typeprint.c | 25 +++++--------------------
> gdb/d-lang.c | 2 +-
> gdb/gnu-v3-abi.c | 3 ++-
> gdb/go-typeprint.c | 2 +-
> gdb/objc-lang.c | 2 +-
> gdb/opencl-lang.c | 2 +-
> gdb/rust-lang.c | 5 +++--
> 11 files changed, 29 insertions(+), 40 deletions(-)
>
> 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?
> -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 *,
More information about the Gdb-patches
mailing list