Sync BaseTools Branch (version r2362) to EDKII main trunk.
Signed-off-by: lgao4 Reviewed-by: jsu1 Reviewed-by: ydliu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12525 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -895,21 +895,28 @@ class DscParser(MetaFileParser):
|
||||
# three operands
|
||||
elif TokenNumber == 3:
|
||||
TokenValue = TokenList[0]
|
||||
if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
|
||||
TokenValue = TokenValue[1:-1]
|
||||
if TokenValue.startswith("$(") and TokenValue.endswith(")"):
|
||||
TokenValue = self._EvaluateToken(TokenValue, Expression)
|
||||
if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
|
||||
TokenValue = TokenValue[1:-1]
|
||||
if TokenValue == None:
|
||||
return False
|
||||
if TokenValue != "":
|
||||
if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
|
||||
TokenValue = TokenValue[1:-1]
|
||||
if TokenValue.startswith("$(") and TokenValue.endswith(")"):
|
||||
TokenValue = self._EvaluateToken(TokenValue, Expression)
|
||||
if TokenValue == None:
|
||||
return False
|
||||
if TokenValue != "":
|
||||
if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
|
||||
TokenValue = TokenValue[1:-1]
|
||||
|
||||
Value = TokenList[2]
|
||||
if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
|
||||
Value = Value[1:-1]
|
||||
if Value.startswith("$(") and Value.endswith(")"):
|
||||
Value = self._EvaluateToken(Value, Expression)
|
||||
if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
|
||||
Value = Value[1:-1]
|
||||
if Value != "":
|
||||
if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
|
||||
Value = Value[1:-1]
|
||||
if Value.startswith("$(") and Value.endswith(")"):
|
||||
Value = self._EvaluateToken(Value, Expression)
|
||||
if Value == None:
|
||||
return False
|
||||
if Value != "":
|
||||
if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
|
||||
Value = Value[1:-1]
|
||||
Op = TokenList[1]
|
||||
if Op not in self._OP_:
|
||||
EdkLogger.error('Parser', FORMAT_INVALID, "Unsupported operator [%s]" % Op, File=self.MetaFile,
|
||||
|
@ -1896,7 +1896,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
## Retrieve PCDs used in this module
|
||||
def _GetPcds(self):
|
||||
if self._Pcds == None:
|
||||
self._Pcds = {}
|
||||
self._Pcds = sdict()
|
||||
self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))
|
||||
self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))
|
||||
self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))
|
||||
@ -1996,7 +1996,7 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
|
||||
## Retrieve PCD for given type
|
||||
def _GetPcd(self, Type):
|
||||
Pcds = {}
|
||||
Pcds = sdict()
|
||||
PcdDict = tdict(True, 4)
|
||||
PcdList = []
|
||||
RecordList = self._RawData[Type, self._Arch, self._Platform]
|
||||
@ -2071,18 +2071,9 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
#
|
||||
# Check hexadecimal token value length and format.
|
||||
#
|
||||
ReIsValidPcdTokenValue = re.compile(r"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re.DOTALL)
|
||||
if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"):
|
||||
if len(Pcd.TokenValue) < 3 or len(Pcd.TokenValue) > 10:
|
||||
EdkLogger.error(
|
||||
'build',
|
||||
FORMAT_INVALID,
|
||||
"The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
|
||||
File =self.MetaFile, Line=LineNo,
|
||||
ExtraData=None
|
||||
)
|
||||
try:
|
||||
int (Pcd.TokenValue, 16)
|
||||
except:
|
||||
if ReIsValidPcdTokenValue.match(Pcd.TokenValue) == None:
|
||||
EdkLogger.error(
|
||||
'build',
|
||||
FORMAT_INVALID,
|
||||
|
Reference in New Issue
Block a user