From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70579 invoked by alias); 31 May 2018 01:12:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 70558 invoked by uid 89); 31 May 2018 01:12:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 May 2018 01:12:40 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4DFF1560BA; Wed, 30 May 2018 21:12:39 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1KIoJy5bG2BY; Wed, 30 May 2018 21:12:39 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 18C05560B9; Wed, 30 May 2018 21:12:39 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2D97C83056; Wed, 30 May 2018 18:12:37 -0700 (PDT) Date: Thu, 31 May 2018 01:37:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA 2/4] Thread language through c_type_print_args Message-ID: <20180531011237.jqg2gyifcr5gtmhd@adacore.com> References: <20180417195125.14200-1-tom@tromey.com> <20180417195125.14200-3-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180417195125.14200-3-tom@tromey.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2018-05/txt/msg00832.txt.bz2 > 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 > > * 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