From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C793C385416E for ; Thu, 29 Sep 2022 17:52:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C793C385416E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-167-xk0Hqgd8NwWa-lSsL4pr5w-1; Thu, 29 Sep 2022 13:52:07 -0400 X-MC-Unique: xk0Hqgd8NwWa-lSsL4pr5w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63BFD86E926; Thu, 29 Sep 2022 17:52:07 +0000 (UTC) Received: from [10.2.17.232] (unknown [10.2.17.232]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2048E140EBF3; Thu, 29 Sep 2022 17:52:07 +0000 (UTC) Message-ID: <9992b2dc-60f4-539a-1727-1dc9546b2bc2@redhat.com> Date: Thu, 29 Sep 2022 10:52:06 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 From: Keith Seitz Subject: Re: [PATCH][gdb/c++] Print destructor the same for gcc and clang To: Tom de Vries , gdb-patches@sourceware.org References: <20220927103546.GA27362@delia.home> In-Reply-To: <20220927103546.GA27362@delia.home> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 29 Sep 2022 17:52:11 -0000 On 9/27/22 03:35, Tom de Vries wrote: > > Fix this by rewriting the code to: > - always enter the loop > - handle whether arguments need printing in the loop > - keep track of how many arguments are printed, and > use that after the loop to print void etc. > such that we have the same for both gcc and clang: > ... > A(void); > ~A(void); > ... > > Note that I consider the discussion of whether we want to print: > - A(void) / ~A(void), or > - A() / ~A() > out-of-scope for this patch. > > Tested on x86_64-linux. > > Any comments? This all looks okay; thank you for that cleanup. Consistency is welcome. On the [off-]topic of "void" vs ""... The standard (IIUC) permits the use of "void" in destructors. If I create a class with a private dtor, e.g., to elicit a compilation failure, clang++ never outputs the symbol name. GCC, on the other hand, does, and it outputs "" (no "void", even if I explicitly use "void" in the dtor). While I would prefer "", I don't have a compelling argument either way. [It's trivial to implement with your patch.] I recommend you approve your patch. :-) Keith