Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions BaseTools/Source/Python/Trim/Trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
gAslIncludePattern = re.compile(r"^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE)
## Regular expression for matching C style #include "XXX.asl" in asl file
gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*([>"])', re.MULTILINE)
# MU_CHANGE [BEGIN] - Handle pragma once in ASL
## Regular expression for matching "#pragma once"
gPragmaOncePattern = re.compile(r"^\s*#\s*pragma\s+once\b", re.IGNORECASE)
# MU_CHANGE [END] - Handle pragma once in ASL
## Patterns used to convert EDK conventions to EDK2 ECP conventions

## Regular expression for finding header file inclusions
Expand Down Expand Up @@ -322,6 +326,10 @@ def DoInclude(Source, Indent='', IncludePathList=[], LocalSearchPath=None, Inclu
if len(Result) == 0:
Result = gAslCIncludePattern.findall(Line)
if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]:
# MU_CHANGE [BEGIN] - Handle pragma once in ASL
if gPragmaOncePattern.match(Line):
continue
# MU_CHANGE [END] - Handle pragma once in ASL
NewFileContent.append("%s%s" % (Indent, Line))
continue
#
Expand Down
Loading