Update ECC predicate expression checks for brace-quoted and boolean pointer variables.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9946 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
58125fb3f9
commit
96e6b8e67b
@ -742,7 +742,7 @@ def SplitPredicateByOp(Str, Op, IsFuncCalling = False):
|
|||||||
return [Name]
|
return [Name]
|
||||||
|
|
||||||
Name = Str[0:Index + IndexInRemainingStr].strip()
|
Name = Str[0:Index + IndexInRemainingStr].strip()
|
||||||
Value = Str[Index+IndexInRemainingStr+len(Op):].strip()
|
Value = Str[Index+IndexInRemainingStr+len(Op):].strip().strip(')')
|
||||||
return [Name, Value]
|
return [Name, Value]
|
||||||
|
|
||||||
TmpStr = Str.rstrip(';').rstrip(')')
|
TmpStr = Str.rstrip(';').rstrip(')')
|
||||||
@ -759,6 +759,8 @@ def SplitPredicateByOp(Str, Op, IsFuncCalling = False):
|
|||||||
TmpStr = Str[0:Index - 1]
|
TmpStr = Str[0:Index - 1]
|
||||||
|
|
||||||
def SplitPredicateStr(Str):
|
def SplitPredicateStr(Str):
|
||||||
|
|
||||||
|
Str = Str.lstrip('(')
|
||||||
IsFuncCalling = False
|
IsFuncCalling = False
|
||||||
p = GetFuncDeclPattern()
|
p = GetFuncDeclPattern()
|
||||||
TmpStr = Str.replace('.', '').replace('->', '')
|
TmpStr = Str.replace('.', '').replace('->', '')
|
||||||
@ -1219,6 +1221,16 @@ def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall = False, Target
|
|||||||
Type = GetRealType(Type, TypedefDict, TargetType)
|
Type = GetRealType(Type, TypedefDict, TargetType)
|
||||||
return Type
|
return Type
|
||||||
|
|
||||||
|
def GetTypeFromArray(Type, Var):
|
||||||
|
Count = Var.count('[')
|
||||||
|
|
||||||
|
while Count > 0:
|
||||||
|
Type = Type.strip()
|
||||||
|
Type = Type.rstrip('*')
|
||||||
|
Count = Count - 1
|
||||||
|
|
||||||
|
return Type
|
||||||
|
|
||||||
def CheckFuncLayoutReturnType(FullFileName):
|
def CheckFuncLayoutReturnType(FullFileName):
|
||||||
ErrorMsgList = []
|
ErrorMsgList = []
|
||||||
|
|
||||||
@ -1931,6 +1943,7 @@ def CheckPointerNullComparison(FullFileName):
|
|||||||
FuncReturnTypeDict[PredVarStr] = Type
|
FuncReturnTypeDict[PredVarStr] = Type
|
||||||
if Type == None:
|
if Type == None:
|
||||||
continue
|
continue
|
||||||
|
Type = GetTypeFromArray(Type, PredVarStr)
|
||||||
if Type.find('*') != -1:
|
if Type.find('*') != -1:
|
||||||
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
|
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user