AutosarC++18_03-A7.2.1

An expression with enum underlying type shall only have values corresponding to the enumerators of the enumeration

Required inputs: IR, StaticSemanticAnalysis

Possible Messages

Key

Text

Severity

Disabled

asgn_interval_not_an_enumerator

Possible assignment of value which does not correspond to an enumerator (values computed by the analysis are [{int1};{int2}], they contain e.g. {int0} which does not correspond to an enumerator)

None

False

asgn_interval_out_of_enum_range

Possible assignment of value outside the enumerators (values computed by the analysis are [{int0};{int1}])

None

False

asgn_not_an_enumerator

Assignment of value {int0} which does not correspond to an enumerator

None

False

asgn_out_of_enum_range

Assignment of value {int0} outside the range of the enumerators

None

False

conversion_creating_bad_enum_value

Expression does not correspond to an enumerator in {}

None

False

Options

any_enum

any_enum : bool = True

Whether to check any enumeration. If false, scoped or enumerations based on a fixed type are not checked.
 

enum_kinds

enum_kinds : EnumKinds = 'Any'

Allow to restrict the check to certain enumeration types. Apart from 'Any' other meaningful choices are 'Unscoped_Unbased' for enumerations based on a fixed type or 'Scoped' for scoped enumerations.
 

with_predicate_analysis

with_predicate_analysis : bool = True

For enum assignment check, use an additional analysis step based on predicate abstraction for the analysis of enum values. It can reduce the number of false positives, but is potentially costly.
 

Option Types

These types are used by options listed above:

EnumKinds

An enumeration.
 
  • Any

  • Scoped

  • Unscoped_Unbased