diff --git a/addons/misra.py b/addons/misra.py index a8139ca21..ae5855dbc 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -1693,7 +1693,7 @@ class MisraChecker: continue 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) elif data.standards.c == 'c99': if token.valueType.type == 'bool': @@ -1702,7 +1702,7 @@ class MisraChecker: isExplicitlySignedOrUnsigned = False typeToken = token.variable.typeStartToken while typeToken: - if typeToken.isUnsigned or typeToken.isSigned: + if typeToken.isUnsigned or typeToken.isSigned or isUnsignedType(typeToken.str): isExplicitlySignedOrUnsigned = True break diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 24604979b..d5dbf9a62 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -252,6 +252,7 @@ struct struct_with_bitfields signed long f:2; // 6.1 - signed long not compliant unsigned int g:1; // 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) {