[edk2] [Patch] BaseTools: Add comments for the Structure Pcd definition in PcdValueInit.c file

BobCF posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 ++++
BaseTools/Source/Python/Workspace/DecBuildData.py     | 2 ++
BaseTools/Source/Python/Workspace/DscBuildData.py     | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
[edk2] [Patch] BaseTools: Add comments for the Structure Pcd definition in PcdValueInit.c file
Posted by BobCF 6 years, 11 months ago
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 ++++
 BaseTools/Source/Python/Workspace/DecBuildData.py     | 2 ++
 BaseTools/Source/Python/Workspace/DscBuildData.py     | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 0e3081cfc5..8d02e78b27 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -117,10 +117,12 @@ class StructurePcd(PcdClassObject):
         self.DefaultValues = collections.OrderedDict({})
         self.PcdMode = None
         self.SkuOverrideValues = collections.OrderedDict({})
         self.FlexibleFieldName = None
         self.StructName = None
+        self.PcdDefineLineNo = 0
+        self.PkgPath = ""
     def __repr__(self):
         return self.TypeName
 
     def AddDefaultValue (self, FieldName, Value, FileName="", LineNo=0):
         if FieldName in self.DefaultValues:
@@ -169,10 +171,12 @@ class StructurePcd(PcdClassObject):
             self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
             self.DefaultFromDSC=None
             self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
             self.FlexibleFieldName = PcdObject.FlexibleFieldName if PcdObject.FlexibleFieldName else self.FlexibleFieldName
             self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
+            self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
+            self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else self.PkgPath
 
 ## LibraryClassObject
 #
 # This Class defines LibraryClassObject used in BuildDatabase
 #
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 13fb8686b6..2fd3820dcc 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -381,10 +381,12 @@ class DecBuildData(PackageBuildClassObject):
                     dep_pkgs.append(item.DefaultValue)
                 elif item.DatumType == item.TokenCName:
                     struct_pcd.copy(item)
                     struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()
                     struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")
+                    struct_pcd.PcdDefineLineNo = LineNo
+                    struct_pcd.PkgPath = self.MetaFile.File
                 else:
                     struct_pcd.AddDefaultValue(item.TokenCName, item.DefaultValue,self.MetaFile.File,LineNo)
 
             struct_pcd.PackageDecs = dep_pkgs
 
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index b042c4306a..60aa4868ed 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1284,11 +1284,11 @@ class DscBuildData(PlatformBuildClassObject):
             CApp = CApp + '  UINT32  Size;\n'
             CApp = CApp + '  UINT32  FieldSize;\n'
             CApp = CApp + '  CHAR8   *Value;\n'
             CApp = CApp + '  UINT32  OriginalSize;\n'
             CApp = CApp + '  VOID    *OriginalPcd;\n'
-            CApp = CApp + '  %s      *Pcd;\n' % (Pcd.DatumType)
+            CApp = CApp + '  %s      *Pcd;  // From %s Line %d \n' % (Pcd.DatumType, Pcd.PkgPath, Pcd.PcdDefineLineNo)
             CApp = CApp + '\n'
 
             Pcd.DefaultValue = Pcd.DefaultValue.strip()
             PcdDefaultValue = StringToArray(Pcd.DefaultValue)
 
-- 
2.14.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Add comments for the Structure Pcd definition in PcdValueInit.c file
Posted by Gao, Liming 6 years, 11 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Tuesday, January 23, 2018 11:03 AM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Add comments for the Structure Pcd definition in
>PcdValueInit.c file
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 ++++
> BaseTools/Source/Python/Workspace/DecBuildData.py     | 2 ++
> BaseTools/Source/Python/Workspace/DscBuildData.py     | 2 +-
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
>b/BaseTools/Source/Python/Workspace/BuildClassObject.py
>index 0e3081cfc5..8d02e78b27 100644
>--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
>+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
>@@ -117,10 +117,12 @@ class StructurePcd(PcdClassObject):
>         self.DefaultValues = collections.OrderedDict({})
>         self.PcdMode = None
>         self.SkuOverrideValues = collections.OrderedDict({})
>         self.FlexibleFieldName = None
>         self.StructName = None
>+        self.PcdDefineLineNo = 0
>+        self.PkgPath = ""
>     def __repr__(self):
>         return self.TypeName
>
>     def AddDefaultValue (self, FieldName, Value, FileName="", LineNo=0):
>         if FieldName in self.DefaultValues:
>@@ -169,10 +171,12 @@ class StructurePcd(PcdClassObject):
>             self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else
>self.PcdMode
>             self.DefaultFromDSC=None
>             self.SkuOverrideValues = PcdObject.SkuOverrideValues if
>PcdObject.SkuOverrideValues else self.SkuOverrideValues
>             self.FlexibleFieldName = PcdObject.FlexibleFieldName if
>PcdObject.FlexibleFieldName else self.FlexibleFieldName
>             self.StructName = PcdObject.DatumType if PcdObject.DatumType else
>self.StructName
>+            self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if
>PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
>+            self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else
>self.PkgPath
>
> ## LibraryClassObject
> #
> # This Class defines LibraryClassObject used in BuildDatabase
> #
>diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py
>b/BaseTools/Source/Python/Workspace/DecBuildData.py
>index 13fb8686b6..2fd3820dcc 100644
>--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
>@@ -381,10 +381,12 @@ class DecBuildData(PackageBuildClassObject):
>                     dep_pkgs.append(item.DefaultValue)
>                 elif item.DatumType == item.TokenCName:
>                     struct_pcd.copy(item)
>                     struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()
>                     struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName =
>pcdname.split(".")
>+                    struct_pcd.PcdDefineLineNo = LineNo
>+                    struct_pcd.PkgPath = self.MetaFile.File
>                 else:
>                     struct_pcd.AddDefaultValue(item.TokenCName,
>item.DefaultValue,self.MetaFile.File,LineNo)
>
>             struct_pcd.PackageDecs = dep_pkgs
>
>diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
>b/BaseTools/Source/Python/Workspace/DscBuildData.py
>index b042c4306a..60aa4868ed 100644
>--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
>@@ -1284,11 +1284,11 @@ class DscBuildData(PlatformBuildClassObject):
>             CApp = CApp + '  UINT32  Size;\n'
>             CApp = CApp + '  UINT32  FieldSize;\n'
>             CApp = CApp + '  CHAR8   *Value;\n'
>             CApp = CApp + '  UINT32  OriginalSize;\n'
>             CApp = CApp + '  VOID    *OriginalPcd;\n'
>-            CApp = CApp + '  %s      *Pcd;\n' % (Pcd.DatumType)
>+            CApp = CApp + '  %s      *Pcd;  // From %s Line %d \n' %
>(Pcd.DatumType, Pcd.PkgPath, Pcd.PcdDefineLineNo)
>             CApp = CApp + '\n'
>
>             Pcd.DefaultValue = Pcd.DefaultValue.strip()
>             PcdDefaultValue = StringToArray(Pcd.DefaultValue)
>
>--
>2.14.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel