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
"CFunctionLayoutCheckFunctionBody":"CFunctionLayoutCheckFunctionBody",\r
"CFunctionLayoutCheckFunctionName":"CFunctionLayoutCheckFunctionName",\r
"CFunctionLayoutCheckFunctionPrototype":"CFunctionLayoutCheckFunctionPrototype",\r
+ "CFunctionLayoutCheckNoDeprecated":"CFunctionLayoutCheckNoDeprecated",\r
"CFunctionLayoutCheckNoInitOfVariable":"CFunctionLayoutCheckNoInitOfVariable",\r
"CFunctionLayoutCheckNoStatic":"CFunctionLayoutCheckNoStatic",\r
"CFunctionLayoutCheckOptionalFunctionalModifier":"CFunctionLayoutCheckOptionalFunctionalModifier",\r
self.CFunctionLayoutCheckNoInitOfVariable = 1\r
# Check whether no use of STATIC for functions\r
self.CFunctionLayoutCheckNoStatic = 1\r
+ # Check whether no use of Deprecated functions\r
+ self.CFunctionLayoutCheckNoDeprecated = 1\r
\r
## Include Files Checking\r
self.IncludeFileCheckAll = 0\r
ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC = 5008\r
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 = 5009\r
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 = 5010\r
+ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE = 5011\r
\r
ERROR_INCLUDE_FILE_CHECK_ALL = 6000\r
ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 = 6001\r
ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION : "The data declarations should be the first code in a module",\r
ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE : "There should be no initialization of a variable as part of its declaration",\r
ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC : "There should be no use of STATIC for functions",\r
+ ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE : "The deprecated function should NOT be used",\r
\r
ERROR_INCLUDE_FILE_CHECK_ALL : "",\r
ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 : "All include file contents should be guarded by a #ifndef statement.",\r
CFunctionLayoutCheckNoInitOfVariable = 1\r
# Check whether no use of STATIC for functions\r
CFunctionLayoutCheckNoStatic = 1\r
+# Check whether no use of Deprecated functions\r
+CFunctionLayoutCheckNoDeprecated = 1\r
\r
#\r
# Include Files Checking\r