From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id xjSkG7sVdWJeqgQAWB0awg (envelope-from ) for ; Fri, 06 May 2022 08:34:03 -0400 Received: by simark.ca (Postfix, from userid 112) id 656B81E058; Fri, 6 May 2022 08:34:03 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8BE891E01D for ; Fri, 6 May 2022 08:34:02 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCB66395440D for ; Fri, 6 May 2022 12:34:01 +0000 (GMT) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by sourceware.org (Postfix) with ESMTPS id A50213952491 for ; Fri, 6 May 2022 12:33:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A50213952491 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id r1-20020a1c2b01000000b00394398c5d51so4297352wmr.2 for ; Fri, 06 May 2022 05:33:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=TIT8neBcRvs7raKbq28e2x0OZb4jNxMT+8IVB7EUv7M=; b=jZ+IIxqqoypvMfdZsprr9hgp4tp1sQaUtiIjvVxZo4phjlPRLVjE9Fu0XS6G6mBJH6 XHTpqBXu5gV/pwgaVq7zkM7nAgEfI55hy4vCy5kpKZnNqmOqAbDytluzlGep6tMnKKYM ngh98St58C1YBvOrGBFlSfoxTh/VnWiB2eP+R92H1OABPvp87xUi8zCt2n0FuS4R8viM 0AhBPriaawTG0vUIIBGvDVx+jiDAS1GIDVuX2tzskAR1tEMgn8WiQSmtQOiYwEJSFM6t PeE2aVxyMPLTQBkhgx+HM608oj9V6sjxhiar4XMkFSQWvIPKJG0LeDBDlZxE2XAxZHrS LLwQ== X-Gm-Message-State: AOAM532aVMyUkfdwGonZHXzEi5w/3FHxZy6iVW4AJaPtviUwwzh5wCWM O5x+5u52onSphC9aUw1ZI2uZowf+zBw= X-Google-Smtp-Source: ABdhPJyQran2XZgt7OW+0e8qU0Wlk8Sr2vGYN9HkdzM2ri74D7LUHC2tm9oZYdIZe1MNDFGtaVsusw== X-Received: by 2002:a05:600c:1c0e:b0:394:66af:ef0f with SMTP id j14-20020a05600c1c0e00b0039466afef0fmr8550088wms.48.1651840429587; Fri, 06 May 2022 05:33:49 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id m17-20020a7bcf31000000b003947e11c3ecsm797917wmg.17.2022.05.06.05.33.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 May 2022 05:33:48 -0700 (PDT) Message-ID: <439b8ed0-076a-9ffe-777d-677650f5ec5e@palves.net> Date: Fri, 6 May 2022 13:33:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 2/3] Always pass an explicit language down to c_type_print Content-Language: en-US To: Keith Seitz , gdb-patches@sourceware.org References: <20220505185020.3648774-1-pedro@palves.net> <20220505185020.3648774-3-pedro@palves.net> From: Pedro Alves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 *,