BaseTools/Ecc: Remove checkpoint for STATIC modifier
1. Fix a bug of removing the checkpoint for STATIC modifier 2. Fix a bug of parsing CONST variable Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: YangX Li <yangx.li@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18446 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2e7b7ce313
commit
00261e1dc6
|
@ -1223,7 +1223,10 @@ class Check(object):
|
||||||
SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
|
SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
|
||||||
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
|
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
|
||||||
for Record in RecordSet:
|
for Record in RecordSet:
|
||||||
if not Pattern.match(Record[1]):
|
Var = Record[1]
|
||||||
|
if Var.startswith('CONST'):
|
||||||
|
Var = Var[5:].lstrip()
|
||||||
|
if not Pattern.match(Var):
|
||||||
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]):
|
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]):
|
||||||
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
|
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
|
||||||
|
|
||||||
|
|
|
@ -1271,7 +1271,10 @@ def CheckFuncLayoutReturnType(FullFileName):
|
||||||
FuncName = Result[5]
|
FuncName = Result[5]
|
||||||
if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName):
|
if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName):
|
||||||
continue
|
continue
|
||||||
Index = Result[0].find(TypeStart)
|
Result0 = Result[0]
|
||||||
|
if Result0.upper().startswith('STATIC'):
|
||||||
|
Result0 = Result0[6:].strip()
|
||||||
|
Index = Result0.find(TypeStart)
|
||||||
if Index != 0 or Result[3] != 0:
|
if Index != 0 or Result[3] != 0:
|
||||||
PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, FileTable, Result[1])
|
PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, FileTable, Result[1])
|
||||||
|
|
||||||
|
@ -1313,9 +1316,10 @@ def CheckFuncLayoutModifier(FullFileName):
|
||||||
for Result in ResultSet:
|
for Result in ResultSet:
|
||||||
ReturnType = GetDataTypeFromModifier(Result[0])
|
ReturnType = GetDataTypeFromModifier(Result[0])
|
||||||
TypeStart = ReturnType.split()[0]
|
TypeStart = ReturnType.split()[0]
|
||||||
# if len(ReturnType) == 0:
|
Result0 = Result[0]
|
||||||
# continue
|
if Result0.upper().startswith('STATIC'):
|
||||||
Index = Result[0].find(TypeStart)
|
Result0 = Result0[6:].strip()
|
||||||
|
Index = Result0.find(TypeStart)
|
||||||
if Index != 0:
|
if Index != 0:
|
||||||
PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', FileTable, Result[1])
|
PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', FileTable, Result[1])
|
||||||
|
|
||||||
|
@ -1327,8 +1331,6 @@ def CheckFuncLayoutModifier(FullFileName):
|
||||||
for Result in ResultSet:
|
for Result in ResultSet:
|
||||||
ReturnType = GetDataTypeFromModifier(Result[0])
|
ReturnType = GetDataTypeFromModifier(Result[0])
|
||||||
TypeStart = ReturnType.split()[0]
|
TypeStart = ReturnType.split()[0]
|
||||||
# if len(ReturnType) == 0:
|
|
||||||
# continue
|
|
||||||
Result0 = Result[0]
|
Result0 = Result[0]
|
||||||
if Result0.upper().startswith('STATIC'):
|
if Result0.upper().startswith('STATIC'):
|
||||||
Result0 = Result0[6:].strip()
|
Result0 = Result0[6:].strip()
|
||||||
|
@ -1631,6 +1633,8 @@ def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId):
|
||||||
Field = Field.strip()
|
Field = Field.strip()
|
||||||
if Field == '':
|
if Field == '':
|
||||||
continue
|
continue
|
||||||
|
if Field.startswith("#"):
|
||||||
|
continue
|
||||||
# Enum could directly assign value to variable
|
# Enum could directly assign value to variable
|
||||||
Field = Field.split('=')[0].strip()
|
Field = Field.split('=')[0].strip()
|
||||||
TokenList = Field.split()
|
TokenList = Field.split()
|
||||||
|
|
Loading…
Reference in New Issue