From nobody Sun Apr 28 07:43:20 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 1519645792842626.712219193376; Mon, 26 Feb 2018 03:49:52 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AEF8021F6A6D0; Mon, 26 Feb 2018 03:38:42 -0800 (PST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 CC74921F6A6CA for ; Mon, 26 Feb 2018 03:38:40 -0800 (PST) Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 03:44:45 -0800 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga007.jf.intel.com with ESMTP; 26 Feb 2018 03:44:44 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 26 Feb 2018 03:44:43 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Mon, 26 Feb 2018 19:44:41 +0800 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.136; helo=mga12.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,396,1515484800"; d="dat'59?scan'59,208,59";a="20350793" From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Fix flexible PCD single quote and double quote bugs Thread-Index: AdOu9y/gnRsJcQr5TXSozSJHp3dE8Q== Date: Mon, 26 Feb 2018 11:44:41 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC482B48C@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC482B48C@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: [edk2] [PATCH] BaseTools: Fix flexible PCD single quote and double quote bugs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gao, Liming" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 1. Argument --pcd format as below: Some examples that to match --pcd format and DSC format --pcd DSC format L"ABC" L"ABC" "AB\\\"C" "AB\"C" "AB\tC" "AB\tC" "AB\\\'C" "AB\'C" "\'ABC\'" 'ABC=C3=A2=E2=82=AC=E2=84=A2 L"\'AB\\\"C\'" L'AB\"C' "\'AB\\\'C\'" 'AB\'C' "\'AB\tC\'" 'AB\tC' H"{0, L\"AB\\\"B\", \'ab\\\"c\'}" {0, L"AB\"B", 'ab\"c'} H"{0, L\"AB\\\"B\",\'ab\\\'c\'}" {0, L"AB\"B", 'ab\'c'} 2. {'#', '|'} split string incorrectly. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/AutoGen/GenMake.py | 20 +++++--- BaseTools/Source/Python/Common/Expression.py | 60 ++++++++++++++++---= ---- BaseTools/Source/Python/Common/Misc.py | 31 +++++++----- BaseTools/Source/Python/Common/String.py | 33 ++++++++----- BaseTools/Source/Python/Workspace/DscBuildData.py | 37 +++++++------- 5 files changed, 115 insertions(+), 66 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index afe6f2f99c..4b924d21e0 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1553,17 +1553,23 @@ class TopLevelMakefile(BuildFile): =20 if GlobalData.BuildOptionPcd: for index, option in enumerate(GlobalData.gCommand): if "--pcd" =3D=3D option and GlobalData.gCommand[index+1]: pcdName, pcdValue =3D GlobalData.gCommand[index+1].spl= it('=3D') - if pcdValue.startswith('H'): - pcdValue =3D 'H' + '"' + pcdValue[1:] + '"' - ExtraOption +=3D " --pcd " + pcdName + '=3D' + pcd= Value - elif pcdValue.startswith("L'"): - ExtraOption +=3D "--pcd " + pcdName + '=3D' + pcdV= alue - elif pcdValue.startswith('L'): - pcdValue =3D 'L' + '"' + pcdValue[1:] + '"' + for Item in GlobalData.BuildOptionPcd: + if '.'.join(Item[0:2]) =3D=3D pcdName: + pcdValue =3D Item[2] + if pcdValue.startswith('L') or pcdValue.starts= with('"'): + pcdValue, Size =3D ParseFieldValue(pcdValu= e) + NewVal =3D '{' + for S in range(Size): + NewVal =3D NewVal + '0x%02X' % ((pcdVa= lue >> S * 8) & 0xff) + NewVal +=3D ',' + pcdValue =3D NewVal[:-1] + '}' + break + if pcdValue.startswith('{'): + pcdValue =3D 'H' + '"' + pcdValue + '"' ExtraOption +=3D " --pcd " + pcdName + '=3D' + pcd= Value else: ExtraOption +=3D " --pcd " + GlobalData.gCommand[i= ndex+1] =20 MakefileName =3D self._FILE_NAME_[self._FileType] diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index edb0a60de6..f1516d5c7b 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -43,28 +43,41 @@ ERR_IN_OPERAND =3D 'Macro after IN operator ca= n only be: $(FAMILY), $(ARC ## SplitString # Split string to list according double quote # For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"= jkl"', 'mn'] # def SplitString(String): - # There might be escaped quote: "abc\"def\\\"ghi" - Str =3D String.replace('\\\\', '//').replace('\\\"', '\\\'') + # There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi' + Str =3D String RetList =3D [] - InQuote =3D False + InSingleQuote =3D False + InDoubleQuote =3D False Item =3D '' for i, ch in enumerate(Str): - if ch =3D=3D '"': - InQuote =3D not InQuote - if not InQuote: + if ch =3D=3D '"' and not InSingleQuote: + if Str[i - 1] !=3D '\\': + InDoubleQuote =3D not InDoubleQuote + if not InDoubleQuote: + Item +=3D String[i] + RetList.append(Item) + Item =3D '' + continue + if Item: + RetList.append(Item) + Item =3D '' + elif ch =3D=3D "'" and not InDoubleQuote: + if Str[i - 1] !=3D '\\': + InSingleQuote =3D not InSingleQuote + if not InSingleQuote: Item +=3D String[i] RetList.append(Item) Item =3D '' continue if Item: RetList.append(Item) Item =3D '' Item +=3D String[i] - if InQuote: + if InSingleQuote or InDoubleQuote: raise BadExpression(ERR_STRING_TOKEN % Item) if Item: RetList.append(Item) return RetList =20 @@ -481,17 +494,21 @@ class ValueExpression(object): Radix =3D 16 if self._Token.startswith('"') or self._Token.startswith('L"'): Flag =3D 0 for Index in range(len(self._Token)): if self._Token[Index] in ['"']: + if self._Token[Index - 1] =3D=3D '\\': + continue Flag +=3D 1 if Flag =3D=3D 2 and self._Token.endswith('"'): return True if self._Token.startswith("'") or self._Token.startswith("L'"): Flag =3D 0 for Index in range(len(self._Token)): if self._Token[Index] in ["'"]: + if self._Token[Index - 1] =3D=3D '\\': + continue Flag +=3D 1 if Flag =3D=3D 2 and self._Token.endswith("'"): return True try: self._Token =3D int(self._Token, Radix) @@ -535,20 +552,29 @@ class ValueExpression(object): =20 # Skip left quote self._Idx +=3D 1 =20 # Replace escape \\\", \" - Expr =3D self._Expr[self._Idx:].replace('\\\\', '//').replace('\\\= "', '\\\'') - for Ch in Expr: - self._Idx +=3D 1 - if Ch =3D=3D '"' or Ch =3D=3D "'": - break - self._Token =3D self._LiteralToken =3D self._Expr[Idx:self._Idx] - if self._Token.startswith('"') and not self._Token.endswith('"'): - raise BadExpression(ERR_STRING_TOKEN % self._Token) - if self._Token.startswith("'") and not self._Token.endswith("'"): - raise BadExpression(ERR_STRING_TOKEN % self._Token) + if self._Expr[Idx] =3D=3D '"': + Expr =3D self._Expr[self._Idx:].replace('\\\\', '//').replace(= '\\\"', '\\\'') + for Ch in Expr: + self._Idx +=3D 1 + if Ch =3D=3D '"': + break + self._Token =3D self._LiteralToken =3D self._Expr[Idx:self._Id= x] + if not self._Token.endswith('"'): + raise BadExpression(ERR_STRING_TOKEN % self._Token) + #Replace escape \\\', \' + elif self._Expr[Idx] =3D=3D "'": + Expr =3D self._Expr[self._Idx:].replace('\\\\', '//').replace(= "\\\'", "\\\"") + for Ch in Expr: + self._Idx +=3D 1 + if Ch =3D=3D "'": + break + self._Token =3D self._LiteralToken =3D self._Expr[Idx:self._Id= x] + if not self._Token.endswith("'"): + raise BadExpression(ERR_STRING_TOKEN % self._Token) self._Token =3D self._Token[1:-1] return self._Token =20 # Get token that is comprised by alphanumeric, underscore or dot(used = by PCD) # @param IsAlphaOp: Indicate if parsing general token or script operat= or(EQ, NE...) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 1461d00669..a7e7797d04 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1441,25 +1441,30 @@ def ParseConsoleLog(Filename): Opr.close() Opw.close() =20 def AnalyzePcdExpression(Setting): Setting =3D Setting.strip() - # There might be escaped quote in a string: \", \\\" - Data =3D Setting.replace('\\\\', '//').replace('\\\"', '\\\'') + # There might be escaped quote in a string: \", \\\" , \', \\\' + Data =3D Setting # There might be '|' in string and in ( ... | ... ), replace it with '= -' NewStr =3D '' - InStr =3D False + InSingleQuoteStr =3D False + InDoubleQuoteStr =3D False Pair =3D 0 - for ch in Data: - if ch =3D=3D '"': - InStr =3D not InStr - elif ch =3D=3D '(' and not InStr: + for Index, ch in enumerate(Data): + if ch =3D=3D '"' and not InSingleQuoteStr: + if Data[Index - 1] !=3D '\\': + InDoubleQuoteStr =3D not InDoubleQuoteStr + elif ch =3D=3D "'" and not InDoubleQuoteStr: + if Data[Index - 1] !=3D '\\': + InSingleQuoteStr =3D not InSingleQuoteStr + elif ch =3D=3D '(' and not (InSingleQuoteStr or InDoubleQuoteStr): Pair +=3D 1 - elif ch =3D=3D ')' and not InStr: + elif ch =3D=3D ')' and not (InSingleQuoteStr or InDoubleQuoteStr): Pair -=3D 1 =20 - if (Pair > 0 or InStr) and ch =3D=3D TAB_VALUE_SPLIT: + if (Pair > 0 or InSingleQuoteStr or InDoubleQuoteStr) and ch =3D= =3D TAB_VALUE_SPLIT: NewStr +=3D '-' else: NewStr +=3D ch FieldList =3D [] StartPos =3D 0 @@ -1547,37 +1552,37 @@ def ParseFieldValue (Value): raise BadExpression('%s' % Message) Value, Size =3D ParseFieldValue(Value) return Value, 16 if Value.startswith('L"') and Value.endswith('"'): # Unicode String - List =3D list(Value[2:-1]) + List =3D list(eval(Value[1:])) # translate escape character List.reverse() Value =3D 0 for Char in List: Value =3D (Value << 16) | ord(Char) return Value, (len(List) + 1) * 2 if Value.startswith('"') and Value.endswith('"'): # ASCII String - List =3D list(Value[1:-1]) + List =3D list(eval(Value)) # translate escape character List.reverse() Value =3D 0 for Char in List: Value =3D (Value << 8) | ord(Char) return Value, len(List) + 1 if Value.startswith("L'") and Value.endswith("'"): # Unicode Character Constant - List =3D list(Value[2:-1]) + List =3D list(eval(Value[1:])) # translate escape character if len(List) =3D=3D 0: raise BadExpression('Length %s is %s' % (Value, len(List))) List.reverse() Value =3D 0 for Char in List: Value =3D (Value << 16) | ord(Char) return Value, len(List) * 2 if Value.startswith("'") and Value.endswith("'"): # Character constant - List =3D list(Value[1:-1]) + List =3D list(eval(Value)) # translate escape character if len(List) =3D=3D 0: raise BadExpression('Length %s is %s' % (Value, len(List))) List.reverse() Value =3D 0 for Char in List: diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Py= thon/Common/String.py index 4a8c03e88e..bf36783f8f 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -43,30 +43,36 @@ gHumanReadableVerPatt =3D re.compile(r'([1-9][0-9]*|0)\= .[0-9]{1,2}$') # def GetSplitValueList(String, SplitTag=3DDataType.TAB_VALUE_SPLIT, MaxSpli= t=3D -1): ValueList =3D [] Last =3D 0 Escaped =3D False - InString =3D False + InSingleQuoteString =3D False + InDoubleQuoteString =3D False InParenthesis =3D 0 for Index in range(0, len(String)): Char =3D String[Index] =20 if not Escaped: # Found a splitter not in a string, split it - if not InString and InParenthesis =3D=3D 0 and Char =3D=3D Spl= itTag: + if (not InSingleQuoteString or not InDoubleQuoteString) and In= Parenthesis =3D=3D 0 and Char =3D=3D SplitTag: ValueList.append(String[Last:Index].strip()) Last =3D Index + 1 if MaxSplit > 0 and len(ValueList) >=3D MaxSplit: break =20 - if Char =3D=3D '\\' and InString: + if Char =3D=3D '\\' and (InSingleQuoteString or InDoubleQuoteS= tring): Escaped =3D True - elif Char =3D=3D '"': - if not InString: - InString =3D True + elif Char =3D=3D '"' and not InSingleQuoteString: + if not InDoubleQuoteString: + InDoubleQuoteString =3D True + else: + InDoubleQuoteString =3D False + elif Char =3D=3D "'" and not InDoubleQuoteString: + if not InSingleQuoteString: + InSingleQuoteString =3D True else: - InString =3D False + InSingleQuoteString =3D False elif Char =3D=3D '(': InParenthesis =3D InParenthesis + 1 elif Char =3D=3D ')': InParenthesis =3D InParenthesis - 1 else: @@ -400,19 +406,22 @@ def CleanString2(Line, CommentCharacter=3DDataType.TA= B_COMMENT_SPLIT, AllowCppStyl if AllowCppStyleComment: Line =3D Line.replace(DataType.TAB_COMMENT_EDK_SPLIT, CommentChara= cter) # # separate comments and statements, but we should escape comment chara= cter in string # - InString =3D False + InDoubleQuoteString =3D False + InSingleQuoteString =3D False CommentInString =3D False Comment =3D '' for Index in range(0, len(Line)): - if Line[Index] =3D=3D '"': - InString =3D not InString - elif Line[Index] =3D=3D CommentCharacter and InString: + if Line[Index] =3D=3D '"' and not InSingleQuoteString: + InDoubleQuoteString =3D not InDoubleQuoteString + elif Line[Index] =3D=3D "'" and not InDoubleQuoteString: + InSingleQuoteString =3D not InSingleQuoteString + elif Line[Index] =3D=3D CommentCharacter and (InDoubleQuoteString = or InSingleQuoteString): CommentInString =3D True - elif Line[Index] =3D=3D CommentCharacter and not InString: + elif Line[Index] =3D=3D CommentCharacter and not (InDoubleQuoteStr= ing or InSingleQuoteString): Comment =3D Line[Index:].strip() Line =3D Line[0:Index].strip() break =20 return Line, Comment diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 75b877a5aa..ba3a8b1457 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -989,10 +989,12 @@ class DscBuildData(PlatformBuildClassObject): FoundFlag =3D True if FieldName: NewValue =3D self.GetFieldValueFromComm(pcdvalue, Toke= nSpaceGuidCName, TokenCName, FieldName) GlobalData.BuildOptionPcd[i] =3D (TokenSpaceGuidCName,= TokenCName, FieldName,NewValue,("build command options",1)) else: + # Replace \' to ', \\\' to \' + pcdvalue =3D pcdvalue.replace("\\\\\\'", '\\\\\\"').re= place('\\\'', '\'').replace('\\\\\\"', "\\'") for key in self.DecPcds: PcdItem =3D self.DecPcds[key] if HasTokenSpace: if (PcdItem.TokenCName, PcdItem.TokenSpaceGuid= CName) =3D=3D (TokenCName, TokenSpaceGuidCName): PcdDatumType =3D PcdItem.DatumType @@ -1000,28 +1002,25 @@ class DscBuildData(PlatformBuildClassObject): try: pcdvalue =3D ValueExpressionEx(pcd= value[1:], PcdDatumType, self._GuidDict)(True) except BadExpression, Value: EdkLogger.error('Parser', FORMAT_I= NVALID, 'PCD [%s.%s] Value "%s", %s' % (TokenSpaceGuidCNa= me, TokenCName, pcdvalue, Value)) - if PcdDatumType =3D=3D "VOID*": - pcdvalue =3D 'H' + pcdvalue + pcdvalue =3D 'H' + pcdvalue elif pcdvalue.startswith("L'"): try: pcdvalue =3D ValueExpressionEx(pcd= value, PcdDatumType, self._GuidDict)(True) except BadExpression, Value: EdkLogger.error('Parser', FORMAT_I= NVALID, 'PCD [%s.%s] Value "%s", %s' % (TokenSpaceGuidCNa= me, TokenCName, pcdvalue, Value)) - if pcdvalue.startswith('{'): - pcdvalue =3D 'H' + pcdvalue + pcdvalue =3D 'H' + pcdvalue elif pcdvalue.startswith("'"): try: pcdvalue =3D ValueExpressionEx(pcd= value, PcdDatumType, self._GuidDict)(True) except BadExpression, Value: EdkLogger.error('Parser', FORMAT_I= NVALID, 'PCD [%s.%s] Value "%s", %s' % (TokenSpaceGuidCNa= me, TokenCName, pcdvalue, Value)) - if pcdvalue.startswith('{'): - pcdvalue =3D 'H' + pcdvalue + pcdvalue =3D 'H' + pcdvalue elif pcdvalue.startswith('L'): pcdvalue =3D 'L"' + pcdvalue[1:] + '"' try: pcdvalue =3D ValueExpressionEx(pcd= value, PcdDatumType, self._GuidDict)(True) except BadExpression, Value: @@ -1029,12 +1028,16 @@ class DscBuildData(PlatformBuildClassObject): (TokenSpaceGuidCNa= me, TokenCName, pcdvalue, Value)) else: try: pcdvalue =3D ValueExpressionEx(pcd= value, PcdDatumType, self._GuidDict)(True) except BadExpression, Value: - EdkLogger.error('Parser', FORMAT_I= NVALID, 'PCD [%s.%s] Value "%s", %s' % - (TokenSpaceGuidCNa= me, TokenCName, pcdvalue, Value)) + try: + pcdvalue =3D '"' + pcdvalue + = '"' + pcdvalue =3D ValueExpressionEx= (pcdvalue, PcdDatumType, self._GuidDict)(True) + except BadExpression, Value: + EdkLogger.error('Parser', FORM= AT_INVALID, 'PCD [%s.%s] Value "%s", %s' % + (TokenSpaceGui= dCName, TokenCName, pcdvalue, Value)) NewValue =3D BuildOptionPcdValueFormat(Tok= enSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue) FoundFlag =3D True else: if PcdItem.TokenCName =3D=3D TokenCName: if not PcdItem.TokenSpaceGuidCName in Toke= nSpaceGuidCNameList: @@ -1046,30 +1049,27 @@ class DscBuildData(PlatformBuildClassObject): try: pcdvalue =3D ValueExpressi= onEx(pcdvalue[1:], PcdDatumType, self._GuidDict)(True) except BadExpression, Value: EdkLogger.error('Parser', = FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' % (TokenSpac= eGuidCName, TokenCName, pcdvalue, Value)) - if PcdDatumType =3D=3D "VOID*": - pcdvalue =3D 'H' + pcdvalue + pcdvalue =3D 'H' + pcdvalue elif pcdvalue.startswith("L'"): try: pcdvalue =3D ValueExpressi= onEx(pcdvalue, PcdDatumType, self._GuidDict)( True) except BadExpression, Value: EdkLogger.error('Parser', = FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' % (TokenSpac= eGuidCName, TokenCName, pcdvalue, Value)) - if pcdvalue.startswith('{'): - pcdvalue =3D 'H' + pcdvalue + pcdvalue =3D 'H' + pcdvalue elif pcdvalue.startswith("'"): try: pcdvalue =3D ValueExpressi= onEx(pcdvalue, PcdDatumType, self._GuidDict)( True) except BadExpression, Value: EdkLogger.error('Parser', = FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' % (TokenSpac= eGuidCName, TokenCName, pcdvalue, Value)) - if pcdvalue.startswith('{'): - pcdvalue =3D 'H' + pcdvalue + pcdvalue =3D 'H' + pcdvalue elif pcdvalue.startswith('L'): pcdvalue =3D 'L"' + pcdvalue[1= :] + '"' try: pcdvalue =3D ValueExpressi= onEx(pcdvalue, PcdDatumType, self._GuidDict)( True) @@ -1078,13 +1078,16 @@ class DscBuildData(PlatformBuildClassObject): (TokenSpac= eGuidCName, TokenCName, pcdvalue, Value)) else: try: pcdvalue =3D ValueExpressi= onEx(pcdvalue, PcdDatumType, self._GuidDict)(True) except BadExpression, Value: - EdkLogger.error('Parser', = FORMAT_INVALID, - 'PCD [%s.%= s] Value "%s", %s' % - (TokenSpac= eGuidCName, TokenCName, pcdvalue, Value)) + try: + pcdvalue =3D '"' + pcd= value + '"' + pcdvalue =3D ValueExpr= essionEx(pcdvalue, PcdDatumType, self._GuidDict)(True) + except BadExpression, Valu= e: + EdkLogger.error('Parse= r', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' % + (Token= SpaceGuidCName, TokenCName, pcdvalue, Value)) NewValue =3D BuildOptionPcdValueFo= rmat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue) FoundFlag =3D True else: EdkLogger.error( 'build', --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel