From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from nwk-aaemail-lapp02.apple.com (nwk-aaemail-lapp02.apple.com [17.151.62.67]) by mx.groups.io with SMTP id smtpd.web12.6219.1601002112103195663 for ; Thu, 24 Sep 2020 19:48:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=w6Tfjd+U; spf=pass (domain: apple.com, ip: 17.151.62.67, mailfrom: afish@apple.com) Received: from pps.filterd (nwk-aaemail-lapp02.apple.com [127.0.0.1]) by nwk-aaemail-lapp02.apple.com (8.16.0.43/8.16.0.42) with SMTP id 08P2kA2h019918; Thu, 24 Sep 2020 19:48:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=mO8ZS2LKYbBQwbsNNz4zGZDt2KOGYyBlIGDl3RLDXGY=; b=w6Tfjd+UMbHpr8azRvGIhurxCzsdtBWrQ7TU5Zo7OFzjAUTLoEiVGQAddugddJgIyYTs TLY3u+IhCzBAU+0GJx25tfWpzY0lHGCUsI2mxjFlVRPkIPmHe9LdZKXD6syLjKmpzs6P sMB7EUL9F7E1Ee7Aw2f/+/IcLwqP91606zd30lBvmlA4fA03lh6v4WjxBe6lKYtvQ+4V s5VIaiN8pqIOfzmqcKPlEE9xl6e0MEvNvOrWKIshze/Oae0hCKycC2CzT0Mx00UWEs8j GqOm+XYHqPWQjb3NcL35mhpmCkSDmCdMTeV2W7c3RW2ZGhjWzK0WPM3L4NoiL2Nxs2Rp ZQ== Received: from rn-mailsvcp-mta-lapp03.rno.apple.com (rn-mailsvcp-mta-lapp03.rno.apple.com [10.225.203.151]) by nwk-aaemail-lapp02.apple.com with ESMTP id 33nejhkrwe-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 24 Sep 2020 19:48:30 -0700 Received: from rn-mailsvcp-mmp-lapp03.rno.apple.com (rn-mailsvcp-mmp-lapp03.rno.apple.com [17.179.253.16]) by rn-mailsvcp-mta-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.6.20200729 64bit (built Jul 29 2020)) with ESMTPS id <0QH700LSG14SJW30@rn-mailsvcp-mta-lapp03.rno.apple.com>; Thu, 24 Sep 2020 19:48:28 -0700 (PDT) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp03.rno.apple.com by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.6.20200729 64bit (built Jul 29 2020)) id <0QH700N000L8Q600@rn-mailsvcp-mmp-lapp03.rno.apple.com>; Thu, 24 Sep 2020 19:48:28 -0700 (PDT) X-Va-A: X-Va-T-CD: fcd940a3063d28518664f76484c3e186 X-Va-E-CD: 30880487448170967e84252656ce009f X-Va-R-CD: ef48d428a4f05f8f63f76ad7198e9cfd X-Va-CD: 0 X-Va-ID: 66002599-e671-4b26-89bb-09c41b856cb1 X-V-A: X-V-T-CD: fcd940a3063d28518664f76484c3e186 X-V-E-CD: 30880487448170967e84252656ce009f X-V-R-CD: ef48d428a4f05f8f63f76ad7198e9cfd X-V-CD: 0 X-V-ID: 5629ecfc-a85f-4e10-90fa-e9f657465db7 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-25_01:2020-09-24,2020-09-25 signatures=0 Received: from [17.235.19.99] (unknown [17.235.19.99]) by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.6.20200729 64bit (built Jul 29 2020)) with ESMTPSA id <0QH700PF714Q7L00@rn-mailsvcp-mmp-lapp03.rno.apple.com>; Thu, 24 Sep 2020 19:48:28 -0700 (PDT) From: "Andrew Fish" Message-id: MIME-version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [edk2-devel] ECC: Won't somebody PLEASE think of the... test structures. Date: Thu, 24 Sep 2020 19:48:26 -0700 In-reply-to: Cc: Ken Taylor To: edk2-devel-groups-io , bret.barkelew@microsoft.com References: <29096719f8d541c3aa25f9738a61b1d3@SCL-EXCHMB-13.phoenix.com> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-25_01:2020-09-24,2020-09-25 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_5BA3D6A8-507D-4306-AC52-35B8EE5E6E43" --Apple-Mail=_5BA3D6A8-507D-4306-AC52-35B8EE5E6E43 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Bret, I=E2=80=99ve had this issue with EFI code too. It will compile with for DE= BUG and RELEASE as the optimizer removes the memcpy/memset. So you only see= a build failure when you compiler NOOPT (and there are no intrinsic libs).= I mostly see this in platform code when I try to compile a single driver/l= ib NOOPT and it fails to link due to the missing intrinsic.=20 The easy to enforce this is to compile with optimizations enabled and don= =E2=80=99t enable intrinsic libs. Not sure if that is really practical fro= m the test point of view.=20 Seems the tool caught the coding style violation so I guess we could try t= o =E2=80=9Cmake running that tool easier=E2=80=9D. Maybe hooking into patch= check.py, making some kind of githook, or adding a git command? Thanks, Andrew Fish > On Sep 24, 2020, at 7:25 PM, Bret Barkelew via groups.io wrote: >=20 > So for context, this is a new host-based test that should only run withi= n a platform OS, so intrinsics aren=E2=80=99t the big deal that they would = be in FW code. > > But we do need to figure out how to simultaneously adhere to the coding = convention while enabling test authoring. > Or we chose to not enforce quite as many things for tests. > > I=E2=80=99d prefer the first.=20 > > - Bret=20 > > From: Ken Taylor > Sent: Thursday, September 24, 2020 6:57 PM > To: devel@edk2.groups.io ; Bret Barkelew > Subject: [EXTERNAL] RE: ECC: Won't somebody PLEASE think of the... test = structures. > > If the structure is a non-static local variable, most compilers will sil= ently inject an intrinsic call to memcpy in function initialization. This = leads to an intermittent linker error. > > If the compiler you use automatically supports an intrinsic memcpy in th= e given architecture or optimizes out the memcpy, it will build for you and= you won=E2=80=99t know you need to link to an intrinsic support library in= order to build cross platform. This leads to code that builds for you, bu= t not for me. > > Regards, > -Ken. > > From: devel@edk2.groups.io [mailto:devel@e= dk2.groups.io ] On Behalf Of Bret Barkelew via= groups.io > Sent: Thursday, September 24, 2020 6:23 PM > To: devel@edk2.groups.io > Subject: [edk2-devel] ECC: Won't somebody PLEASE think of the... test st= ructures. > > ERROR - EFI coding style error > ERROR - *Error code: 5007 > ERROR - *There should be no initialization of a variable as part of its = declaration > ERROR - *file: //home/corthon/_uefi/edk2_qemu_ci/edk2/MdeModulePkg/Libra= ry/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c > ERROR - *Line number: 333 > ERROR - *Variable Name: MatchCheckPolicy > > EccCheck no likey: > SIMPLE_VARIABLE_POLICY_ENTRY ValidationPolicy =3D { > { > VARIABLE_POLICY_ENTRY_REVISION, > sizeof(VARIABLE_POLICY_ENTRY) + sizeof(TEST_VAR_1_NAME), > sizeof(VARIABLE_POLICY_ENTRY), > TEST_GUID_1, > TEST_POLICY_MIN_SIZE_NULL, > TEST_POLICY_MAX_SIZE_NULL, > TEST_POLICY_ATTRIBUTES_NULL, > TEST_POLICY_ATTRIBUTES_NULL, > VARIABLE_POLICY_TYPE_NO_LOCK > }, > TEST_VAR_1_NAME > }; > > But you can=E2=80=99t init this structure separately without addressing = each field. > Can a brother get an override? > > - Bret=20 > > >=20 > <95B370A7BEED49AAB797022E8F260C8F.png> --Apple-Mail=_5BA3D6A8-507D-4306-AC52-35B8EE5E6E43 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Bret,

I=E2=80=99ve had this issue with EFI code = too. It will compile with for DEBUG and RELEASE as the optimizer removes th= e memcpy/memset. So you only see a build failure when you compiler NOOPT (a= nd there are no intrinsic libs). I mostly see this in platform code when I = try to compile a single driver/lib NOOPT and it fails to link due to the mi= ssing intrinsic. 

The easy to enforce this is to compile with optimizations enabled an= d don=E2=80=99t enable intrinsic libs. Not sure if that is really practical= from the test point of view. 

Seems the tool caught the coding style violation so I gu= ess we could try to =E2=80=9Cmake running that tool easier=E2=80=9D. Maybe = hooking into patchcheck.py, making some kind of githook, or adding a git co= mmand?  

Tha= nks,

Andrew Fish<= /div>


On Sep 24, 2020, at 7:25 PM, Bret Barkele= w via groups.io <bret.barkelew=3D= microsoft.com@groups.io> wrote:

So for context, this is a new host-bas= ed test that should only run within a platform OS, so intrinsics aren=E2=80= = =99t the big deal that they would be in FW code.
 
But we do need to figure out ho= w to simultaneously adhere to the coding convention while enabling test aut= horing.
Or we chose to not enforce quite as many things= for tests.
 
I=E2=80=99d prefer the first.&= nbsp;
 
- Bret 
 
From: Ken Taylor
Sent: Thursday, September 24, 2020 6:57 PM
To:=  devel@edk2.groups.io; = ;Bret Barkelew
<= b class=3D"">Subject: [EXTERNAL] RE: ECC: Won't somebody PLEASE think of the... test structures.=
 
If the structure is a = non-static local variable, most compilers will silently inject an intrinsic= call to memcpy in function initialization.  This leads to an intermit= tent linker error.
 
If the compiler you use automatically supports an intrinsic memcpy in th= e given architecture or optimizes out the memcpy, it will build for you and= you won=E2=80=99t know you need to link to an intrinsic support library in= order to build cross platform.  This leads to code that builds for yo= u, but not for me.
 
Regards,
-Ken.
 
Fr= om: devel@edk2.groups.io [mailto:devel@edk2.groups.i= o] On B= ehalf Of Bret Barkele= w via gr= oups.io
Sent: Thursday, September 24, 2020 6:23 PM
To: devel@edk2.groups.io
Subject: [edk2-dev= el] ECC: Won't somebody PLEASE think of the... test structures.
 =
ERROR - EFI coding style error
ERROR - *Error code: 5007
ERROR - *There should be no initialization of a variable = as part of its declaration
ERROR = - *file: //home/corthon/_uefi/edk2_qemu_ci/edk2/MdeModulePkg/Library/Variab= lePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c=
ERROR - *Line number: 333<= /div>
ERROR - *Variable Name: MatchCheckPolicy
 
EccCheck no likey:
SIMPLE_VARIA= BLE_POLICY_ENTRY   ValidationPolicy =3D {
    {
      VARIABLE_POLICY_ENTRY_REVISION,
      sizeof(= VARIABLE_POLICY_ENTRY) + sizeof(TEST_VAR_1_NAME),
      sizeof(VARIABLE_POLICY_ENTR= Y),
     = ; TEST_GUID_1,
   =    TEST_POLICY_MIN_SIZE_NULL,
      TEST_POLICY_MAX_SIZE_NULL,
      TEST_POLIC= Y_ATTRIBUTES_NULL,
  &n= bsp;   TEST_POLICY_ATTRIBUTES_NULL,
      VARIABLE_POLICY_TYPE_NO_LOCK
    },
    TEST_VAR_1_NAME
  };
 
But you can=E2= =80=99t init this structure separately without addressing each field.
Can a brother get an override?
 
- Bret 
 

 
<95B370A= 7BEED49AAB797022E8F260C8F.png>

--Apple-Mail=_5BA3D6A8-507D-4306-AC52-35B8EE5E6E43--