From: Zurcher, Christopher J <[email protected]>

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 <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zurcher, Christopher J <[email protected]>
---
 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

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to