misra: tailor the definition of Rule 12.2 to C standard types

The definition of MISRA C Rule 12.2 ("The right hand operand of a shift
operator shall lie in the range zero to one less than the width in bits
of the essential type of the left hand operand") is concerned with the
essential type of an expression, while the C Undefined Behaviour is
related to C standard types, which may be wider but not narrower than
the MISRA C essential type. For this reason, it is safe to consider the
C standard type, rather than the essential type when checking the rule.

To avoid regressions, tag the rule as clean and add it to the
monitored set.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Nicola Vetrini authored and Jan Beulich committed 2025-07-17 12:48:54 +02:00
1 parent 38286e84a8
commit 79750f639a
4 files changed
+18

No files matched your search

@@ -413,6 +413,14 @@ write or not"
}
-doc_end
#
# Series 12
#
-doc_begin="Consider the C standard type instead of the essential type for the purposes of determining the width in bits of the operand."
-config=MC3A2.R12.2,out_of_bounds=negative_or_too_big_for_type
-doc_end
#
# Series 13
#
@@ -48,6 +48,7 @@
-enable=MC3A2.R11.7
-enable=MC3A2.R11.8
-enable=MC3A2.R11.9
-enable=MC3A2.R12.2
-enable=MC3A2.R12.5
-enable=MC3A2.R13.1
-enable=MC3A2.R13.2
@@ -63,6 +63,7 @@ MC3A2.R11.2||
MC3A2.R11.6||
MC3A2.R11.7||
MC3A2.R11.9||
MC3A2.R12.2||
MC3A2.R12.5||
MC3A2.R13.2||
MC3A2.R13.6||
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.