From nobody Sun May 5 02:11:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522794853962459.3976771573963; Tue, 3 Apr 2018 15:34:13 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B639A225501EA; Tue, 3 Apr 2018 15:34:12 -0700 (PDT) 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 13A9D2035BA1F for ; Tue, 3 Apr 2018 15:34:11 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 15:34:09 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 03 Apr 2018 15:34:09 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,403,1517904000"; d="scan'208";a="44656101" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 15:34:02 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 1/5] BaseTools: Autogen - move RegEx compile X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" compile each RegEx once not in loops/functions Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 3384fdb70b7e..7dd7c35e6685 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -49,6 +49,16 @@ from GenVar import VariableMgr,var_info ## Regular expression for splitting Dependency Expression string into toke= ns gDepexTokenPattern =3D re.compile("(\(|\)|\w+| \S+\.inf)") =20 +## Regular expression for match: PCD(xxxx.yyy) +gPCDAsGuidPattern =3D re.compile(r"^PCD\(.+\..+\)$") + +# +# Regular expression for finding Include Directories, the difference betwe= en MSFT and INTEL/GCC/RVCT +# is the former use /I , the Latter used -I to specify include directories +# +gBuildOptIncludePatternMsft =3D re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.M= ULTILINE | re.DOTALL) +gBuildOptIncludePatternOther =3D re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.= MULTILINE | re.DOTALL) + # # Match name =3D variable # @@ -818,13 +828,11 @@ class WorkspaceAutoGen(AutoGen): InfFoundFlag =3D False =20 if FfsFile.NameGuid is not None: - _CheckPCDAsGuidPattern =3D re.compile("^PCD\(.+\..+\)$= ") - # # If the NameGuid reference a PCD name.=20 # The style must match: PCD(xxxx.yyy) # - if _CheckPCDAsGuidPattern.match(FfsFile.NameGuid): + if gPCDAsGuidPattern.match(FfsFile.NameGuid): # # Replace the PCD value. # @@ -3315,9 +3323,9 @@ class ModuleAutoGen(AutoGen): # is the former use /I , the Latter used -I to specify include= directories # if self.PlatformInfo.ToolChainFamily in ('MSFT'): - gBuildOptIncludePattern =3D re.compile(r"(?:.*?)/I[ \t]*([= ^ ]*)", re.MULTILINE | re.DOTALL) + BuildOptIncludeRegEx =3D gBuildOptIncludePatternMsft elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RV= CT'): - gBuildOptIncludePattern =3D re.compile(r"(?:.*?)-I[ \t]*([= ^ ]*)", re.MULTILINE | re.DOTALL) + BuildOptIncludeRegEx =3D gBuildOptIncludePatternOther else: # # New ToolChainFamily, don't known whether there is option= to specify include directories @@ -3334,13 +3342,13 @@ class ModuleAutoGen(AutoGen): FlagOption =3D '' =20 if self.PlatformInfo.ToolChainFamily !=3D 'RVCT': - IncPathList =3D [NormPath(Path, self.Macros) for Path = in gBuildOptIncludePattern.findall(FlagOption)] + IncPathList =3D [NormPath(Path, self.Macros) for Path = in BuildOptIncludeRegEx.findall(FlagOption)] else: # # RVCT may specify a list of directory seperated by co= mmas # IncPathList =3D [] - for Path in gBuildOptIncludePattern.findall(FlagOption= ): + for Path in BuildOptIncludeRegEx.findall(FlagOption): PathList =3D GetSplitList(Path, TAB_COMMA_SPLIT) IncPathList +=3D [NormPath(PathEntry, self.Macros)= for PathEntry in PathList] =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 02:11:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522794856720473.83086999269074; Tue, 3 Apr 2018 15:34:16 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E0E04225F321F; Tue, 3 Apr 2018 15:34:12 -0700 (PDT) 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 35940226C7C39 for ; Tue, 3 Apr 2018 15:34:11 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 15:34:10 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 03 Apr 2018 15:34:09 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,403,1517904000"; d="scan'208";a="44656104" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 15:34:03 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 2/5] BaseTools: GenFds - move RegEx compile X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" compile each RegEx once not in loops/functions Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/GenFds/FdfParser.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 9b7e898570a3..00e03446421d 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -85,6 +85,7 @@ RegionSizePattern =3D re.compile("\s*(?P(?:0x|0X)?[= a-fA-F0-9]+)\s*\|\s*(?P\w+\.\w+)\s*\|\s*(?P\w+\.\w+)\s*") RegionOffsetPcdPattern =3D re.compile("\s*(?P\w+\.\w+)\s*$") ShortcutPcdPattern =3D re.compile("\s*\w+\s*=3D\s*(?P(?:0x|0X)?[a-f= A-F0-9]+)\s*\|\s*(?P\w+\.\w+)\s*") +BaseAddrValuePattern =3D re.compile('^0[xX][0-9a-fA-F]+') =20 AllIncludeFileList =3D [] =20 @@ -2211,9 +2212,7 @@ class FdfParser: if not self.__GetNextToken(): raise Warning("expected FV base address value", self.FileName,= self.CurrentLineNumber) =20 - IsValidBaseAddrValue =3D re.compile('^0[x|X][0-9a-fA-F]+') - - if not IsValidBaseAddrValue.match(self.__Token.upper()): + if not BaseAddrValuePattern.match(self.__Token.upper()): raise Warning("Unknown FV base address value '%s'" % self.__To= ken, self.FileName, self.CurrentLineNumber) Obj.FvBaseAddress =3D self.__Token return True =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 02:11:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522794859076703.3555144679799; Tue, 3 Apr 2018 15:34:19 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 14552226085B0; Tue, 3 Apr 2018 15:34:13 -0700 (PDT) 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 537D32035BA1F for ; Tue, 3 Apr 2018 15:34:11 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 15:34:10 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 03 Apr 2018 15:34:09 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,403,1517904000"; d="scan'208";a="44656108" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 15:34:04 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 3/5] BaseTools: Add new RegEx pattern to GlobalData X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/GlobalData.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index fab67601a9e5..f58dc5a8dda2 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -63,6 +63,9 @@ gGuidPatternEnd =3D re.compile(r'{}$'.format(_GuidPattern= )) g4HexChar =3D re.compile(r'{}{{4}}'.format(_HexChar)) gHexPattern =3D re.compile(r'0[xX]{}+'.format(_HexChar)) =20 +## Regular expressions for string identifier checking +gIdentifierPattern =3D re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE) + # # A global variable for whether current build in AutoGen phase or not. # --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 02:11:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1522794861656509.1878473142408; Tue, 3 Apr 2018 15:34:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 416C7226085B9; Tue, 3 Apr 2018 15:34:13 -0700 (PDT) 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 5F08121E08168 for ; Tue, 3 Apr 2018 15:34:11 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 15:34:10 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 03 Apr 2018 15:34:09 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,403,1517904000"; d="scan'208";a="44656111" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 15:34:05 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 4/5] BaseTools: AutoGen - use the new shared RegEx X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/IdfClassObject.py | 3 ++- BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/IdfClassObject.py b/BaseTools/= Source/Python/AutoGen/IdfClassObject.py index cb72219b40d5..a028aceee927 100644 --- a/BaseTools/Source/Python/AutoGen/IdfClassObject.py +++ b/BaseTools/Source/Python/AutoGen/IdfClassObject.py @@ -21,6 +21,7 @@ from Common.Misc import PathClass from Common.LongFilePathSupport import LongFilePath import re import os +from Common.GlobalData import gIdentifierPattern =20 IMAGE_TOKEN =3D re.compile('IMAGE_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE= | re.UNICODE) =20 @@ -105,7 +106,7 @@ class IdfFileClassObject(object): EdkLogger.error("Image Definition File Parser", PARSER= _ERROR, 'The format is not match #image IMAGE_ID [TRANSPARENT] ImageFileNam= e in Line %s of File %s.' % (LineNo, File.Path)) if Len =3D=3D 4 and LineDetails[2] !=3D 'TRANSPARENT': EdkLogger.error("Image Definition File Parser", PARSER= _ERROR, 'Please use the keyword "TRANSPARENT" to describe the transparency = setting in Line %s of File %s.' % (LineNo, File.Path)) - MatchString =3D re.match('^[a-zA-Z][a-zA-Z0-9_]*$', LineDe= tails[1], re.UNICODE) + MatchString =3D gIdentifierPattern.match(LineDetails[1]) if MatchString is None or MatchString.end(0) !=3D len(Line= Details[1]): EdkLogger.error('Image Definition File Parser', FORMA= T_INVALID, 'The Image token name %s defined in Idf file %s contains the inv= alid character.' % (LineDetails[1], File.Path)) if LineDetails[1] not in self.ImageIDList: diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/= Source/Python/AutoGen/UniClassObject.py index 242402dfaeeb..8b0c563a8c88 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -351,7 +351,7 @@ class UniFileClassObject(object): Name =3D Item.split()[1] # Check the string name if Name !=3D '': - MatchString =3D re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.U= NICODE) + MatchString =3D gIdentifierPattern.match(Name) if MatchString is None or MatchString.end(0) !=3D len(Name): EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'Th= e string token name %s defined in UNI file %s contains the invalid characte= r.' % (Name, self.File)) LanguageList =3D Item.split(u'#language ') @@ -521,7 +521,7 @@ class UniFileClassObject(object): Language =3D GetLanguageCode(Language, self.IsCompatibleMo= de, self.File) # Check the string name if not self.IsCompatibleMode and Name !=3D '': - MatchString =3D re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Na= me, re.UNICODE) + MatchString =3D gIdentifierPattern.match(Name) if MatchString is None or MatchString.end(0) !=3D len(= Name): EdkLogger.error('Unicode File Parser', FORMAT_INVA= LID, 'The string token name %s defined in UNI file %s contains the invalid = character.' % (Name, self.File)) self.AddStringToList(Name, Language, Value) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 02:11:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152279486441855.44185971942511; Tue, 3 Apr 2018 15:34:24 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6BC86226085BF; Tue, 3 Apr 2018 15:34:13 -0700 (PDT) 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 73F53224A9EAE for ; Tue, 3 Apr 2018 15:34:11 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 15:34:10 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 03 Apr 2018 15:34:09 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,403,1517904000"; d="scan'208";a="44656113" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 3 Apr 2018 15:34:06 -0700 Message-Id: <82688ac8bacbc1a1d2fbfade3d48d6934fb6b03d.1522794781.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 5/5] BaseTools: remove redundant check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The RegEx matches begining and end of the string, dont then check length. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/IdfClassObject.py | 2 +- BaseTools/Source/Python/AutoGen/UniClassObject.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/IdfClassObject.py b/BaseTools/= Source/Python/AutoGen/IdfClassObject.py index a028aceee927..6953854a5247 100644 --- a/BaseTools/Source/Python/AutoGen/IdfClassObject.py +++ b/BaseTools/Source/Python/AutoGen/IdfClassObject.py @@ -107,7 +107,7 @@ class IdfFileClassObject(object): if Len =3D=3D 4 and LineDetails[2] !=3D 'TRANSPARENT': EdkLogger.error("Image Definition File Parser", PARSER= _ERROR, 'Please use the keyword "TRANSPARENT" to describe the transparency = setting in Line %s of File %s.' % (LineNo, File.Path)) MatchString =3D gIdentifierPattern.match(LineDetails[1]) - if MatchString is None or MatchString.end(0) !=3D len(Line= Details[1]): + if MatchString is None: EdkLogger.error('Image Definition File Parser', FORMA= T_INVALID, 'The Image token name %s defined in Idf file %s contains the inv= alid character.' % (LineDetails[1], File.Path)) if LineDetails[1] not in self.ImageIDList: self.ImageIDList.append(LineDetails[1]) diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/= Source/Python/AutoGen/UniClassObject.py index 8b0c563a8c88..5b879d784d9c 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -352,7 +352,7 @@ class UniFileClassObject(object): # Check the string name if Name !=3D '': MatchString =3D gIdentifierPattern.match(Name) - if MatchString is None or MatchString.end(0) !=3D len(Name): + if MatchString is None: EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'Th= e string token name %s defined in UNI file %s contains the invalid characte= r.' % (Name, self.File)) LanguageList =3D Item.split(u'#language ') for IndexI in range(len(LanguageList)): @@ -522,7 +522,7 @@ class UniFileClassObject(object): # Check the string name if not self.IsCompatibleMode and Name !=3D '': MatchString =3D gIdentifierPattern.match(Name) - if MatchString is None or MatchString.end(0) !=3D len(= Name): + if MatchString is None: EdkLogger.error('Unicode File Parser', FORMAT_INVA= LID, 'The string token name %s defined in UNI file %s contains the invalid = character.' % (Name, self.File)) self.AddStringToList(Name, Language, Value) continue --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel