public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/ECC: Fix an identification issue of typedef function.
@ 2018-10-16  8:23 Yonghong Zhu
  2018-10-23 12:35 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-10-16  8:23 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hess Chen

From: Hess Chen <hesheng.chen@intel.com>

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
---
 BaseTools/Source/Python/Ecc/Check.py | 12 +++++++++++-
 BaseTools/Source/Python/Ecc/c.py     |  8 ++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 3bf86b42cd..eb086362bd 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -586,13 +586,23 @@ class Check(object):
         if EccGlobalData.gConfig.IncludeFileCheckData == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Checking header file data ...")
 
+            # Get all typedef functions
+            gAllTypedefFun = []
+            for IdentifierTable in EccGlobalData.gIdentifierTableList:
+                SqlCommand = """select Name from %s
+                                where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_TYPEDEF)
+                RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+                for Record in RecordSet:
+                    if Record[0].startswith('('):
+                        gAllTypedefFun.append(Record[0])
+
 #            for Dirpath, Dirnames, Filenames in self.WalkTree():
 #                for F in Filenames:
 #                    if os.path.splitext(F)[1] in ('.h'):
 #                        FullName = os.path.join(Dirpath, F)
 #                        MsgList = c.CheckHeaderFileData(FullName)
             for FullName in EccGlobalData.gHFileList:
-                MsgList = c.CheckHeaderFileData(FullName)
+                MsgList = c.CheckHeaderFileData(FullName, gAllTypedefFun)
 
     # Doxygen document checking
     def DoxygenCheck(self):
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 953f1630b6..b8d6adde16 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -2144,7 +2144,7 @@ def CheckBooleanValueComparison(FullFileName):
                     PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
 
 
-def CheckHeaderFileData(FullFileName):
+def CheckHeaderFileData(FullFileName, AllTypedefFun=[]):
     ErrorMsgList = []
 
     FileID = GetTableID(FullFileName, ErrorMsgList)
@@ -2160,7 +2160,11 @@ def CheckHeaderFileData(FullFileName):
     ResultSet = Db.TblFile.Exec(SqlStatement)
     for Result in ResultSet:
         if not Result[1].startswith('extern'):
-            PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0])
+            for Item in AllTypedefFun:
+                if '(%s)' % Result[1] in Item:
+                    break
+            else:
+                PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0])
 
     SqlStatement = """ select ID
                        from Function
-- 
2.14.2.windows.2



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

* Re: [PATCH] BaseTools/ECC: Fix an identification issue of typedef function.
  2018-10-16  8:23 [PATCH] BaseTools/ECC: Fix an identification issue of typedef function Yonghong Zhu
@ 2018-10-23 12:35 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-10-23 12:35 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Chen, Hesheng, Zhu, Yonghong

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>

Best Regards,
Zhu Yonghong


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
Sent: Tuesday, October 16, 2018 4:24 PM
To: edk2-devel@lists.01.org
Cc: Chen, Hesheng <hesheng.chen@intel.com>
Subject: [edk2] [PATCH] BaseTools/ECC: Fix an identification issue of typedef function.

From: Hess Chen <hesheng.chen@intel.com>

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
---
 BaseTools/Source/Python/Ecc/Check.py | 12 +++++++++++-
 BaseTools/Source/Python/Ecc/c.py     |  8 ++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 3bf86b42cd..eb086362bd 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -586,13 +586,23 @@ class Check(object):
         if EccGlobalData.gConfig.IncludeFileCheckData == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
             EdkLogger.quiet("Checking header file data ...")
 
+            # Get all typedef functions
+            gAllTypedefFun = []
+            for IdentifierTable in EccGlobalData.gIdentifierTableList:
+                SqlCommand = """select Name from %s
+                                where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_TYPEDEF)
+                RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+                for Record in RecordSet:
+                    if Record[0].startswith('('):
+                        gAllTypedefFun.append(Record[0])
+
 #            for Dirpath, Dirnames, Filenames in self.WalkTree():
 #                for F in Filenames:
 #                    if os.path.splitext(F)[1] in ('.h'):
 #                        FullName = os.path.join(Dirpath, F)
 #                        MsgList = c.CheckHeaderFileData(FullName)
             for FullName in EccGlobalData.gHFileList:
-                MsgList = c.CheckHeaderFileData(FullName)
+                MsgList = c.CheckHeaderFileData(FullName, 
+ gAllTypedefFun)
 
     # Doxygen document checking
     def DoxygenCheck(self):
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 953f1630b6..b8d6adde16 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -2144,7 +2144,7 @@ def CheckBooleanValueComparison(FullFileName):
                     PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
 
 
-def CheckHeaderFileData(FullFileName):
+def CheckHeaderFileData(FullFileName, AllTypedefFun=[]):
     ErrorMsgList = []
 
     FileID = GetTableID(FullFileName, ErrorMsgList) @@ -2160,7 +2160,11 @@ def CheckHeaderFileData(FullFileName):
     ResultSet = Db.TblFile.Exec(SqlStatement)
     for Result in ResultSet:
         if not Result[1].startswith('extern'):
-            PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0])
+            for Item in AllTypedefFun:
+                if '(%s)' % Result[1] in Item:
+                    break
+            else:
+                PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable 
+ definition appears in header file', FileTable, Result[0])
 
     SqlStatement = """ select ID
                        from Function
--
2.14.2.windows.2

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


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

end of thread, other threads:[~2018-10-23 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-16  8:23 [PATCH] BaseTools/ECC: Fix an identification issue of typedef function Yonghong Zhu
2018-10-23 12:35 ` Zhu, Yonghong

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