From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 31E15803E4 for ; Tue, 14 Mar 2017 06:48:29 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA879C04B93D; Tue, 14 Mar 2017 13:48:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-194.phx2.redhat.com [10.3.116.194]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2EDmSxZ032141; Tue, 14 Mar 2017 09:48:28 -0400 To: "Kinney, Michael D" , "Justen, Jordan L" References: <20170223014814.10937-1-lersek@redhat.com> <20170223014814.10937-12-lersek@redhat.com> <148914088572.26490.12215430240628550434@jljusten-skl> <55e1eade-1d06-4b04-3e07-5ceef61a5602@redhat.com> <148944077646.15816.5488638936147140185@jljusten-skl> <148944501645.16415.6726175929038559977@jljusten-skl> Cc: edk2-devel-01 From: Laszlo Ersek Message-ID: Date: Tue, 14 Mar 2017 14:48:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 14 Mar 2017 13:48:29 +0000 (UTC) Subject: Re: [PATCH 11/12] OvmfPkg/SmmControl2Dxe: save fw_cfg boot script with QemuFwCfgS3Lib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2017 13:48:29 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 03/14/17 02:58, Kinney, Michael D wrote: > Laszlo, > > I agree that there are some inconsistencies in the edk2 C source files. > > For this specific example, I prefer what Jordan recommended: > >>> Status = QemuFwCfgS3WriteBytes ( >>> mRequestedFeaturesItem, >>> sizeof ScratchBuffer->Features >>> ); > > When multi-line: > * One argument per line > * Indent each argument 2 spaces from start of function name > * Close parenthesis aligned with start of arguments > > I am actively working on adding the EDK II C Coding standard > and other EDK II docs to gitbooks. That will be a good place > to discuss and clarify or correct the EDK II C coding standard. > > Given inconsistencies in some of the edk2 C source files and > some clarification needed in EDK II C Coding Standard, I would > not require any changes here. If I understand correctly, that means v2 of this set should be acceptable. If that's right, can you please R-b this set, Jordan? > I would prefer everyone follow > this specific recommendation if possible. I can do that, in the future, if we codify the preference in some written form, even before the CCS is updated and/or imported to gitbooks. Should we file a TianoCore BZ for it? I can do that, if you prefer. Thanks! Laszlo > Hopefully we can expand the PatchCheck tool over time to help > check code against the EDK II C Coding Standard. > > Mike > > >> -----Original Message----- >> From: Justen, Jordan L >> Sent: Monday, March 13, 2017 3:44 PM >> To: Kinney, Michael D ; Laszlo Ersek >> Cc: edk2-devel-01 >> Subject: Re: [edk2] [PATCH 11/12] OvmfPkg/SmmControl2Dxe: save fw_cfg boot script with >> QemuFwCfgS3Lib >> >> On 2017-03-13 15:12:08, Laszlo Ersek wrote: >>> >>> "CCS_2_1_Draft.pdf" seems to be the most recent version; in it, I find: >>> >>> (1) >>> >>> 5.2.2.4 Subsequent lines of multi-line function calls should line up >>> one or two tab-stops from the beginning of the function name >>> >>> Use either one or two tab stops to ensure that each parameter >>> is indented at least two spaces after the function name. Either >>> of the below examples is acceptable: >>> >>> Status = gBS->AllocatePool ( >>> EfiBootServicesData, >>> sizeof (DRIVER_NAME_INSTANCE), >>> &PrivateData >>> ); >>> >>> Status = gBS->AllocatePool ( >>> EfiBootServicesData, >>> sizeof (DRIVER_NAME_INSTANCE), >>> &PrivateData >>> ); >>> >>> My notes on this: >>> >>> - my code complies with the indentation requirement >>> >>> - the passage is silent on whether each argument should be broken off >>> to a new line. The examples are called "acceptable", not "required". >>> I guess this is what your question to Mike is about. >>> >> >> Right. It seems like this is a case where the text perhaps could be >> more clear. Just looking at the precedence in the tree, it seems >> likely that we might want to say that if the call requires multiple >> lines, then the first parameter should be indented on the next line. >> >>> - I don't see what the difference is between the two examples. To me >>> they look identical. >> >> I think this example formatting got messed up. I saw a previous >> version that varied very subtlely. >> >> Status = gBS->AllocatePool ( >> EfiBootServicesData, >> sizeof (DRIVER_NAME_INSTANCE), >> &PrivateData >> ); >> >> Status = gBS->AllocatePool ( >> EfiBootServicesData, >> sizeof (DRIVER_NAME_INSTANCE), >> &PrivateData >> ); >> >> I always thought the rule was 2 spaces indenting beyond the function >> name. >> >> These example make me think that the intension is that your tab key >> might only want to align to columns that are even numbered, so you >> might have the result be that the indent from the function name would >> be 3 spaces. >> >> I don't know... I prefer the rule that you indent 2 spaces from the >> function name. :) >> >>> - In the examples, the closing parens line up with "AllocatePool", not >>> with "EfiBootServicesData". I think I have never ever seen this style >>> in edk2. >>> >> >> Yeah. Me either. This is confusing. >> >> -Jordan