public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] BaseTools: Support to use struct name as datum type before max size
Date: Tue, 16 Oct 2018 00:36:43 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E33A6E9@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1539609765-7964-1-git-send-email-yonghong.zhu@intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----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 type
>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 <yonghong.zhu@intel.com>
>---
> 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 = re.compile("^Start[' ']+Length['
>']+Name[' ']+Class")
> addressPatternGeneral = re.compile("^Address[' ']+Publics by Value['
>']+Rva\+Base")
> valuePatternGcc = re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$')
> pcdPatternGcc = re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)')
> secReGeneral = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]?
>+([.\w\$]+) +(\w+)', re.UNICODE)
>
>+StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$')
>+
> ## Dictionary used to store file time stamp for quick re-access
> gFileTimeStampCache = {}    # {file path : file time stamp}
>
> ## Dictionary used to store dependencies of files
> gDependencyDatabase = {}    # arch : {file path : [dependent files list]}
>@@ -1461,11 +1463,11 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
>     if PcdType in (MODEL_PCD_FIXED_AT_BUILD,
>MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT,
>MODEL_PCD_DYNAMIC_EX_DEFAULT):
>         Value = FieldList[0]
>         Size = ''
>         if len(FieldList) > 1 and FieldList[1]:
>             DataType = FieldList[1]
>-            if FieldList[1] != TAB_VOID:
>+            if FieldList[1] != TAB_VOID and StructPattern.match(FieldList[1]) is
>None:
>                 IsValid = False
>         if len(FieldList) > 2:
>             Size = FieldList[2]
>         if IsValid:
>             if DataType == "":
>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 = 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] != TAB_VOID and ValList[2]:
>-                    EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.
>Only VOID* type PCD need the maxsize info.", File=self._FileWithError,
>+                if ValList[1] != TAB_VOID and StructPattern.match(ValList[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=self._FileWithError,
>                                     Line=self._LineIndex + 1, ExtraData="%s.%s|%s" %
>(self._ValueList[0], self._ValueList[1], self._ValueList[2]))
>             EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.",
>File=self._FileWithError, Line=self._LineIndex + 1,
>                             ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1],
>self._ValueList[2]))
>         PcdValue = 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


      reply	other threads:[~2018-10-16  0:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15 13:22 [Patch] BaseTools: Support to use struct name as datum type before max size Yonghong Zhu
2018-10-16  0:36 ` Gao, Liming [this message]

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=4A89E2EF3DFEDB4C8BFDE51014F606A14E33A6E9@SHSMSX104.ccr.corp.intel.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