From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web09.9512.1579521374647042657 for ; Mon, 20 Jan 2020 03:56:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BbnffII2; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579521373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAOC6t6mfvR7BgXed6rm7CbjLyMUMVuBiMOoRez1PWY=; b=BbnffII2+jQqDzy2qy/XFxC7MQYHufYfrMuXBpeaSQToPk0TX//lVNyoc6HRYT+kbHqJa1 quLd22O1vNEtJ0okEYJrHx0NN2Kf1z52LnrTH9ypjWA9P2cybf3pS8abwaHdQEgHJtTsgZ aPvl7JR2d+VubZUFX1Gt+xsbhPvAiRA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-gNalXFRFN9adF98klNkh3w-1; Mon, 20 Jan 2020 06:56:10 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77D5CA0CCC; Mon, 20 Jan 2020 11:56:09 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-50.ams2.redhat.com [10.36.117.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C4CE5D9E1; Mon, 20 Jan 2020 11:56:08 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v2] BaseTools/Conf/gitattributes: fix "--function-context" for C source code To: Leif Lindholm , devel@edk2.groups.io Cc: Bob Feng , Liming Gao References: <20200120094245.9010-1-lersek@redhat.com> <20200120101210.GR15141@bivouac.eciton.net> From: "Laszlo Ersek" Message-ID: Date: Mon, 20 Jan 2020 12:56:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200120101210.GR15141@bivouac.eciton.net> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: gNalXFRFN9adF98klNkh3w-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 01/20/20 11:12, Leif Lindholm wrote: > On Mon, Jan 20, 2020 at 10:42:45 +0100, Laszlo Ersek wrote: >> The "--function-context" ("-W") option of git-diff displays the entire >> body of a modified function, not just small modified hunks within the >> function. It is useful for reviewers when the code changes to the function >> are small, but they could affect, or depend on, control flow that is far >> away in the same function. >> >> Of course, the size of the displayed context can be controlled with the >> "-U" option anyway, but such fixed-size contexts are usually either too >> small, or too large, in the above scenario. >> >> It turns out that "--function-context" does not work correctly for C >> source files in edk2. In particular, labels for the goto instruction >> (which the edk2 coding style places in the leftmost column) appear to >> terminate "--function-context". >> >> The "git" utility contains built-in hunk header patterns for the C and C++ >> languages. However, they do not take effect in edk2 because we don't >> explicitly assign the "cpp" git-diff driver to our C files. The >> gitattributes(5) manual explains that this is required: >> >>> There are a few built-in patterns to make this easier, and >>> tex is one of them, so you do not have to write the above in >>> your configuration file (you still need to enable this with >>> the attribute mechanism, via .gitattributes). The following >>> built in patterns are available: >>> >>> [...] >>> >>> * cpp suitable for source code in the C and C++ >>> languages. >> >> The key statement is the one in parentheses. >> >> Grab the suffix lists from the [C-Code-File] and [Acpi-Table-Code-File] >> sections of "BaseTools/Conf/build_rule.template", add "*.h" and "*.H", and >> mark those as belonging to the "cpp" git-diff driver. >> >> This change has a dramatic effect on the following command, for example: >> >> $ git show -W 2ef0c27cb84c >> >> Cc: Bob Feng >> Cc: Leif Lindholm >> Cc: Liming Gao >> Signed-off-by: Laszlo Ersek > > Reviewed-by: Leif Lindholm Thanks! > also > Reviewed-by: Leif Lindholm > (if it jars too much to use a different one from Cc: tag above) > > For other purposes, the Linaro address can now be considered retired. Ah yes, sorry about not updating the CC tag with the v1->v2 rebase! (Because, I had updated even my text editor shortcut that inserts your name+email!) Thanks! Laszlo