From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.12.1668447480252025191 for ; Mon, 14 Nov 2022 09:38:00 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=nX9FHbIV; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [192.168.4.22] (unknown [47.201.8.94]) by linux.microsoft.com (Postfix) with ESMTPSA id 30F0920B717A; Mon, 14 Nov 2022 09:37:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 30F0920B717A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1668447479; bh=JP65u3BOePy3Ur8LXERLENWFeuEzJzfwtODcSoPgARg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=nX9FHbIVUboJ9q5B0JUI+H5Zeo2H3A5w4Slnf4oGR88etRqLquRvSGqOEYQUszTuq qnDJ50huxxbMj8nB54iTtjLZRaM0qVrOFyU+ZHub2XWWvfLPebF77u2XEXB+loBoNj nsaFYx7HkAIWG+wZ825XwJggb4SYUoaI2JBm0oAc= Message-ID: <62bfa29f-9b7d-4af0-6602-538ccc1e4f87@linux.microsoft.com> Date: Mon, 14 Nov 2022 12:37:58 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed arguments To: devel@edk2.groups.io, michael.d.kinney@intel.com, "abner.chang@amd.com" , Laszlo Ersek , "Kubacki, Michael" References: <922996c2-e60a-80ec-6d4a-8b2e5a639c9b@redhat.com> <25893.1668303336748921539@groups.io> From: "Michael Kubacki" In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable I'm catching up on this thread so let me know if I miss something. Uncrustify can perform conversions/enforcements like adjusting code to <=20 80 columns. The edk2 uncrustify configuration file is here and you will see that I=20 commented column width enforcement: https://github.com/tianocore/edk2/blob/master/.pytool/Plugin/UncrustifyChec= k/uncrustify.cfg#L19. Uncrustify aside, column width is particularly difficult to adjust=20 consistently. Both humans and tools have to make many (constant)=20 situational decisions based on code structure. However, it should be possible. I've taken the current uncrustify=20 configuration file, made minimal changes to restrict code to 80 columns,=20 and published the results based on the current edk2 code tree here: https://github.com/makubacki/edk2/tree/uncrustify_80_column_change You can see the I ran uncrustify 3 times to reach a mostly steady state.=20 The issue after the second run is that uncrustify is confused about what=20 to do with single macros that exceed 80 columns. Examples: 1.=20 https://github.com/makubacki/edk2/blob/uncrustify_80_column_change/MdePkg/I= nclude/IndustryStandard/Acpi30.h#L702-#L704 2.=20 https://github.com/makubacki/edk2/blob/uncrustify_80_column_change/MdePkg/I= nclude/IndustryStandard/IpmiNetFnApp.h#L1023-#L1031 There are other cases there as well. Anyway, if those were reduced in length, I think we could reach a steady=20 state. Some other minor tweaks might also be required. Regarding function calls, I put together the following branch to=20 demonstrate some examples of what is done now. In summary, multiple arguments can be provided on a single line (with no=20 width or argument count maximum) or multiple lines. If a single argument=20 is multi-line, then all arguments must be on a unique line to follow the=20 multi-line argument convention. See the top two commits in this branch for examples: https://github.com/makubacki/edk2/tree/func_arg_formatting_demo I agree uncrustify and the spec be in sync. Regards, Michael On 11/14/2022 12:07 PM, Michael D Kinney wrote: > I disagree that they can coexist. >=20 > If uncrustify is forcing 1 arg per line, then a developer that follows a= =20 > CSS that allows multiple per line, the code change will be rejected by=20 > EDK II CI. >=20 > The CSS and Uncristify behavior need to be aligned.If we want a CSS=20 > change that requires Uncristify changes, then they have to be coordinated= . >=20 > Mike >=20 > *From:*devel@edk2.groups.io *On Behalf Of *Chang,= =20 > Abner via groups.io > *Sent:* Sunday, November 13, 2022 5:10 PM > *To:* devel@edk2.groups.io; Kinney, Michael D=20 > ; Laszlo Ersek ; Kubacki,= =20 > Michael > *Subject:* Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH=20 > 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed=20 > arguments >=20 > [AMD Official Use Only - General] >=20 > For this case, we don=E2=80=99t have to take another global reformatting.= These=20 > two formats can coexisting without the conflict. =C2=A0We just allow the= =20 > condense argus format in CSS. Also, update Uncrustify to not forcing=20 > each argument at its own line. >=20 > The current Uncrustify behavior seems to me match the CCS spec. But this= =20 > patch was sent to allow the multiple argus at the same line, which was=20 > not proposed to fix the issue in current Uncrustify. You sure we just=20 > close this issue? >=20 > Abner >=20 > *From:* devel@edk2.groups.io =20 > > *On Behalf Of=20 > *Michael D Kinney via groups.io > *Sent:* Monday, November 14, 2022 1:36 AM > *To:* devel@edk2.groups.io ; Chang, Abner=20 > >; Laszlo Ersek=20 > >; Kubacki, Michael=20 > >;= =20 > Kinney, Michael D > > *Subject:* Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH=20 > 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed=20 > arguments >=20 > =09 >=20 > *Caution:*This message originated from an External Source. Use proper=20 > caution when opening attachments, clicking links, or responding. >=20 > We do not want another global format change because that make git blame= =20 > difficult to use. >=20 > Are any clarifications required to describe the current Uncrustify=20 > behavior?=C2=A0 Or is the description correct? >=20 > If the current description matches Uncristify behavior, then I recommend= =20 > we close this issue as will not fix. >=20 > Mike >=20 > *From:* devel@edk2.groups.io =20 > > *On Behalf Of=20 > *Chang, Abner via groups.io > *Sent:* Sunday, November 13, 2022 12:45 AM > *To:* Kinney, Michael D >; devel@edk2.groups.io=20 > ; Laszlo Ersek >; Kubacki, Michael=20 > > > *Subject:* Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH=20 > 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed=20 > arguments >=20 > [AMD Official Use Only - General] >=20 > Uncrustify can fix the first argument that is not at the indent with two= =20 > space. It also can fix the first argument that is not at the new line. >=20 > But it also makes each argument a new line if multiple args are=20 > condensed in one line. That is what we have to update Uncrustify if we=20 > have this patch merged to CCS. >=20 > +Michael Kubacki in loop. >=20 > Abner >=20 > *From:* Kinney, Michael D > > *Sent:* Sunday, November 13, 2022 9:58 AM > *To:* devel@edk2.groups.io ; Chang, Abner=20 > >; Laszlo Ersek=20 > >; Kinney, Michael D=20 > > > *Subject:* RE: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH=20 > 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed=20 > arguments >=20 > =09 >=20 > *Caution:*This message originated from an External Source. Use proper=20 > caution when opening attachments, clicking links, or responding. >=20 > Is this exactly what Uncrustify does now? >=20 > Mike >=20 > *From:* devel@edk2.groups.io =20 > > *On Behalf Of=20 > *Chang, Abner via groups.io > *Sent:* Saturday, November 12, 2022 5:36 PM > *To:* Laszlo Ersek >;=20 > devel@edk2.groups.io > *Subject:* Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH=20 > 2/2] Source Files / Spacing / Multi-line func. calls: allow condensed=20 > arguments >=20 > Hi all, > As we are going to release CCS 2.3, we would like to address some=20 > pending issues of CCS. For this, I think we can, > - Still keep the one line per argument style in CCS although the=20 > multi-arguments in the one line style can cover this. This avoids=20 > confusion from readers and questions about if they can do the one-line=20 > per argument style. > - If the arguments are in different lines, the first argument must be=20 > indented with two spaces from the start of the function name or the=20 > member function name. > How is this? >=20 > Abner >=20 >=20