From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 778742116525D for ; Mon, 15 Oct 2018 17:36:56 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2018 17:36:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,386,1534834800"; d="scan'208";a="100527051" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 15 Oct 2018 17:36:55 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Oct 2018 17:36:55 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.48]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.245]) with mapi id 14.03.0319.002; Tue, 16 Oct 2018 08:36:44 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Support to use struct name as datum type before max size Thread-Index: AQHUZIouF8kZiDmia0C85Zh28XWtjKUhB21Q Date: Tue, 16 Oct 2018 00:36:43 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E33A6E9@SHSMSX104.ccr.corp.intel.com> References: <1539609765-7964-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1539609765-7964-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Support to use struct name as datum type before max size 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, 16 Oct 2018 00:36:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Yonghong Zhu >Sent: Monday, October 15, 2018 9:23 PM >To: edk2-devel@lists.01.org >Subject: [edk2] [Patch] BaseTools: Support to use struct name as datum typ= e >before max size > >Original it hard code to use "VOID*", this patch extend it to both >support VOID* and valid struct name. > >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Yonghong Zhu >--- > BaseTools/Source/Python/Common/Misc.py | 4 +++- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 6 +++--- > 2 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/BaseTools/Source/Python/Common/Misc.py >b/BaseTools/Source/Python/Common/Misc.py >index 2cf9574..3c71dfc 100644 >--- a/BaseTools/Source/Python/Common/Misc.py >+++ b/BaseTools/Source/Python/Common/Misc.py >@@ -47,10 +47,12 @@ startPatternGeneral =3D re.compile("^Start[' ']+Length= [' >']+Name[' ']+Class") > addressPatternGeneral =3D re.compile("^Address[' ']+Publics by Value[' >']+Rva\+Base") > valuePatternGcc =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]= +)$') > pcdPatternGcc =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') > secReGeneral =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[= Hh]? >+([.\w\$]+) +(\w+)', re.UNICODE) > >+StructPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$') >+ > ## Dictionary used to store file time stamp for quick re-access > gFileTimeStampCache =3D {} # {file path : file time stamp} > > ## Dictionary used to store dependencies of files > gDependencyDatabase =3D {} # arch : {file path : [dependent files list= ]} >@@ -1461,11 +1463,11 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=3D'')= : > if PcdType in (MODEL_PCD_FIXED_AT_BUILD, >MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, >MODEL_PCD_DYNAMIC_EX_DEFAULT): > Value =3D FieldList[0] > Size =3D '' > if len(FieldList) > 1 and FieldList[1]: > DataType =3D FieldList[1] >- if FieldList[1] !=3D TAB_VOID: >+ if FieldList[1] !=3D TAB_VOID and StructPattern.match(FieldLi= st[1]) is >None: > IsValid =3D False > if len(FieldList) > 2: > Size =3D FieldList[2] > if IsValid: > if DataType =3D=3D "": >diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py >b/BaseTools/Source/Python/Workspace/MetaFileParser.py >index 79e3180..f33b91c 100644 >--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py >+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py >@@ -27,11 +27,11 @@ import Common.EdkLogger as EdkLogger > import Common.GlobalData as GlobalData > > from CommonDataClass.DataClass import * > from Common.DataType import * > from Common.StringUtils import * >-from Common.Misc import GuidStructureStringToGuidString, >CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd, >AnalyzePcdExpression, ParseFieldValue >+from Common.Misc import GuidStructureStringToGuidString, >CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd, >AnalyzePcdExpression, ParseFieldValue, StructPattern > from Common.Expression import * > from CommonDataClass.Exceptions import * > from Common.LongFilePathSupport import OpenLongFilePath as open > from collections import defaultdict > from .MetaFileTable import MetaFileStorage >@@ -1610,12 +1610,12 @@ class DscParser(MetaFileParser): > return > > ValList, Valid, Index =3D AnalyzeDscPcd(self._ValueList[2], self.= _ItemType) > if not Valid: > if self._ItemType in (MODEL_PCD_DYNAMIC_DEFAULT, >MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, >MODEL_PCD_PATCHABLE_IN_MODULE): >- if ValList[1] !=3D TAB_VOID and ValList[2]: >- EdkLogger.error('build', FORMAT_INVALID, "Pcd format = incorrect. >Only VOID* type PCD need the maxsize info.", File=3Dself._FileWithError, >+ if ValList[1] !=3D TAB_VOID and StructPattern.match(ValLi= st[1]) is None >and ValList[2]: >+ EdkLogger.error('build', FORMAT_INVALID, "Pcd format = incorrect. >The datum type info should be VOID* or a valid struct name.", >File=3Dself._FileWithError, > Line=3Dself._LineIndex + 1, ExtraData= =3D"%s.%s|%s" % >(self._ValueList[0], self._ValueList[1], self._ValueList[2])) > EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrec= t.", >File=3Dself._FileWithError, Line=3Dself._LineIndex + 1, > ExtraData=3D"%s.%s|%s" % (self._ValueList[0],= self._ValueList[1], >self._ValueList[2])) > PcdValue =3D ValList[Index] > if PcdValue and "." not in self._ValueList[0]: >-- >2.6.1.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel