cert.py: Fix FP
This commit is contained in:
parent
f7d65cd735
commit
8f21ba91e3
|
@ -113,14 +113,15 @@ def exp05(data):
|
|||
continue
|
||||
if not argvar.isPointer:
|
||||
continue
|
||||
if (argvar.constness % 2) == 1: # data is const
|
||||
continue
|
||||
argtok = arguments[argnr - 1]
|
||||
if not argtok.valueType:
|
||||
continue
|
||||
if argtok.valueType.pointer == 0:
|
||||
continue
|
||||
const1 = argvar.isConst
|
||||
const2 = arguments[argnr - 1].valueType.constness
|
||||
if (const1 % 2) < (const2 % 2):
|
||||
if (const2 % 2) == 1:
|
||||
reportError(token, 'style', "Attempt to cast away const", 'cert-EXP05-C')
|
||||
|
||||
|
||||
|
|
|
@ -351,6 +351,7 @@ class Variable:
|
|||
isPointer Is this variable a pointer
|
||||
isReference Is this variable a reference
|
||||
isStatic Is this variable static?
|
||||
constness Variable constness (same encoding as ValueType::constness)
|
||||
"""
|
||||
|
||||
Id = None
|
||||
|
@ -369,6 +370,7 @@ class Variable:
|
|||
isPointer = False
|
||||
isReference = False
|
||||
isStatic = False
|
||||
constness = 0
|
||||
|
||||
def __init__(self, element):
|
||||
self.Id = element.get('id')
|
||||
|
@ -387,6 +389,9 @@ class Variable:
|
|||
self.isPointer = element.get('isPointer') == 'true'
|
||||
self.isReference = element.get('isReference') == 'true'
|
||||
self.isStatic = element.get('isStatic') == 'true'
|
||||
self.constness = element.get('constness')
|
||||
if self.constness:
|
||||
self.constness = int(self.constness)
|
||||
|
||||
def setId(self, IdMap):
|
||||
self.nameToken = IdMap[self.nameTokenId]
|
||||
|
|
|
@ -26,6 +26,11 @@ void exp05()
|
|||
dostuff(data); // cert-EXP05-C
|
||||
}
|
||||
|
||||
void print(const char *p);
|
||||
void exp05_fp() {
|
||||
print("hello");
|
||||
}
|
||||
|
||||
void exp42()
|
||||
{
|
||||
struct S s1 = {1,2};
|
||||
|
|
Loading…
Reference in New Issue