From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 4AB38211EABB6 for ; Tue, 26 Mar 2019 04:31:43 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2019 04:31:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,271,1549958400"; d="scan'208";a="137360360" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 26 Mar 2019 04:31:42 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 26 Mar 2019 04:31:40 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 26 Mar 2019 04:31:39 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.57]) with mapi id 14.03.0415.000; Tue, 26 Mar 2019 19:31:38 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTool: Fixed an issue of Structure PCD Thread-Index: AQHU47cRVV2uL7Ald0WoNc7KVHINIKYdx3zQ Date: Tue, 26 Mar 2019 11:31:37 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E40BC6C@SHSMSX104.ccr.corp.intel.com> References: <20190326093348.75592-1-bob.c.feng@intel.com> In-Reply-To: <20190326093348.75592-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjdlZTE5MWMtNTk2ZS00OGFjLWJiYjktNmY5MzBlMzRjNDY5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiS1JxU0RJaU5ka0cxQkp5SnBSandDVk9QTElFQnNFdmFkbVVEc0VcL1wvQmtLNzJDVnoxRDRnRyttSFRiSk9FYnRMIn0= dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTool: Fixed an issue of Structure PCD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Mar 2019 11:31:44 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Feng, Bob C > Sent: Tuesday, March 26, 2019 5:34 PM > To: edk2-devel@lists.01.org > Cc: Feng, Bob C ; Gao, Liming > Subject: [Patch] BaseTool: Fixed an issue of Structure PCD >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1665 >=20 > Build fail when the structure pcd has > member of flexible size array >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Bob Feng > Cc: Liming Gao > --- > BaseTools/Source/Python/Workspace/DscBuildData.py | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTool= s/Source/Python/Workspace/DscBuildData.py > index 58286159db..129c0c950b 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -1777,21 +1777,21 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(FieldList[FieldName.= strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVALID, "Invali= d value format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCNa= me, Pcd.TokenCName, FieldName.strip('.'))), > FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Value) > - if not Pcd.IsArray: > + if not Pcd.IsArray(): > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s= , %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n'= % (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), FieldList[FieldName.strip(".")][1], > FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + FieldName.split(= '[', 1)[0] + '[0]' > ArrayIndex =3D int(FieldName.split('[', 1)[1].sp= lit(']', 1)[0]) > FieldName =3D FieldName.split(']', 1)[1] > FieldName =3D NewFieldName + FieldName > - while '[' in FieldName and not Pcd.IsArray: > + while '[' in FieldName and not Pcd.IsArray(): > FieldName =3D FieldName.rsplit('[', 1)[0] > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s= , %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, > FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldL= ist[FieldName_ori][2], FieldList[FieldName_ori][0]) > for skuname in Pcd.SkuOverrideValues: > if skuname =3D=3D TAB_COMMON: > continue > @@ -1809,21 +1809,21 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(FieldLis= t[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVA= LID, "Invalid value format for %s. From %s Line %d " % > (".".join((Pcd.Token= SpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), > FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Val= ue) > - if not Pcd.IsArray: > + if not Pcd.IsArray(): > CApp =3D CApp + ' __FLEXIBLE_SIZE(*= Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + > ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value= %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), FieldList[FieldName.strip(".")][1], > FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + Fiel= dName.split('[', 1)[0] + '[0]' > ArrayIndex =3D int(FieldName.split('= [', 1)[1].split(']', 1)[0]) > FieldName =3D FieldName.split(']', 1= )[1] > FieldName =3D NewFieldName + FieldName > - while '[' in FieldName and not Pcd.IsArr= ay: > + while '[' in FieldName and not Pcd.IsArr= ay(): > FieldName =3D FieldName.rsplit('[', = 1)[0] > CApp =3D CApp + ' __FLEXIBLE_SIZE(*= Size, %s, %s, %d); // From %s Line %d Value %s \n' % > (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName= _ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0]) > if Pcd.PcdFieldValueFromFdf: > CApp =3D CApp + "// From fdf \n" > for FieldName in Pcd.PcdFieldValueFromFdf: > @@ -1834,11 +1834,11 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(Pcd.PcdFieldValueFromFdf= [FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVALID, "Invalid va= lue format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCName, = Pcd.TokenCName, FieldName.strip('.'))), > Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromF= df[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Value) > - if not Pcd.IsArray: > + if not Pcd.IsArray(): > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], > Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromF= df[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > @@ -1859,21 +1859,21 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(Pcd.PcdFieldValueFromCom= m[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVALID, "Invalid va= lue format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCName, = Pcd.TokenCName, FieldName.strip('.'))), > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFrom= Comm[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Value) > - if not Pcd.IsArray: > + if not Pcd.IsArray(): > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFrom= Comm[FieldName.strip(".")][2], > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + FieldName.split('[',= 1)[0] + '[0]' > ArrayIndex =3D int(FieldName.split('[', 1)[1].split(= ']', 1)[0]) > FieldName =3D FieldName.split(']', 1)[1] > FieldName =3D NewFieldName + FieldName > - while '[' in FieldName and not Pcd.IsArray: > + while '[' in FieldName and not Pcd.IsArray(): > FieldName =3D FieldName.rsplit('[', 1)[0] > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= ); // From %s Line %d Value %s \n' % (Pcd.DatumType, > FieldName.strip("."), ArrayIndex + 1, Pcd.PcdFieldValueFromComm[FieldName= _ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], > Pcd.PcdFieldValueFromComm[FieldName_ori][0]) > if Pcd.GetPcdMaxSize(): > CApp =3D CApp + " *Size =3D (%d > *Size ? %d : *Size); // T= he Pcd maxsize is %d \n" % (Pcd.GetPcdMaxSize(), > Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize()) > CApp =3D CApp + "}\n" > -- > 2.20.1.windows.1