public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 2/4] Thread language through c_type_print_args
Date: Thu, 31 May 2018 01:37:00 -0000	[thread overview]
Message-ID: <20180531011237.jqg2gyifcr5gtmhd@adacore.com> (raw)
In-Reply-To: <20180417195125.14200-3-tom@tromey.com>

> Currently dwarf2read.c will pass the CU's language to
> c_type_print_args -- but this doesn't affect all aspects of type
> printing, because some code in c-typeprint.c refers to
> current_language.
> 
> This patch threads the language through more of the type printing
> code, adding an overload to c_type_print.  Some uses of
> current_language remain, but now they are only in top-level functions.
> 
> ChangeLog
> 2018-04-17  Tom Tromey  <tom@tromey.com>
> 
> 	* dwarf2read.c (dwarf2_compute_name): Pass CU's language to
> 	c_print_type.
> 	* c-typeprint.c (c_print_type_1): Add "language" parameter.
> 	(c_print_type): Update.
> 	(c_print_type): New overload.
> 	(c_type_print_varspec_prefix, c_type_print_args)
> 	(c_type_print_varspec_suffix, c_print_type_no_offsets)
> 	(c_type_print_base_struct_union, c_type_print_base_1)
> 	(cp_type_print_method_args): Add "language" parameter.
> 	(c_type_print_base): Update.
> 	* c-lang.h (c_print_type): Add new overload.

Neat use of overloading to avoid having to manage a potentially
large number of callers all at once...

You mentioned as a follow up that you were wondering about putting
the language in struct type_print_options. I can see why it is
an option, and I wouldn't object to it, but at the moment, the
approach with adding it as a parameter feels better. I think it's
more consistent with what we've been doing before. I could be
convinced otherwise.

In the meantime, this patch is approved.

-- 
Joel

  parent reply	other threads:[~2018-05-31  1:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 19:51 [RFA 0/4] Remove TYPE_TAG_NAME Tom Tromey
2018-04-17 19:51 ` [RFA 4/4] Remove type_name_no_tag and rename type_name_no_tag_or_error Tom Tromey
2018-05-31  6:22   ` Joel Brobecker
2018-04-17 19:51 ` [RFA 2/4] Thread language through c_type_print_args Tom Tromey
2018-04-18 17:53   ` Tom Tromey
2018-05-31  1:37   ` Joel Brobecker [this message]
2018-04-17 19:51 ` [RFA 3/4] Remove TYPE_TAG_NAME Tom Tromey
2018-04-18 16:57   ` Keith Seitz
2018-04-18 17:57     ` Tom Tromey
2018-04-18 18:06       ` Keith Seitz
2018-05-31  2:35   ` Joel Brobecker
2018-04-17 19:51 ` [RFA 1/4] Make c_type_print_varspec_suffix static Tom Tromey
2018-05-31  1:33   ` Joel Brobecker
2018-04-18 16:57 ` [RFA 0/4] Remove TYPE_TAG_NAME Keith Seitz
2018-05-09 15:42 ` Tom Tromey
2018-05-25 17:30   ` 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=20180531011237.jqg2gyifcr5gtmhd@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).