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.STRUCT.EBS : 空の分岐命令

要旨

分岐命令の中身が、空もしくは意味のない実行文となっています。

プロパティ

複数のワーニングクラスでこのニーモニックを共有しています。

これら全てのワーニングクラスのチェックはデフォルトで 有効になっています。チェックを全て無効にするには、プロジェクト設定ファ イル(configuration file)に以下の WARNING_FILTER ルールを追加し てください。

WARNING_FILTER += discard categories:LANG.STRUCT.EBS
クラス名 Empty Branch Statement
日本語クラス名 空の分岐命令
クラス分類 冗長性 (redundancy)
ニーモニック LANG.STRUCT.EBS
カテゴリー
CERT-C CERT-C:EXP15-C Do not place a semicolon on the same line as an if, for, or while statement
  CERT-C:MSC12-C Detect and remove code that has no effect or is never executed
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Empty Branch Statement"
クラス名 Empty for Statement
日本語クラス名 空のfor文
クラス分類 冗長性 (redundancy)
ニーモニック LANG.STRUCT.EBS
カテゴリー
CERT-C CERT-C:EXP15-C Do not place a semicolon on the same line as an if, for, or while statement
  CERT-C:MSC12-C Detect and remove code that has no effect or is never executed
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Empty for Statement"
クラス名 Empty if Statement
日本語クラス名 空のif文
クラス分類 冗長性 (redundancy)
ニーモニック LANG.STRUCT.EBS
カテゴリー
CWE CWE:390 Detection of Error Condition Without Action
CERT-C CERT-C:EXP15-C Do not place a semicolon on the same line as an if, for, or while statement
  CERT-C:MSC12-C Detect and remove code that has no effect or is never executed
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Empty if Statement"
クラス名 Empty switch Statement
日本語クラス名 空のswitch文
クラス分類 冗長性 (redundancy)
ニーモニック LANG.STRUCT.EBS
カテゴリー
CERT-C CERT-C:EXP15-C Do not place a semicolon on the same line as an if, for, or while statement
  CERT-C:MSC12-C Detect and remove code that has no effect or is never executed
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Empty switch Statement"
クラス名 Empty while Statement
日本語クラス名 空のwhile文
クラス分類 冗長性 (redundancy)
ニーモニック LANG.STRUCT.EBS
カテゴリー
CERT-C CERT-C:EXP15-C Do not place a semicolon on the same line as an if, for, or while statement
  CERT-C:MSC12-C Detect and remove code that has no effect or is never executed
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Empty while Statement"

int lang_struct_ebs(int a){
    int x = 1;
    if (a < 5);  /* 'Empty if Statement' warning issued here
                  * - semicolon means conditional has no effect
                  */
    {
        x = x+5;;
    }

    switch(a);   /* 'Empty switch Statement' warning issued here */

    while(0);    /* 'Empty while Statement' warning issued here */
        x++;

    for(;;);     /* 'Empty for Statement' warning issued here */
        x++;

    return x;
}

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

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

 

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