From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8B39E207E4DE4 for ; Thu, 24 May 2018 16:59:25 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2018 16:59:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,437,1520924400"; d="scan'208";a="57397009" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by fmsmga004.fm.intel.com with ESMTP; 24 May 2018 16:59:23 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Zurcher, Christopher J , Liming Gao Date: Fri, 25 May 2018 07:59:23 +0800 Message-Id: <1527206363-10064-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools/GenFds: Remove redundant GetRealFileLine call X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2018 23:59:25 -0000 From: Zurcher, Christopher J 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 --- 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 8a9296c..4518d8f 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -912,11 +912,10 @@ class FdfParser: # Highest priority return MacroDict def __EvaluateConditional(self, Expression, Line, Op = None, Value = None): - FileLineTuple = GetRealFileLine(self.FileName, Line) MacroPcdDict = self.__CollectMacroPcd() if Op == 'eval': try: if Value: return ValueExpression(Expression, MacroPcdDict)(True) @@ -937,16 +936,16 @@ class FdfParser: Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd] raise Warning("Cannot use this PCD (%s) in an expression as" " 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] return Expression in MacroPcdDict -- 2.6.1.windows.1