From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.1452.1580459755313034509 for ; Fri, 31 Jan 2020 00:35:55 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2020 00:35:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,385,1574150400"; d="scan'208";a="247664939" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 31 Jan 2020 00:35:54 -0800 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 31 Jan 2020 00:35:53 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 31 Jan 2020 16:35:51 +0800 Received: from shsmsx606.ccr.corp.intel.com ([10.109.6.216]) by SHSMSX606.ccr.corp.intel.com ([10.109.6.216]) with mapi id 15.01.1713.004; Fri, 31 Jan 2020 16:35:51 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "lersek@redhat.com" , "Kinney, Michael D" CC: "Feng, Bob C" , Leif Lindholm Subject: Re: [edk2-devel] [PATCH v2] BaseTools/Conf/gitattributes: fix "--function-context" for C source code Thread-Topic: [edk2-devel] [PATCH v2] BaseTools/Conf/gitattributes: fix "--function-context" for C source code Thread-Index: AQHVz3X+9cM206KfpkSSectqwhZXeKf3p/MAgAxVWICAAIaB0A== Date: Fri, 31 Jan 2020 08:35:51 +0000 Message-ID: References: <20200120094245.9010-1-lersek@redhat.com> <7ae96e2f-69f6-e001-4239-94c42424f3c6@redhat.com> <4a2d9fb6-af1c-ad09-78b3-86043d9d9d8a@redhat.com> In-Reply-To: <4a2d9fb6-af1c-ad09-78b3-86043d9d9d8a@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo: I am back. This change is good. Reviewed-by: Liming Gao Thanks Liming > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Laszlo Er= sek > Sent: Friday, January 31, 2020 4:34 PM > To: Kinney, Michael D > Cc: edk2-devel-groups-io ; Feng, Bob C ; Leif Lindholm ; > Gao, Liming > Subject: Re: [edk2-devel] [PATCH v2] BaseTools/Conf/gitattributes: fix "= --function-context" for C source code >=20 > Hi Mike, >=20 > On 01/23/20 13:13, Laszlo Ersek wrote: > > Mike, > > > > can you please ACK this patch while Liming and Bob are away? It's very > > simple. >=20 > I intended to write "ping" here... But then I realized I failed to add > you to the "To:" list in the first place, when I asked you to review! :( >=20 > Sigh. >=20 > So, can you please review this now? :) >=20 > Thanks > Laszlo >=20 > > On 01/20/20 10:42, Laszlo Ersek wrote: > >> The "--function-context" ("-W") option of git-diff displays the entir= e > >> body of a modified function, not just small modified hunks within the > >> function. It is useful for reviewers when the code changes to the fun= ction > >> 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 t= he > >> "-U" option anyway, but such fixed-size contexts are usually either t= oo > >> 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 an= d 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, an= d > >>> tex is one of them, so you do not have to write the above= in > >>> your configuration file (you still need to enable this wi= th > >>> the attribute mechanism, via .gitattributes). The followi= ng > >>> 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-Fil= e] > >> 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 examp= le: > >> > >> $ git show -W 2ef0c27cb84c > >> > >> Cc: Bob Feng > >> Cc: Leif Lindholm > >> Cc: Liming Gao > >> Signed-off-by: Laszlo Ersek > >> --- > >> > >> Notes: > >> v2: > >> > >> - take suffixes from "BaseTools/Conf/build_rule.template" [Leif] > >> > >> - replace "*.h" / "*.c" in the commit message with "C source" and > >> [C-Code-File] / [Acpi-Table-Code-File] > >> > >> - Supersedes: <20200116184929.18020-1-lersek@redhat.com> > >> http://mid.mail-archive.com/20200116184929.18020-1-lersek@redha= t.com > >> https://edk2.groups.io/g/devel/message/53312 > >> > >> BaseTools/Conf/gitattributes | 11 +++++++++++ > >> 1 file changed, 11 insertions(+) > >> > >> diff --git a/BaseTools/Conf/gitattributes b/BaseTools/Conf/gitattribu= tes > >> index 58b93e9d4c27..319e89064133 100644 > >> --- a/BaseTools/Conf/gitattributes > >> +++ b/BaseTools/Conf/gitattributes > >> @@ -17,3 +17,14 @@ > >> *.fdf diff=3Dini > >> *.fdf.inc diff=3Dini > >> *.inf diff=3Dini > >> +*.c diff=3Dcpp > >> +*.C diff=3Dcpp > >> +*.cc diff=3Dcpp > >> +*.CC diff=3Dcpp > >> +*.cpp diff=3Dcpp > >> +*.Cpp diff=3Dcpp > >> +*.CPP diff=3Dcpp > >> +*.aslc diff=3Dcpp > >> +*.act diff=3Dcpp > >> +*.h diff=3Dcpp > >> +*.H diff=3Dcpp > >> > > >=20 >=20 >=20