Fix in MISRA rule 6.1 check (#3458)
This commit is contained in:
parent
edd435d5f0
commit
f01ffddca6
|
@ -1693,7 +1693,7 @@ class MisraChecker:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if data.standards.c == 'c89':
|
if data.standards.c == 'c89':
|
||||||
if token.valueType.type != 'int':
|
if token.valueType.type != 'int' and not isUnsignedType(token.variable.typeStartToken.str):
|
||||||
self.reportError(token, 6, 1)
|
self.reportError(token, 6, 1)
|
||||||
elif data.standards.c == 'c99':
|
elif data.standards.c == 'c99':
|
||||||
if token.valueType.type == 'bool':
|
if token.valueType.type == 'bool':
|
||||||
|
@ -1702,7 +1702,7 @@ class MisraChecker:
|
||||||
isExplicitlySignedOrUnsigned = False
|
isExplicitlySignedOrUnsigned = False
|
||||||
typeToken = token.variable.typeStartToken
|
typeToken = token.variable.typeStartToken
|
||||||
while typeToken:
|
while typeToken:
|
||||||
if typeToken.isUnsigned or typeToken.isSigned:
|
if typeToken.isUnsigned or typeToken.isSigned or isUnsignedType(typeToken.str):
|
||||||
isExplicitlySignedOrUnsigned = True
|
isExplicitlySignedOrUnsigned = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,7 @@ struct struct_with_bitfields
|
||||||
signed long f:2; // 6.1 - signed long not compliant
|
signed long f:2; // 6.1 - signed long not compliant
|
||||||
unsigned int g:1; // Compliant
|
unsigned int g:1; // Compliant
|
||||||
signed int h:1; // 6.2 - signed int with size 1 is not compliant
|
signed int h:1; // 6.2 - signed int with size 1 is not compliant
|
||||||
|
uint16_t i:1; // Compliant
|
||||||
};
|
};
|
||||||
|
|
||||||
static void misra6_1_fn(void) {
|
static void misra6_1_fn(void) {
|
||||||
|
|
Loading…
Reference in New Issue