From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by sourceware.org (Postfix) with ESMTPS id 4E02D3858438 for ; Mon, 18 Jul 2022 18:08:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E02D3858438 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-f52.google.com with SMTP id a11so1486973wmq.3 for ; Mon, 18 Jul 2022 11:08:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=NSx+GJ/2ePucfgnpddtyACZblOfWAzi3eWJFns6GTNM=; b=aXGD+uVqRh9khBelA9X8SAJtITzNbTcHXifLB7f/igCOoEh9deaFlleaqw/WJuvu3N kkORDYCj1axnGtZgPXP/0gOdejGrVefP2pP6krVjwVa/1MIOVuBlLUhc5g+pmvOs8toK pgha952+yWwD9tTce/wVS5wY9sbHN/P+aM12VP4TJ7ndlcWrpzqfL3MBgN0cvDmWfMNa c4brf2HbkYEzLznArmat9VHlcIm4U/qnHYtloFq/5exCDCRAzjDpEe/k4z+lNZUeADiZ 17wlE8lUbLg0Zhd3cLLS6wtMZLsJLkgLPzyP9sGpi+uPmSOeCvXRUOHCVrpkIMQS9Zfg Gi5w== X-Gm-Message-State: AJIora/ifUVjFR0FCxdyQkF5yIR32e0rLwUvPWlYHs04vsLnBL94SSXN kbOb8SyQQx254sAs8+8bz9maoEhlMKQ= X-Google-Smtp-Source: AGRyM1vc6fMXfDNpZS31aaCfSwta5Q5lo1xbu8R1kb3WKnkarcUJDtuVjRUt89yjI0rB5ekC4Z7JzA== X-Received: by 2002:a05:600c:3ac6:b0:3a2:ce07:d011 with SMTP id d6-20020a05600c3ac600b003a2ce07d011mr32080784wms.99.1658167682360; Mon, 18 Jul 2022 11:08:02 -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 l20-20020a1c7914000000b003a2f6367049sm15243417wme.48.2022.07.18.11.08.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Jul 2022 11:08:01 -0700 (PDT) Subject: Re: [PATCH] gdb/git: highlight whitespace errors source files To: Simon Marchi , Andrew Burgess , gdb-patches@sourceware.org References: <20220718144359.1473453-1-aburgess@redhat.com> <45d241a7-e128-e2d7-5ba7-e4ecfa5f05c1@simark.ca> From: Pedro Alves Message-ID: <14230ca4-d943-8aff-ec66-d6a94f42561d@palves.net> Date: Mon, 18 Jul 2022 19:08:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <45d241a7-e128-e2d7-5ba7-e4ecfa5f05c1@simark.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Mon, 18 Jul 2022 18:08:06 -0000 On 2022-07-18 4:36 p.m., Simon Marchi via Gdb-patches wrote: > On 2022-07-18 10:43, Andrew Burgess via Gdb-patches wrote: >> For a long time I've had this in my ~/.gitconfig: >> >> [core] >> whitespace = space-before-tab,indent-with-non-tab,trailing-space >> >> which causes git to show me if I muck up and use spaces instead of >> tabs, or leave in trailing whitespace. I find this really useful. >> >> In this commit I'd like to propose adding something similar to our >> three .gitattributes files, and enable whitespace error detection for >> all .h, .c, and .cc files. >> >> Errors are highlighted during a diff, for lines being added. > > I think this is a good idea, it can only help. Agreed. I've actually had two of these settings in my .gitconfig for a long time too, didn't know we could set up in .gitattributes. That's nice. I didn't have indent-with-non-tab for some reason, which I assume it means whoever I copied the options from didn't know about it either, and I didn't bother to check what's available. :-) On 2022-07-18 3:43 p.m., Andrew Burgess via Gdb-patches wrote: > --- a/gdb/.gitattributes > +++ b/gdb/.gitattributes > @@ -2,6 +2,8 @@ > > # Use cpp-style diffs for .h and .c files. This is useful > # if you modify classes defined in those files. > +# > +# Enable highlighting of whitespace errors in .h and .c files. > > -*.h diff=cpp > -*.c diff=cpp > +*.h diff=cpp whitespace=space-before-tab,indent-with-non-tab,trailing-space > +*.c diff=cpp whitespace=space-before-tab,indent-with-non-tab,trailing-space These attributes are inherited by subdirectories, right? I'd add settings for typical extensions used in the testsuite too, like .cc and .cpp. But how about asking the binutils folks whether they'd be fine with adding these in the top level .gitattributes? GCC's top level .gitattributes also adds these settings, for example: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=.gitattributes;h=e75bfc595bfb1ec14c364a650df08253f24beecc;hb=HEAD (and from that, we see that "*.[cCh]" syntax works.)