Sync BaseTools Trunk (version r2518) to EDKII main trunk.
Signed-off-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13178 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -13,4 +13,4 @@
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
gBUILD_VERSION = "Build 2474"
|
||||
gBUILD_VERSION = "Build 2518"
|
||||
|
@@ -29,6 +29,7 @@ TAB_OPTION_START = '<'
|
||||
TAB_OPTION_END = '>'
|
||||
TAB_SLASH = '\\'
|
||||
TAB_BACK_SLASH = '/'
|
||||
TAB_LINE_BREAK = '\n'
|
||||
|
||||
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
|
||||
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
|
||||
@@ -421,3 +422,11 @@ TAB_DEPENDENCY_EXPRESSION_FILE = "DEPENDENCY-EXPRESSION-FILE"
|
||||
TAB_UNKNOWN_FILE = "UNKNOWN-TYPE-FILE"
|
||||
TAB_DEFAULT_BINARY_FILE = "_BINARY_FILE_"
|
||||
|
||||
# used by BRG
|
||||
TAB_BRG_PCD = 'PCD'
|
||||
TAB_BRG_LIBRARY = 'Library'
|
||||
|
||||
#
|
||||
# Build Rule File Version Definition
|
||||
#
|
||||
TAB_BUILD_RULE_VERSION = "build_rule_version"
|
||||
|
@@ -36,6 +36,7 @@ ERR_STRING_CMP = 'Unicode string and general string cannot be compared:
|
||||
ERR_ARRAY_TOKEN = 'Bad C array or C format GUID token: [%s].'
|
||||
ERR_ARRAY_ELE = 'This must be HEX value for NList or Array: [%s].'
|
||||
ERR_EMPTY_EXPR = 'Empty expression is not allowed.'
|
||||
ERR_IN_OPERAND = 'Macro after IN operator can only be: $(FAMILY), $(ARCH), $(TOOL_CHAIN_TAG) and $(TARGET).'
|
||||
|
||||
## SplitString
|
||||
# Split string to list according double quote
|
||||
@@ -88,22 +89,29 @@ def ReplaceExprMacro(String, Macros, ExceptionList = None):
|
||||
# If an undefined macro name appears in the constant-expression of
|
||||
# !if or !elif, it is replaced by the integer constant 0.
|
||||
RetStr += '0'
|
||||
elif not InQuote and ExceptionList and Macro in ExceptionList:
|
||||
elif not InQuote:
|
||||
Tklst = RetStr.split()
|
||||
if Tklst and Tklst[-1] in ['IN', 'in'] and ExceptionList and Macro not in ExceptionList:
|
||||
raise BadExpression(ERR_IN_OPERAND)
|
||||
# Make sure the macro in exception list is encapsulated by double quote
|
||||
# For example: DEFINE ARCH = IA32 X64
|
||||
# $(ARCH) is replaced with "IA32 X64"
|
||||
RetStr += '"' + Macros[Macro] + '"'
|
||||
else:
|
||||
if Macros[Macro].strip() != "":
|
||||
if ExceptionList and Macro in ExceptionList:
|
||||
RetStr += '"' + Macros[Macro] + '"'
|
||||
elif Macros[Macro].strip():
|
||||
RetStr += Macros[Macro]
|
||||
else:
|
||||
RetStr += '""'
|
||||
else:
|
||||
RetStr += Macros[Macro]
|
||||
RetStr += String[MacroEndPos+1:]
|
||||
String = RetStr
|
||||
MacroStartPos = String.find('$(')
|
||||
StrList[i] = RetStr
|
||||
return ''.join(StrList)
|
||||
|
||||
SupportedInMacroList = ['TARGET', 'TOOL_CHAIN_TAG', 'ARCH', 'FAMILY']
|
||||
|
||||
class ValueExpression(object):
|
||||
# Logical operator mapping
|
||||
LogicalOperators = {
|
||||
@@ -213,7 +221,7 @@ class ValueExpression(object):
|
||||
|
||||
self._Expr = ReplaceExprMacro(Expression.strip(),
|
||||
SymbolTable,
|
||||
['TARGET', 'TOOL_CHAIN_TAG', 'ARCH'])
|
||||
SupportedInMacroList)
|
||||
|
||||
if not self._Expr.strip():
|
||||
raise BadExpression(ERR_EMPTY_EXPR)
|
||||
@@ -457,7 +465,9 @@ class ValueExpression(object):
|
||||
# PCD token
|
||||
if self.PcdPattern.match(self._Token):
|
||||
if self._Token not in self._Symb:
|
||||
raise BadExpression(ERR_PCD_RESOLVE % self._Token)
|
||||
Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
|
||||
Ex.Pcd = self._Token
|
||||
raise Ex
|
||||
self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True)
|
||||
if type(self._Token) != type(''):
|
||||
self._LiteralToken = hex(self._Token)
|
||||
|
@@ -26,6 +26,10 @@ gAllFiles = None
|
||||
|
||||
gGlobalDefines = {}
|
||||
gPlatformDefines = {}
|
||||
# PCD name and value pair for fixed at build and feature flag
|
||||
gPlatformPcds = {}
|
||||
# PCDs with type that are not fixed at build and feature flag
|
||||
gPlatformOtherPcds = {}
|
||||
gActivePlatform = None
|
||||
gCommandLineDefines = {}
|
||||
gEdkGlobal = {}
|
||||
|
@@ -319,7 +319,7 @@ def NormPath(Path, Defines={}):
|
||||
#
|
||||
# @retval Path Formatted path
|
||||
#
|
||||
def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
|
||||
def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False, BuildOption=False):
|
||||
#
|
||||
# remove whitespace
|
||||
#
|
||||
@@ -343,7 +343,7 @@ def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyle
|
||||
Line = Line[0: Index]
|
||||
break
|
||||
|
||||
if CommentInString:
|
||||
if CommentInString and BuildOption:
|
||||
Line = Line.replace('"', '')
|
||||
ChIndex = Line.find('#')
|
||||
while ChIndex >= 0:
|
||||
|
Reference in New Issue
Block a user