From 20274d2389eb012812f4561c8eb7cffc57a68850 Mon Sep 17 00:00:00 2001 From: "Zurcher, Christopher J" Date: Wed, 23 May 2018 11:35:42 +0800 Subject: [PATCH] BaseTools/GenFds: Remove redundant GetRealFileLine call The EvaluateConditional function should not call GetRealFileLine because this is already done in Warning init and only needs to be calculated in the event of a parsing failure. This fix stops InsertedLines from being subtracted twice during error handling. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zurcher, Christopher J Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/GenFds/FdfParser.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 8a9296c49d..4518d8f2af 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -914,7 +914,6 @@ class FdfParser: return MacroDict def __EvaluateConditional(self, Expression, Line, Op = None, Value = None): - FileLineTuple = GetRealFileLine(self.FileName, Line) MacroPcdDict = self.__CollectMacroPcd() if Op == 'eval': try: @@ -939,12 +938,12 @@ class FdfParser: " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section" " of the DSC file (%s), and it is currently defined in this section:" " %s, line #: %d." % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE'], Info[0], Info[1]), - *FileLineTuple) + self.FileName, Line) else: raise Warning("PCD (%s) is not defined in DSC file (%s)" % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE']), - *FileLineTuple) + self.FileName, Line) else: - raise Warning(str(Excpt), *FileLineTuple) + raise Warning(str(Excpt), self.FileName, Line) else: if Expression.startswith('$(') and Expression[-1] == ')': Expression = Expression[2:-1] -- 2.39.2