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.ZLBFMBU : Zero Length Bit Field Must Be Unnamed

要旨

A zero-length bit-field is defined with a name.

This warning class is derived from a C/C++ parser warning.

プロパティ

クラス名 Zero Length Bit Field Must Be Unnamed
日本語クラス名 Zero Length Bit Field Must Be Unnamed
クラス分類 スタイル (style)
ニーモニック PARSE.ZLBFMBU
カテゴリー
Misra2004 Misra2004:6.5 Bit fields of signed type shall be at least 2 bits long
AUTOSARC++14 AUTOSARC++14:M9-6-4 Named bit-fields with signed integer type shall have a length of more than one bit.
MisraC++2008 MisraC++2008:9-6-4 Named bit-fields with signed integer type shall have a length of more than one bit.
MisraC++2023 MisraC++2023:12.2.1 Bit fields 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="Zero Length Bit Field Must Be Unnamed"
To disable checks for this warning class, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Zero Length Bit Field Must Be Unnamed"

struct bad{
    char c;
    int empty : 0; /* 'Zero Length Bit Field Must Be Unnamed' warning issued here */
    int flags : 16;               /* not zero-width */
};

struct good{
    char c;
    int: 0;                      /* not named */
    int flags : 16;              /* not zero-width */
};

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

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

 

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