C and C++


LANG.STRUCT.DECL.MISSINGDECL : No Previous Declaration

要旨

A function or object with external linkage is defined, but has no visible (non-defining) declaration.

プロパティ

クラス名 No Previous Declaration
日本語クラス名 No Previous Declaration
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.DECL.MISSINGDECL
カテゴリー
MisraC2023 MisraC2023:8.4 A compatible declaration shall be visible when an object or function with external linkage is defined
Misra2012 Misra2012:8.4 A compatible declaration shall be visible when an object or function with external linkage is defined
Misra2004 Misra2004:8.1 Functions shall have prototype declarations and the prototype shall be visible at both the function definition and call
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="No Previous Declaration"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

extern void f1(void);
void f1(void) {}                          /* ok: previously declared */

static void f2(void) {}                   /* ok: no external linkage */

void f3(void) {}           /* 'No Previous Declaration' warning issued here
                            * - there is no (non-defining) declaration for func3()
                            */

void f4(void) {}           /* 'No Previous Declaration' warning issued here
                            * - there is a declaration, but it is after this definition
                            */
extern void f4(void);

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

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