summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Trim
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-25 06:21:03 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-25 06:21:03 +0000
commit2bcc713e74b944bb5aefb433ef33fb4002a62d76 (patch)
tree7aa002279415c1fafbedbf287d256177746e0a4a /BaseTools/Source/Python/Trim
parentc32dcd284c19bbb0b1db3606a243d9d69d37d6ab (diff)
downloadedk2-platforms-2bcc713e74b944bb5aefb433ef33fb4002a62d76.tar.xz
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
Diffstat (limited to 'BaseTools/Source/Python/Trim')
-rw-r--r--BaseTools/Source/Python/Trim/Trim.py11
1 files changed, 9 insertions, 2 deletions
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