BaseTools:Define Macro in Inf file, the pcdvalue Can't convert

Define Macro in Inf file, the pcdvalue Can't convert

in dec:
gUefiOvmfPkgGuid.test1|"ddd"|VOID*|0x3c
in inf:
DEFINE ABC=PATH
gUefiOvmfPkgTokenSpaceGuid.test1|$(ABC)

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Fan, ZhijuX 2019-01-25 16:52:32 +08:00 committed by Feng, Bob C
parent 42bd17508e
commit 51f5233385
1 changed files with 6 additions and 2 deletions

View File

@ -757,9 +757,13 @@ class InfParser(MetaFileParser):
if self._ValueList[2] != '': if self._ValueList[2] != '':
InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1) InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
if InfPcdValueList[0] in ['True', 'true', 'TRUE']: if InfPcdValueList[0] in ['True', 'true', 'TRUE']:
self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1); self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1)
elif InfPcdValueList[0] in ['False', 'false', 'FALSE']: elif InfPcdValueList[0] in ['False', 'false', 'FALSE']:
self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1); self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1)
elif isinstance(InfPcdValueList[0], str) and InfPcdValueList[0].find('$(') >= 0:
Value = ReplaceExprMacro(InfPcdValueList[0],self._Macros)
if Value != '0':
self._ValueList[2] = Value
if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict: if (self._ValueList[0], self._ValueList[1]) not in self.PcdsDict:
self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType self.PcdsDict[self._ValueList[0], self._ValueList[1]] = self._SectionType
elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType: elif self.PcdsDict[self._ValueList[0], self._ValueList[1]] != self._SectionType: