You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rule 7.0.4 is now in the Conversions package.
Rules 8.x in the Conversions package are now moved to Conversions2.
This is to avoid having too many complex queries in one package,
and because 7.0.4 is more closely related to the other 7.x rules.
"description": "Converting a bool type (implicitly or explicitly) to another type can lead to unintended behavior and code obfuscation, particularly when using bitwise operators instead of logical operators.",
11
+
"kind": "problem",
12
+
"name": "There shall be no conversion from type bool",
13
+
"precision": "very-high",
14
+
"severity": "error",
15
+
"short_name": "NoConversionFromBool",
16
+
"tags": [
17
+
"scope/single-translation-unit"
18
+
]
19
+
}
20
+
],
21
+
"title": "There shall be no conversion from type bool"
22
+
},
23
+
"RULE-7-0-2": {
24
+
"properties": {
25
+
"enforcement": "decidable",
26
+
"obligation": "required"
27
+
},
28
+
"queries": [
29
+
{
30
+
"description": "Implicit and contextual conversions to bool from fundamental types, unscoped enums, or pointers may lead to unintended behavior, except for specific cases like pointer checks and explicit operator bool conversions.",
31
+
"kind": "problem",
32
+
"name": "There shall be no conversion to type bool",
33
+
"precision": "very-high",
34
+
"severity": "error",
35
+
"short_name": "NoImplicitBoolConversion",
36
+
"tags": [
37
+
"scope/single-translation-unit"
38
+
]
39
+
}
40
+
],
41
+
"title": "There shall be no conversion to type bool"
42
+
},
43
+
"RULE-7-0-3": {
44
+
"properties": {
45
+
"enforcement": "decidable",
46
+
"obligation": "required"
47
+
},
48
+
"queries": [
49
+
{
50
+
"description": "Using the numerical value of a character type may lead to inconsistent behavior due to encoding dependencies and should be avoided in favor of safer C++ Standard Library functions.",
51
+
"kind": "problem",
52
+
"name": "The numerical value of a character shall not be used",
53
+
"precision": "very-high",
54
+
"severity": "error",
55
+
"short_name": "NoCharacterNumericalValue",
56
+
"tags": [
57
+
"scope/single-translation-unit"
58
+
]
59
+
}
60
+
],
61
+
"title": "The numerical value of a character shall not be used"
62
+
},
63
+
"RULE-7-0-4": {
64
+
"properties": {
65
+
"enforcement": "decidable",
66
+
"obligation": "required"
67
+
},
68
+
"queries": [
69
+
{
70
+
"description": "Bitwise and shift operators should only be applied to operands of appropriate types and values to avoid implementation-defined or undefined behavior.",
71
+
"kind": "problem",
72
+
"name": "The operands of bitwise operators and shift operators shall be appropriate",
"title": "The operands of bitwise operators and shift operators shall be appropriate"
82
+
},
83
+
"RULE-7-0-5": {
84
+
"properties": {
85
+
"enforcement": "decidable",
86
+
"obligation": "required"
87
+
},
88
+
"queries": [
89
+
{
90
+
"description": "Integral promotion and usual arithmetic conversions that change operand signedness or type category may cause unexpected behavior or undefined behavior when operations overflow.",
91
+
"kind": "problem",
92
+
"name": "Integral promotion and the usual arithmetic conversions shall not change the signedness or the type",
93
+
"precision": "very-high",
94
+
"severity": "error",
95
+
"short_name": "NoSignednessChangeFromPromotion",
96
+
"tags": [
97
+
"scope/single-translation-unit"
98
+
]
99
+
}
100
+
],
101
+
"title": "Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand"
102
+
},
103
+
"RULE-7-0-6": {
104
+
"properties": {
105
+
"enforcement": "decidable",
106
+
"obligation": "required"
107
+
},
108
+
"queries": [
109
+
{
110
+
"description": "Assignment between numeric types with different sizes, signedness, or type categories can lead to unexpected information loss, undefined behavior, or silent overload resolution changes.",
111
+
"kind": "problem",
112
+
"name": "Assignment between numeric types shall be appropriate",
113
+
"precision": "high",
114
+
"severity": "error",
115
+
"short_name": "NumericAssignmentTypeMismatch",
116
+
"tags": [
117
+
"scope/single-translation-unit"
118
+
]
119
+
}
120
+
],
121
+
"title": "Assignment between numeric types shall be appropriate"
122
+
},
123
+
"RULE-7-11-3": {
124
+
"properties": {
125
+
"enforcement": "decidable",
126
+
"obligation": "required"
127
+
},
128
+
"queries": [
129
+
{
130
+
"description": "Converting a function type to a pointer-to-function type outside of static_cast or assignment to a pointer-to-function object creates ambiguous behavior and potential unintended effects.",
131
+
"kind": "problem",
132
+
"name": "A conversion from function type to pointer-to-function type shall only occur in appropriate contexts",
133
+
"precision": "very-high",
134
+
"severity": "error",
135
+
"short_name": "FunctionPointerConversionContext",
136
+
"tags": [
137
+
"scope/single-translation-unit"
138
+
]
139
+
}
140
+
],
141
+
"title": "A conversion from function type to pointer-to-function type shall only occur in appropriate contexts"
cpp,MISRA-C++-2023,RULE-7-0-1,Yes,Required,Decidable,Single Translation Unit,There shall be no conversion from type bool,,Conversions,Easy,
874
874
cpp,MISRA-C++-2023,RULE-7-0-2,Yes,Required,Decidable,Single Translation Unit,There shall be no conversion to type bool,,Conversions,Easy,
875
875
cpp,MISRA-C++-2023,RULE-7-0-3,Yes,Required,Decidable,Single Translation Unit,The numerical value of a character shall not be used,M5-0-11,Conversions,Medium,
876
-
cpp,MISRA-C++-2023,RULE-7-0-4,Yes,Required,Decidable,Single Translation Unit,The operands of bitwise operators and shift operators shall be appropriate,RULE-10-1,Preconditions,Medium,
876
+
cpp,MISRA-C++-2023,RULE-7-0-4,Yes,Required,Decidable,Single Translation Unit,The operands of bitwise operators and shift operators shall be appropriate,RULE-10-1,Conversions,Medium,
877
877
cpp,MISRA-C++-2023,RULE-7-0-5,Yes,Required,Decidable,Single Translation Unit,Integral promotion and the usual arithmetic conversions shall not change the signedness or the type category of an operand,"M5-0-4,M5-0-9,INT31-C",Conversions,Medium,
878
878
cpp,MISRA-C++-2023,RULE-7-0-6,Yes,Required,Decidable,Single Translation Unit,Assignment between numeric types shall be appropriate,,Conversions,Hard,
879
879
cpp,MISRA-C++-2023,RULE-7-11-1,Yes,Required,Decidable,Single Translation Unit,nullptr shall be the only form of the null-pointer-constant,A4-10-1,ImportMisra23,Import,
cpp,MISRA-C++-2023,RULE-8-0-1,Yes,Advisory,Decidable,Single Translation Unit,Parentheses should be used to make the meaning of an expression appropriately explicit,M5-0-2,Expressions2,Medium,
883
883
cpp,MISRA-C++-2023,RULE-8-1-1,Yes,Required,Decidable,Single Translation Unit,A non-transient lambda shall not implicitly capture this,,Expressions2,Easy,
884
884
cpp,MISRA-C++-2023,RULE-8-1-2,Yes,Advisory,Decidable,Single Translation Unit,Variables should be captured explicitly in a non-transient lambda,A5-1-2,Expressions2,Easy,
885
-
cpp,MISRA-C++-2023,RULE-8-2-1,Yes,Required,Decidable,Single Translation Unit,A virtual base class shall only be cast to a derived class by means of dynamic_cast,,Conversions,Easy,
886
-
cpp,MISRA-C++-2023,RULE-8-2-2,Yes,Required,Decidable,Single Translation Unit,C-style casts and functional notation casts shall not be used,A5-2-2,Conversions,Easy,
885
+
cpp,MISRA-C++-2023,RULE-8-2-1,Yes,Required,Decidable,Single Translation Unit,A virtual base class shall only be cast to a derived class by means of dynamic_cast,,Conversions2,Easy,
886
+
cpp,MISRA-C++-2023,RULE-8-2-2,Yes,Required,Decidable,Single Translation Unit,C-style casts and functional notation casts shall not be used,A5-2-2,Conversions2,Easy,
887
887
cpp,MISRA-C++-2023,RULE-8-2-3,Yes,Required,Decidable,Single Translation Unit,A cast shall not remove any const or volatile qualification from the type accessed via a pointer or by reference,A5-2-3,ImportMisra23,Import,
888
888
cpp,MISRA-C++-2023,RULE-8-2-4,Yes,Required,Decidable,Single Translation Unit,Casts shall not be performed between a pointer to function and any other type,M5-2-6,ImportMisra23,Import,
889
889
cpp,MISRA-C++-2023,RULE-8-2-5,Yes,Required,Decidable,Single Translation Unit,reinterpret_cast shall not be used,A5-2-4,ImportMisra23,Import,
890
-
cpp,MISRA-C++-2023,RULE-8-2-6,Yes,Required,Decidable,Single Translation Unit,"An object with integral, enumerated, or pointer to void type shall not be cast to a pointer type","RULE-11-6, INT36-C",Conversions,Easy,
891
-
cpp,MISRA-C++-2023,RULE-8-2-7,Yes,Advisory,Decidable,Single Translation Unit,A cast should not convert a pointer type to an integral type,"RULE-11-6, INT36-C",Conversions,Easy,
892
-
cpp,MISRA-C++-2023,RULE-8-2-8,Yes,Required,Decidable,Single Translation Unit,An object pointer type shall not be cast to an integral type other than std::uintptr_t or std::intptr_t,"RULE-11-6, INT36-C",Conversions,Easy,
890
+
cpp,MISRA-C++-2023,RULE-8-2-6,Yes,Required,Decidable,Single Translation Unit,"An object with integral, enumerated, or pointer to void type shall not be cast to a pointer type","RULE-11-6, INT36-C",Conversions2,Easy,
891
+
cpp,MISRA-C++-2023,RULE-8-2-7,Yes,Advisory,Decidable,Single Translation Unit,A cast should not convert a pointer type to an integral type,"RULE-11-6, INT36-C",Conversions2,Easy,
892
+
cpp,MISRA-C++-2023,RULE-8-2-8,Yes,Required,Decidable,Single Translation Unit,An object pointer type shall not be cast to an integral type other than std::uintptr_t or std::intptr_t,"RULE-11-6, INT36-C",Conversions2,Easy,
893
893
cpp,MISRA-C++-2023,RULE-8-2-9,Yes,Required,Decidable,Single Translation Unit,The operand to typeid shall not be an expression of polymorphic class type,,Preconditions,Easy,
894
894
cpp,MISRA-C++-2023,RULE-8-2-10,Yes,Required,Undecidable,System,"Functions shall not call themselves, either directly or indirectly",A7-5-2,ImportMisra23,Import,
895
895
cpp,MISRA-C++-2023,RULE-8-2-11,Yes,Required,Decidable,Single Translation Unit,An argument passed via ellipsis shall have an appropriate type,,Preconditions,Easy,
@@ -903,7 +903,7 @@ cpp,MISRA-C++-2023,RULE-8-18-1,Yes,Mandatory,Undecidable,System,An object or sub
903
903
cpp,MISRA-C++-2023,RULE-8-18-2,Yes,Advisory,Decidable,Single Translation Unit,The result of an assignment operator should not be used,RULE-13-4,ImportMisra23,Import,
904
904
cpp,MISRA-C++-2023,RULE-8-19-1,Yes,Advisory,Decidable,Single Translation Unit,The comma operator should not be used,M5-18-1,ImportMisra23,Import,
905
905
cpp,MISRA-C++-2023,RULE-8-20-1,Yes,Advisory,Decidable,Single Translation Unit,An unsigned arithmetic operation with constant operands should not wrap,INT30-C,ImportMisra23,Import,
906
-
cpp,MISRA-C++-2023,RULE-9-2-1,Yes,Required,Decidable,Single Translation Unit,An explicit type conversion shall not be an expression statement,DCL53-CPP,Conversions,Easy,
906
+
cpp,MISRA-C++-2023,RULE-9-2-1,Yes,Required,Decidable,Single Translation Unit,An explicit type conversion shall not be an expression statement,DCL53-CPP,Conversions2,Easy,
907
907
cpp,MISRA-C++-2023,RULE-9-3-1,Yes,Required,Decidable,Single Translation Unit,The body of an iteration-statement or a selection-statement shall be a compound-statement,RULE-15-6,ImportMisra23,Import,
908
908
cpp,MISRA-C++-2023,RULE-9-4-1,Yes,Required,Decidable,Single Translation Unit,All if ... else if constructs shall be terminated with an else statement,RULE-15-7,ImportMisra23,Import,
909
909
cpp,MISRA-C++-2023,RULE-9-4-2,Yes,Required,Decidable,Single Translation Unit,The structure of a switch statement shall be appropriate,"RULE-16-1, RULE-16-2,RULE-16-3,RULE-16-4,RULE-16-5,RULE-16-6,RULE-16-7",Statements,Medium,
0 commit comments