From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.149.101]) by sourceware.org (Postfix) with ESMTPS id 585BA388CC10 for ; Tue, 11 May 2021 20:40:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 585BA388CC10 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway34.websitewelcome.com (Postfix) with ESMTP id BE82C1286FC for ; Tue, 11 May 2021 15:40:26 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id gZB4lvPBdPkftgZB4luNUP; Tue, 11 May 2021 15:40:26 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NAMAf7QPcDhddljqWqgaJ07GPyuZPR1ZNwzt2Fr0J9w=; b=Mmwz8tyz6hczkSMP6uRLkYOZi3 kilyRpXC7I4RuL7WEO4SRfYUYovxrChZwdJrOjySnXK5p2kCu3RcpV/rBwx4OlO8HbXTKbmVVHHfN r0/niBzxA3fTSZOIG8hDInaq/; Received: from 75-166-134-27.hlrn.qwest.net ([75.166.134.27]:44152 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lgZB4-002xmE-B7; Tue, 11 May 2021 14:40:26 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , Simon Marchi via Gdb-patches Subject: Re: Using clang-format References: <87lf8p9pwg.fsf@tromey.com> <9e485731-875c-98e2-1894-6b1a45efa5c5@polymtl.ca> X-Attribution: Tom Date: Tue, 11 May 2021 14:40:25 -0600 In-Reply-To: <9e485731-875c-98e2-1894-6b1a45efa5c5@polymtl.ca> (Simon Marchi's message of "Mon, 10 May 2021 22:57:12 -0400") Message-ID: <8735ut6m2u.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.134.27 X-Source-L: No X-Exim-ID: 1lgZB4-002xmE-B7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-134-27.hlrn.qwest.net (murgatroyd) [75.166.134.27]:44152 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3026.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 11 May 2021 20:40:30 -0000 >> gcc_type >> compile_cplus_instance::convert_reference_base ( >> gcc_type base, enum gcc_cp_ref_qualifiers rquals) >> >> But really, I don't think these should be blockers. It would take >> someone some really bad faith to say that the above changes how they >> read the code. I don't agree, mainly because I dislike that style, and I feel like I'm generally above-board. This weird dangling paren was an issue for calls, previously, though, and I fixed it by tweaking one of the penalty settings. So maybe that can be salvaged. >> I have only seen this when we make clang-format's life difficult by >> using long names or long string literals. If we don't like how it >> formats some piece of code, we always have the choice of tweaking it to >> make its like easier. Yeah. Also it's not like the current code is pristine. >> I'm surprised you didn't use "UseTab: Always" I routinely forget whether gdb uses tabs or not and rely on Emacs to DTRT. >> I would use "IndentPPDirectives: AfterHash". Unlike what we use >> currently, it will indent with $IndentWidth columns, whereas we >> typically we indent these with a single column when we do it manually. >> But, I think I prefer 2 columns actually. You can try formatting >> gdbsupport/gdb_locale.h for a good example. My impression was that normally gdb didn't do this kind of indentation, but in this particular case, I don't really have any opinion and I'm happy with whatever setting everyone else enjoys. >> Speaking of which, in order to be usable from gdbsupport and gdbserver, >> .clang-format would need to be in the top-level directory. Or maybe it >> could be in gdbsupport, and gdb/gdbserver symlink to it. Yeah, I was wondering about this as well. I don't think we should put it at top-level, though, as people may think it applies to the whole tree, which it wouldn't. >> btrace_block (CORE_ADDR begin, CORE_ADDR end) : begin (begin), end (end) >> { >> /* Nothing. */ >> } >> >> The initializer list is put on the same line as the constructor's >> prototype. If there's a way to tell it that we don't want that, it >> would be closer to our style. I think clang-format doesn't offer this level of control here. >> For AlignEscapedNewlines, I'd probably choose Right or DontAlign. The >> reason being that if you modify the longest line of a macro (make that >> line longer or shorter), all the macros line will change as a result. >> So it will be harder to spot what changed when reading the hunk in the >> diff. I have a slight preference for Right, Sounds good. >>> 1. It removes all the Control-L page breaks from the source. >>> I know these often confuse newcomers, so maybe it's fine. >>> I feel that Someone out there will cheer this :) >> >> Who dat? I thought Pedro was in the anti-control-L camp? Anyway, no biggie, I like them but I probably won't notice their absence. >>> Another possible problem is that, unlike with 'black', ensuring that >>> everyone has the same version is a pain. >> With the Python code, we did a massive re-format. I don't think it did >> / will cause a big inconvenience, because there aren't many patches to >> the Python code. But for the C++ code, it might be different, as there >> are more patches in everyone's pipeline that touch that code. If our reformatting commit is purely automated, we can write a short script using git filter-branch so that anybody with a patch to rebase can first rebase to the commit just before the reformat, then run the script to rebase-and-reformat. This would ease the pain somewhat. >> Another question is: would we re-format the C/C++ code in the testsuite? >> It might require a few adjustments to test cases (like there was one for >> black), but I would be fine with that. My concern is more if there are >> some tests where the formatting of the code was specifically important. >> We could disable formatting for them, but the difficulty is to find >> them. Personally I would say that we shouldn't touch the tests at all, and just not worry about the formatting there. That's been my usual review policy, as I think it's fine, and maybe even mildly beneficial in some theoretical way, for the tests to have a variety of styles. Also normally they are just throwaway code anyway. Tom