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++


LANG.TYPE.BFSHORT : Signed One Bit Field

要旨

(明示的もしくは暗黙的な)符号付き整数型のビットフィールドの幅が 1ビットで定義されています。

プロパティ

クラス名 Signed One Bit Field
日本語クラス名 Signed One Bit Field
クラス分類 スタイル (style)
ニーモニック LANG.TYPE.BFSHORT
カテゴリー
MisraC2025 MisraC2025:6.2 Single-bit named bit-fields shall not be of a signed type
MisraC2023 MisraC2023:6.2 Single-bit named bit-fields shall not be of a signed type
Misra2012 Misra2012:6.2 Single-bit named bit fields shall not be of a signed type
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
  MisraC++2023:12.2.3 A named bit-field with signed integer type shall not have a length of one bit
対応言語 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="Signed One Bit Field"
To disable checks for this warning class, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Signed One Bit Field"

typedef int plainint;
typedef signed int signedint;
typedef unsigned int uint;

struct widthstruct{
  signed int si1      : 2;
  signed int si2      : 1; /* 'Signed One Bit Field' warning issued here */
  signedint si3       : 1; /* 'Signed One Bit Field' warning issued here */
  unsigned int si4    : 1;
  uint si5            : 1;
  int si6             : 1; /* 'Signed One Bit Field' warning issued here */
  plainint si7        : 1; /* 'Signed One Bit Field' warning issued here */
};

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

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

 

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