From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.49.219]) by sourceware.org (Postfix) with ESMTPS id D6399393A408 for ; Sat, 8 May 2021 16:00:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D6399393A408 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 cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 50B0880CE for ; Sat, 8 May 2021 11:00:32 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fPNYlXP7YMGeEfPNYleXfW; Sat, 08 May 2021 11:00:32 -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=voluEBDjHLBKsiNPXZBcpE6E//5KL8xOkhdB6KRTJSw=; b=YEA0KniksK+6b2YeePW8Np+Drc 7i96VPzzGWv/xBSW7rOeb6ogc1whFJgYHsPEVkL2b2yI3CAstqPmyxyQR8b0NZM3Ws0697qmo6OZq 4SZSxzWy3utTg3SGSIqLeKuyD; Received: from 97-122-70-176.hlrn.qwest.net ([97.122.70.176]:36532 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lfPNX-001txI-Vo; Sat, 08 May 2021 10:00:32 -0600 From: Tom Tromey To: Simon Marchi via Gdb-patches Subject: Re: Proposal: format GDB Python files with black References: X-Attribution: Tom Date: Sat, 08 May 2021 10:00:31 -0600 In-Reply-To: (Simon Marchi via Gdb-patches's message of "Mon, 26 Apr 2021 11:55:21 -0400") Message-ID: <87lf8p9pwg.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2.50 (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: 97.122.70.176 X-Source-L: No X-Exim-ID: 1lfPNX-001txI-Vo X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-70-176.hlrn.qwest.net (localhost.localdomain) [97.122.70.176]:36532 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3023.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A 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: Sat, 08 May 2021 16:00:36 -0000 >>>>> "Simon" == Simon Marchi via Gdb-patches writes: Simon> A few people I talked to about this and I have good experience Simon> with the tool black to auto-format Python code. Inspired by this, I took another look at clang-format. If we could use this, I think it would be a decent productivity improvement, because it would mean contributors would no longer need to worry about the minutiae of the GNU style. We could also stop reviewing this. My github has my current hacks, on the t/clang-format branch. This branch just has .clang-format, I didn't reformat the sources. I'm using clang-format 10.0.1. I managed to tweak the penalty values in the format to avoid the bin-packing problem I was seeing previously. I haven't extensively tested this (I usually only reformat gdb_bfd.c and look at it, since it exercised several bugs before...), so I recommend that others play with it a bit. I did see a few issues, though perhaps they are minor. 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 :) 2. clang-format can't handle GNU-style goto label out-denting. There's a clang-format bug on this topic https://bugs.llvm.org/show_bug.cgi?id=24118 3. In gdb if we have a large 'if' condition that consists of expression chained with "&&" or "||", we often put each sub-condition on its own line. clang-format packs them instead, and I didn't see a way to counteract this. 4. Gettext invocations like _("text") have a space added, like _ ("text"). I didn't see a way to change this. Another possible problem is that, unlike with 'black', ensuring that everyone has the same version is a pain. Maybe we could live with these? Let me know what you think. I can continue my experiments if this seems worthwhile. Tom