JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++


PARSE.EVOOIR : enum Value Out of Integer Range

要旨

An unscoped enumeration (enum) with implicit underlying type contains an enumerator whose value cannot be represented in the integer type selected by the compiler for that enumeration.

An out-of-range enumerator value in a scoped enumeration, or in an unscoped enumeration with explicit underlying type, will trigger an enum Value Out of Underlying Range warning instead.

Enumerations that trigger warnings of this class will also trigger warnings of the following classes (when enabled).

プロパティ

クラス名 enum Value Out of Integer Range
日本語クラス名 enum Value Out of Integer Range
クラス分類 スタイル (style)
ニーモニック PARSE.EVOOIR
カテゴリー
AUTOSARC++14 AUTOSARC++14:A7-2-2 Enumeration underlying base type shall be explicitly defined.
  AUTOSARC++14:A7-2-3 Enumerations shall be declared as scoped enum classes.
MisraC++2023 MisraC++2023:10.2.1 An enumeration shall be defined with an explicit underlying type
  MisraC++2023:10.2.2 Unscoped enumerations should not be declared
対応言語 C および C++ で利用可能です。
有効/無効設定 Checks for this warning class are enabled by default. However, warning instances of this class that are issued as parser errors (rather than parser warnings) will be discarded when using factory configuration settings. To prevent these instances from being discarded, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="enum Value Out of Integer Range"
To disable checks for this warning class, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="enum Value Out of Integer Range"

#include <climits>

// The code in this file will typically cause compiler errors.

// All compilers can be expected to choose an underlying type that
// is capable of representing the values in ColorUnscopedDefaultVals.
enum ColorUnscopedDefaultVals {         // ('Unscoped Enumeration' warning issued here when enabled)
    red,                                // red==0
    orange                              // orange==1
};

// There are integer types capable of representing INT_MAX+1.
// Many compilers will choose one of these types as the underlying type for
// ColorUnscopedIntMax, in which case no 'enum Value Out of Integer Range'
// warning is issued.
// If the compiler does not choose  one of these types, an
// 'enum Value Out of Integer Range' warning is issued at the line marked ***.
enum ColorUnscopedIntMax {              // ('Enumeration Has Implicit Underlying Type' warning issued here when enabled)
                                        // ('Unscoped Enumeration' warning issued here when enabled)
    yellow=INT_MAX,
    green                               // green==INT_MAX+1  ***
};

// Many compilers do not provide an integer type capable of
// representing ULLONG_MAX+1.
// Even compilers that provide such a type may not choose to use it as
// the underlying type for ColorUnscopedUllongMax.
// In these cases an 'enum Value Out of Integer Range' warning is
// issued as shown below.
enum ColorUnscopedUllongMax {           // ('Enumeration Has Implicit Underlying Type' warning issued here when enabled)
                                        // ('Unscoped Enumeration' warning issued here when enabled)
    blue=ULLONG_MAX,
    indigo              // 'enum Value Out of Integer Range' warning issued here
                        // - indigo==ULLONG_MAX+1
};

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。

 

To report problems with this documentation, please visit https://support.codesecure.com/.