From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yeF4EEuKmmDDPgAAWB0awg (envelope-from ) for ; Tue, 11 May 2021 09:44:43 -0400 Received: by simark.ca (Postfix, from userid 112) id 32D611F11C; Tue, 11 May 2021 09:44:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 3CF561E01F for ; Tue, 11 May 2021 09:44:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A080A388C020; Tue, 11 May 2021 13:44:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A080A388C020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620740681; bh=sO12GdwdNo+N+waxgtbDbXqjvjacvdCSG5XjYG8A32I=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=pwuOT1w6ZDsPaSDls4TYhfDWUW3vLVoPGxV+mTF5LIQAz+XKK+q61LdINdrlHbMtY d7sTnbqqfslXbTWgKBMdCW9nvpuz2LVYCBUMR67dsCYu+YVXl6LGm0wsD+Uf3CvyBe +CQBJ19AepAPykX++sg1AOqCQNi96u7qlUqR75pc= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A84F93839C45 for ; Tue, 11 May 2021 13:44:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A84F93839C45 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 14BDiXO6012923 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 May 2021 09:44:38 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 14BDiXO6012923 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id AA3E11E01F; Tue, 11 May 2021 09:44:33 -0400 (EDT) Subject: Re: Using clang-format To: Marco Barisione References: <87lf8p9pwg.fsf@tromey.com> <9e485731-875c-98e2-1894-6b1a45efa5c5@polymtl.ca> Message-ID: <3cb2d631-0bd0-bd9e-8e55-4d572a259018@polymtl.ca> Date: Tue, 11 May 2021 09:44:33 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 11 May 2021 13:44:33 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Tom Tromey , GDB patches mailing list Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" > As an occasional contributor I’d love this. > Getting the correct style right is complicated if you spend most of your > time developing other projects with other coding styles. > It’s even worse for cases that are not trivial as GDB’s codebase is > occasionally inconsistent so there’s nowhere where to take inspiration > from. Thanks for that feedback. > >>> I noticed this: >>> >>> 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. > > You can use BreakConstructorInitializers. Tom's config has BreakConstructorInitializers: BeforeColon But it still does it. > Personally, I’d be a bit worried about dealing with difficult conflicts > manually, but there are solutions for that: > > 1. Rebase your branch to the point just before reformatting: > $ git rebase > > 2. Rebase on top of the format changes but preferring your local > changes: > > $ git rebase --strategy=recursive \ > --strategy-option=theirs > > 3. Finally reformat all of your code you just committed and amend > your previous commits. I think that's a good option. It's a bit of manual steps, but: 1. It's O(1), it's as quick to do this with a small patch and a big patch. 2. It's temporary, eventually all patches that were in the pipeline at the time of the re-format will be submitted or dropped. > > > At work we decided not to reformat the whole C/C++ code base (while > we did for Python). Instead, we use some git hooks I wrote which > reformat only what you are committing. See > https://github.com/barisione/clang-format-hooks. > > While I wrote these scripts and would be happy for others to use > them, I think that (in GDB’s case) it would be easier to just > reformat everything and deal with the short-term pain. Agreed. Simon