File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
common/src/codingstandards/cpp/types
misra/src/codingstandards/cpp/misra Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ class CanonicalIntegralType extends IntegralType {
1212 predicate isMinimal ( ) {
1313 not exists ( CanonicalIntegralType other |
1414 other .getSize ( ) = this .getSize ( ) and
15+ (
16+ other .isSigned ( ) and this .isSigned ( )
17+ or
18+ other .isUnsigned ( ) and this .isUnsigned ( )
19+ ) and
1520 other .getName ( ) .length ( ) < this .getName ( ) .length ( )
1621 )
1722 }
Original file line number Diff line number Diff line change @@ -148,12 +148,16 @@ predicate isUnsignedType(NumericType t) { t.getSignedness() = Unsigned() }
148148 * Where multiple canonical arithmetic types exist for a given size/signedness combination, we
149149 * prefer the type with the shortest name.
150150 */
151- class CanonicalIntegerNumericType extends NumericType , CanonicalIntegralType {
151+ class CanonicalIntegerNumericType extends NumericType {
152152 CanonicalIntegerNumericType ( ) {
153153 // Where multiple types exist with the same size and signedness, prefer shorter names - mainly
154154 // to disambiguate between `unsigned long` and `unsigned long long` on platforms where they
155155 // are the same size
156- this .isMinimal ( )
156+ this .( CanonicalIntegralType ) .isMinimal ( )
157+ or
158+ // `signed char` is not considered a canonical type (`char` is), but `char` is not a MISRA numeric
159+ // type, so we need to reintroduce `signed char` here.
160+ this instanceof SignedCharType
157161 }
158162}
159163
You can’t perform that action at this time.
0 commit comments