New style rules
Support for CWE guidelines
New diagnostics
RuleChecker now supports re-categorizing MISRA rules, e.g. using DAX:
<rulechecks> <categories> <M2012.7.1>mandatory</M2012.7.1> </categories> </rulechecks>
This re-categorization is then reported by the analyzer as
Rules:
M2012.7.1 (full: octal-constant) as mandatory
while violations of the rule are reported as
ALARM (R): check octal-constant failed (violates M2012.7.1-mandatory) at ...
RuleChecker configurations now have a flag indicating whether the files therein contain hand-written or generated code. Depending on this flag,
By default the tool assumes hand-written code. In DAX, the configurations for
automatically generated code can be specified with the new attribute agc
:
<rulechecks name="xxx" agc="yes">
allow-signed-constant-with-unsigned
now also suppresses alarms
about the operands of <<, >> and ~.allow-boolean-constants
now also suppresses alarms about equality checks
(==
, !=
) between the essentially Boolean values and 0
or 1
.float-comparison
now also covers indirect (in)equality tests
of the form a - b < c && b - a < c
.evaluation-order
has been split in two:
evaluation-order
now only triggers an alarm if the semantics
of an expression depends on the order of evaluation of its sub-expressions.
It does not consider multiple reads or writes of volatile variables.multiple-volatile-accesses
triggers an alarm for an expression
if there are at least two reads or two writes of a volatile object in that expression
and if the check evaluation-order
has not triggered an alarm for it.expression-order
has been replaced by two checks:
evaluation-order
check as described above, that triggers an alarm
if the semantics of an expression depends on the order of evaluation of its sub-expressionsevaluation-order-initializer
that triggers an alarm if the semantics
of an initializer list depends on the order of evaluation of its elements.//
-style comments are no longer treated
as a violation of the check sline-comment
. This modification affects
MISRA-C:2012 rule 3.1 and CERT rule MSC.4.if (2) {}the analyzer now reports
... expected essentially Boolean but is essentially signed at ...
ALARM (R): check boolean-control failed (violates M2012.14.4-required) at ...
evaluation-order
and expression-order
and fewer false notifications about ambiguities
due to side effects in expressions or initializers./* Active rule checks */
for rules fully covered with Astrée but only partially covered by the standalone RuleChecker.__astree_create_process()
, are no longer considered
to violate the check statement-sideeffect
used in rule 14.2.definition-duplicate
for rule 8.9
now show the locations of both involved definitions.parameter-match-type
checks for function calls
not matching the prototype of the called expression
(cf. ISO/IEC 9899:1999, §6.5.2.2p2). It is used for rule 1.1 and 16.6.identifier-hidden
for rule 5.2 and
max-locals
for rule 1.1 with respect to
compound expressions (GCC extension), removing false alarms about violations of these rules.evaluation-order
and expression-order
whenever an object is modified multiple times between
two sequence points. This affects rule 12.2.shift-with-constant
for rule 12.8
now additionally warns about too-wide shifts at compound assignments using <<=
or >>=
.include-syntax
for rule 19.3
now additionally warns about dangling tokens following the header-name token in the same line.definition-duplicate
for rule 8.6
now show the locations of both involved definitions.implicit-function-declaration
to rule 1.1.parameter-match-type
checks for function calls
not matching the prototype of the called expression
(cf. ISO/IEC 9899:1999, §6.5.2.2p2). It is used for rule 1.1.distinct-identifier-hidden
to remove false alarms
about violations of rule 5.3.identifier-unique-tag
for rule 5.7
no longer raises false alarms about forward declared tags.evaluation-order
and expression-order
whenever e an object is modified multiple times between
two sequence points. This affects rule 13.2.#
operator no longer cause false alarms about violations
of rule 20.7 by triggering the check macro-parameter-unparenthesized-expression
.essential-shift-width-constant
for rule 12.2
now additionally warns about too-wide shifts:
<<=
or >>=
include-syntax
for rule 20.3
now additionally warns about dangling tokens following the header-name token in the same line.//
-style comments are no longer treated
as a violation of the check sline-comment
, which affects rule 3.1.RuleChecker now supports the CWE (Common Weakness Enumeration) guidelines.
Double slashes within //
-style comments are no longer treated
as a violation of the check sline-comment
, which affects rule MSC.4.
parameter-match-type
._Static_assert
declarations
that cannot be proven to hold.Many additional rules have been added that cover the naming of all C identifiers. These rules are nested by identifier namespace, scope or similar.
%Filename%
, %Folder###%
, %bitsize%
and %Type%
to refer to the name of the current file, the ###
-th
parent folder of the current file, the bitsize of the entity’s type or the type itself.%Type%
can be configured
via the option type-abbreviations
.%Filename%
can be configured via the option file-name-modifier
.identifier-hidden
for rule X.A.5.14
with respect to compound expressions (GCC extension), removing false alarms about violations of this rule.evaluation-order
and expression-order
whenever an object is modified multiple times between two sequence points.
This affects the customer-specific rule X.A.5.34.shift-with-constant
for rule X.A.5.39
now also warns about too-wide shifts at compound assignments using <<=
or >>=
.Fixed the display of metric values in messages about violation of thresholds for cyclomatic complexity and nesting of control structures. The messages now show the exact value computed by the analyzer.