C and C++


LANG.STRUCT.DECL.FAM : フレキシブル配列メンバの宣言

要旨

フレキシブル配列メンバを含む構造体が宣言されています。

プロパティ

クラス名 Declaration of Flexible Array Member
日本語クラス名 フレキシブル配列メンバの宣言
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.DECL.FAM
カテゴリー
MisraC2023 MisraC2023:18.7 Flexible array members shall not be declared
Misra2012 Misra2012:18.7 Flexible array members shall not be declared
AUTOSARC++14 AUTOSARC++14:A18-1-1 C-style arrays shall not be used.
CERT-C CERT-C:MEM33-C Allocate and copy structures containing a flexible array member dynamically
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Declaration of Flexible Array Member"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

struct FAM_struct {  int len;  int data[];};         /* 'Declaration of Flexible Array Member' warning issued here */

struct  {  int len;  int data[];} FAM_val;           /* 'Declaration of Flexible Array Member' warning issued here */

typedef struct {  int len;  int data[];} FAM_type;   /* 'Declaration of Flexible Array Member' warning issued here */

struct  { int len; int data[];} prot_retFAM(void);   /* 'Declaration of Flexible Array Member' warning issued here */

struct fixedarr_struct {  int len;  int data[5];};                         /* fixed-length array */

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

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