public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools/GenFds: Remove redundant GetRealFileLine call
@ 2018-05-24 23:59 Yonghong Zhu
  2018-05-28  1:19 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-05-24 23:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: Zurcher, Christopher J, Liming Gao

From: Zurcher, Christopher J <christopher.j.zurcher@intel.com>

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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zurcher, Christopher J <christopher.j.zurcher@intel.com>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-28  1:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24 23:59 [Patch] BaseTools/GenFds: Remove redundant GetRealFileLine call Yonghong Zhu
2018-05-28  1:19 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox