public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>
Cc: edk2-devel-01 <edk2-devel@ml01.01.org>
Subject: Re: [PATCH 11/12] OvmfPkg/SmmControl2Dxe: save fw_cfg boot script with QemuFwCfgS3Lib
Date: Tue, 14 Mar 2017 14:48:26 +0100	[thread overview]
Message-ID: <c5ba0ea9-98c1-b9f1-4ed7-97e3187cd82f@redhat.com> (raw)
In-Reply-To: <E92EE9817A31E24EB0585FDF735412F57D126491@ORSMSX113.amr.corp.intel.com>

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 <michael.d.kinney@intel.com>; Laszlo Ersek <lersek@redhat.com>
>> Cc: edk2-devel-01 <edk2-devel@lists.01.org>
>> 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



  reply	other threads:[~2017-03-14 13:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23  1:48 [PATCH 00/12] ArmVirtPkg, OvmfPkg: factor out QemuFwCfgS3Lib Laszlo Ersek
2017-02-23  1:48 ` [PATCH 01/12] OvmfPkg: introduce QemuFwCfgS3Lib class Laszlo Ersek
2017-02-23  1:48 ` [PATCH 02/12] OvmfPkg/QemuFwCfgS3Lib: add initial Base Null library instance Laszlo Ersek
2017-02-23  1:48 ` [PATCH 03/12] OvmfPkg/QemuFwCfgS3Lib: add initial PEI and DXE fw_cfg library instances Laszlo Ersek
2017-02-23  1:48 ` [PATCH 04/12] ArmVirtPkg: resolve QemuFwCfgS3Lib Laszlo Ersek
2017-02-23 11:18   ` Ard Biesheuvel
2017-02-23  1:48 ` [PATCH 05/12] OvmfPkg: " Laszlo Ersek
2017-02-23  1:48 ` [PATCH 06/12] ArmVirtPkg, OvmfPkg: retire QemuFwCfgS3Enabled() from QemuFwCfgLib Laszlo Ersek
2017-02-23 11:18   ` Ard Biesheuvel
2017-02-23  1:48 ` [PATCH 07/12] OvmfPkg/QemuFwCfgS3Lib: add boot script opcode generation APIs to libclass Laszlo Ersek
2017-03-10  9:58   ` Jordan Justen
2017-03-10 19:14     ` Laszlo Ersek
2017-02-23  1:48 ` [PATCH 08/12] OvmfPkg/QemuFwCfgS3Lib: implement opcode APIs for Base Null instance Laszlo Ersek
2017-02-23  1:48 ` [PATCH 09/12] OvmfPkg/QemuFwCfgS3Lib: implement opcode APIs for PEI fw_cfg instance Laszlo Ersek
2017-02-23  1:48 ` [PATCH 10/12] OvmfPkg/QemuFwCfgS3Lib: implement opcode APIs for DXE " Laszlo Ersek
2017-02-23  1:48 ` [PATCH 11/12] OvmfPkg/SmmControl2Dxe: save fw_cfg boot script with QemuFwCfgS3Lib Laszlo Ersek
2017-03-10 10:14   ` Jordan Justen
2017-03-10 19:36     ` Laszlo Ersek
2017-03-13 21:32       ` Jordan Justen
2017-03-13 22:12         ` Laszlo Ersek
2017-03-13 22:43           ` Jordan Justen
2017-03-14  1:58             ` Kinney, Michael D
2017-03-14 13:48               ` Laszlo Ersek [this message]
2017-03-14 20:38                 ` Laszlo Ersek
2017-02-23  1:48 ` [PATCH 12/12] OvmfPkg/AcpiPlatformDxe: " Laszlo Ersek
2017-02-23 16:59 ` [PATCH 00/12] ArmVirtPkg, OvmfPkg: factor out QemuFwCfgS3Lib Jordan Justen
2017-02-23 17:22   ` Laszlo Ersek
2017-03-06  9:19 ` Jordan Justen
2017-03-06 18:41   ` Laszlo Ersek
2017-03-10  9:55     ` Jordan Justen
2017-03-10 20:16       ` Laszlo Ersek
2017-03-11  3:17         ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5ba0ea9-98c1-b9f1-4ed7-97e3187cd82f@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox