C and C++


LANG.STRUCT.BGOTO : 戻るgoto文

要旨

goto 文が、後方に戻るラベルを参照しています。

このクラスは goto 文の使用 の部分集合となります。

プロパティ

クラス名 Backwards goto
日本語クラス名 戻るgoto文
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.BGOTO
カテゴリー
MisraC2023 MisraC2023:15.2 The goto statement shall jump to a label declared later in the same function
Misra2012 Misra2012:15.2 The goto statement shall jump to a label declared later in the same function
Misra2004 Misra2004:14.4 The goto statement shall not be used
AUTOSARC++14 AUTOSARC++14:M6-6-2 The goto statement shall jump to a label declared later in the same function body.
MisraC++2008 MisraC++2008:6-6-2 The goto statement shall jump to a label declared later in the same function body.
MisraC++2023 MisraC++2023:9.6.1 The goto statement should not be used
  MisraC++2023:9.6.3 The goto statement shall jump to a label declared later in the function body
JSF++ JSF++:189 The goto statement shall not be used.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Backwards goto"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

int backwardsgoto(int i){
     int x=0;
 l1: x++;
     if (x >= i) goto l1;  /* 'Backwards Goto' warning issued here */
     return x;
}

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

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