import re\r
from CommonDataClass.DataClass import *\r
import Common.DataType as DT\r
-from .EccToolError import *\r
-from .MetaDataParser import ParseHeaderCommentSection\r
-from . import EccGlobalData\r
-from . import c\r
+from Ecc.EccToolError import *\r
+from Ecc.MetaDataParser import ParseHeaderCommentSection\r
+from Ecc import EccGlobalData\r
+from Ecc import c\r
from Common.LongFilePathSupport import OpenLongFilePath as open\r
from Common.MultipleWorkspace import MultipleWorkspace as mws\r
\r
self.FunctionLayoutCheckPrototype()\r
self.FunctionLayoutCheckBody()\r
self.FunctionLayoutCheckLocalVariable()\r
+ self.FunctionLayoutCheckDeprecated()\r
+ \r
+ # To check if the deprecated functions are used\r
+ def FunctionLayoutCheckDeprecated(self):\r
+ if EccGlobalData.gConfig.CFunctionLayoutCheckNoDeprecated == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+ EdkLogger.quiet("Checking function no deprecated one being used ...")\r
+\r
+ DeprecatedFunctionSet = ('UnicodeValueToString',\r
+ 'AsciiValueToString',\r
+ 'StrCpy',\r
+ 'StrnCpy',\r
+ 'StrCat',\r
+ 'StrnCat',\r
+ 'UnicodeStrToAsciiStr',\r
+ 'AsciiStrCpy',\r
+ 'AsciiStrnCpy',\r
+ 'AsciiStrCat',\r
+ 'AsciiStrnCat',\r
+ 'AsciiStrToUnicodeStr',\r
+ 'PcdSet8',\r
+ 'PcdSet16',\r
+ 'PcdSet32',\r
+ 'PcdSet64',\r
+ 'PcdSetPtr',\r
+ 'PcdSetBool',\r
+ 'PcdSetEx8',\r
+ 'PcdSetEx16',\r
+ 'PcdSetEx32',\r
+ 'PcdSetEx64',\r
+ 'PcdSetExPtr',\r
+ 'PcdSetExBool',\r
+ 'LibPcdSet8',\r
+ 'LibPcdSet16',\r
+ 'LibPcdSet32',\r
+ 'LibPcdSet64',\r
+ 'LibPcdSetPtr',\r
+ 'LibPcdSetBool',\r
+ 'LibPcdSetEx8',\r
+ 'LibPcdSetEx16',\r
+ 'LibPcdSetEx32',\r
+ 'LibPcdSetEx64',\r
+ 'LibPcdSetExPtr',\r
+ 'LibPcdSetExBool',\r
+ 'GetVariable',\r
+ 'GetEfiGlobalVariable',\r
+ )\r
+\r
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:\r
+ SqlCommand = """select ID, Name, BelongsToFile from %s\r
+ where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_FUNCTION_CALLING)\r
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)\r
+ for Record in RecordSet:\r
+ for Key in DeprecatedFunctionSet:\r
+ if Key == Record[1]:\r
+ if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE, Key):\r
+ OtherMsg = 'The function [%s] is deprecated which should NOT be used' % Key\r
+ EccGlobalData.gDb.TblReport.Insert(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE,\r
+ OtherMsg=OtherMsg,\r
+ BelongsToTable=IdentifierTable,\r
+ BelongsToItem=Record[0])\r
\r
def WalkTree(self):\r
IgnoredPattern = c.GetIgnoredDirListPattern()\r
if EccGlobalData.gConfig.IncludeFileCheckData == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
EdkLogger.quiet("Checking header file data ...")\r
\r
+ # Get all typedef functions\r
+ gAllTypedefFun = []\r
+ for IdentifierTable in EccGlobalData.gIdentifierTableList:\r
+ SqlCommand = """select Name from %s\r
+ where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_TYPEDEF)\r
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)\r
+ for Record in RecordSet:\r
+ if Record[0].startswith('('):\r
+ gAllTypedefFun.append(Record[0])\r
+\r
# for Dirpath, Dirnames, Filenames in self.WalkTree():\r
# for F in Filenames:\r
# if os.path.splitext(F)[1] in ('.h'):\r
# FullName = os.path.join(Dirpath, F)\r
# MsgList = c.CheckHeaderFileData(FullName)\r
for FullName in EccGlobalData.gHFileList:\r
- MsgList = c.CheckHeaderFileData(FullName)\r
+ MsgList = c.CheckHeaderFileData(FullName, gAllTypedefFun)\r
\r
# Doxygen document checking\r
def DoxygenCheck(self):\r