C and C++


LANG.ID.NU.TAG : 一意ではない識別子:タグ名

要旨

structunionenum のタグ名が他の(typedef名以外の)識別子と同一です。

関連したワーニングクラスについては Identifier Classes を参照してください。

プロパティ

クラス名 Non-unique Identifiers: Tag
日本語クラス名 一意ではない識別子:タグ名
クラス分類 スタイル (style)
ニーモニック LANG.ID.NU.TAG
カテゴリー
MisraC2023 MisraC2023:5.7 A tag name shall be a unique identifier
Misra2012 Misra2012:5.7 A tag name shall be a unique identifier
Misra2004 Misra2004:5.4 A tag name shall be a unique identifier
MisraC++2008 MisraC++2008:2-10-4 A class, union or enum name (including qualification, if any) shall be a unique identifier.
CWE CWE:710 Improper Adherence to Coding Standards
CERT-C CERT-C:DCL23-C Guarantee that mutually visible identifiers are unique
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Non-unique Identifiers: Tag"

解析プロジェクトにはファイル fileA.cfileB.c があるものとします。

/* LANG.ID.NU.TAG.a.c */

#define tagA 1
extern int tagB;
void tagC(void);
/* LANG.ID.NU.TAG.b.c */

struct tagA {int Aa; int Ab;}; /* 'Non-unique Identifiers: Tag' warning issued here */
enum tagB {Ba, Bb};            /* 'Non-unique Identifiers: Tag' warning issued here */
union tagC {int Ca; char Cb;}; /* 'Non-unique Identifiers: Tag' warning issued here */

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

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