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


DIAG.MISRA.ETYPE : 実質的な型の識別

要旨

Essential Type Diagnosticの警告は、cc:exprクラス(つまり、式)の非正規化AST(unnormalized C/C++ AST) に対応する全てのコード箇所で発行されます。 このワーニングは、式のessential type categoryをレポートすることに加えて、関連付けられたcc:expr ASTのレンダリングを提供します。.

もしこのワーニングクラスが有効化されますと、非常に小さいプログラムを除いて、一般的に非常に多くのEssential Type Diagnosticのワーニングが発行されます。 プログラム内の少数の式の実質的な型の判別する場合は、コンフィグレーションファイル内の WARNING_FILTER allow のルール及び設定句を使用して、必要とする実質的な型のワーニングのみを検出可能にします。 例えば、ソースファイル problemfile.cに含まれる式の実質的な型に興味がある場合、 WARNING_FILTER allow での設定は下記の様になります:

WARNING_FILTER += allow class="Essential Type Diagnostic" file=problemfile.c

プロパティ

クラス名 Essential Type Diagnostic
日本語クラス名 実質的な型の識別
クラス分類 診断 (diagnostic)
ニーモニック DIAG.MISRA.ETYPE
カテゴリー なし
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。 加えて、このワーニングクラスを有効にする為には、本ワーニングクラス 向けの特殊パラメータであるESSENTIAL_TYPE_DIAGNOSTIC_ENABLED=Yes: を更に設定する必要がありま す。これらの設定は、意図せずEssential Type Diagnosticのワーニングクラス を有効化してしまった場合における、極めて大きな数の Essential Type Diagnosticのワーニングが発行されるという事態を防ぐフェイ ルセーフの役割を果たします。
RETAIN_UNNORMALIZED_C_AST = Yes
ESSENTIAL_TYPE_DIAGNOSTIC_ENABLED = Yes
WARNING_FILTER += allow class="Essential Type Diagnostic"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

int diag_misra_etype(int x){
    short y;
    y = 5;         /* 'Essential Type Diagnostic' warning issued here, reporting essential type 'signed/short' */
    return x + y;  /* 'Essential Type Diagnostic' warning issued here, reporting essential type 'signed/int' */
}

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

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

 

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