From 2bcc713e74b944bb5aefb433ef33fb4002a62d76 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Fri, 25 Nov 2011 06:21:03 +0000 Subject: Sync BaseTool trunk (version r2423) into EDKII BaseTools. The change mainly includes: 1. Fix !include issues 2. Fix Trim to skip the postfix 'U' for hexadecimal and decimal numbers 3. Fix building error C2733 when building C++ code. 4. Add GCC46 tool chain definition 5. Add new RVCT and RVCTLINUX tool chains Signed-off-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12782 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/Trim/Trim.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'BaseTools/Source/Python/Trim') diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py index c5e9ee2f0d..34f6284a87 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -37,7 +37,9 @@ gTypedefPattern = re.compile("^\s*typedef\s+struct(\s+\w+)?\s*[{]*$", re.MULTILI ## Regular expression for matching "#pragma pack" gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE) ## Regular expression for matching HEX number -gHexNumberPattern = re.compile("0[xX]([0-9a-fA-F]+)") +gHexNumberPattern = re.compile("(0[xX])([0-9a-fA-F]+)U?") +## Regular expression for matching decimal number with 'U' postfix +gDecNumberPattern = re.compile("([0-9]+)U") ## Regular expression for matching "Include ()" in asl file gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE) ## Regular expression for matching C style #include "XXX.asl" in asl file @@ -169,10 +171,15 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong): # convert HEX number format if indicated if ConvertHex: - Line = gHexNumberPattern.sub(r"0\1h", Line) + Line = gHexNumberPattern.sub(r"0\2h", Line) + else: + Line = gHexNumberPattern.sub(r"\1\2", Line) if TrimLong: Line = gLongNumberPattern.sub(r"\1", Line) + # convert Decimal number format + Line = gDecNumberPattern.sub(r"\1", Line) + if LineNumber != None: EdkLogger.verbose("Got line directive: line=%d" % LineNumber) # in case preprocessor removed some lines, like blank or comment lines -- cgit v1.2.3