mirror of https://github.com/acidanthera/audk.git
BaseTools/ECC: Fix an identification issue of typedef function.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
33a211d009
commit
3a244b8db4
|
@ -646,13 +646,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):
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue