C and C++


LANG.ID.NU.MK : マクロ名がCのキーワード

要旨

マクロがC言語のキーワードと同じ名前で定義されています。

プロパティ

クラス名 Macro Name is C Keyword
日本語クラス名 マクロ名がCのキーワード
クラス分類 スタイル (style)
ニーモニック LANG.ID.NU.MK
カテゴリー
MisraC2023 MisraC2023:20.4 A macro shall not be defined with the same name as a keyword
Misra2012 Misra2012:20.4 A macro shall not be defined with the same name as a keyword
Misra2004 Misra2004:19.4 C macros shall only expand to a braced initialiser, a constant, a string literal, a parenthesised expression, a type qualifier, a storage class specifier, or a do-whilezero construct
CWE CWE:710 Improper Adherence to Coding Standards
CERT-CPP CERT-CPP:DCL51-CPP Do not declare or define a reserved identifier
POW10 POW10:8 Limit the use of the preprocessor to file inclusion and simple macros.
JPL JPL:20 Make only very limited use of the C pre-processor.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Macro Name is C Keyword"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

#define for 1  /* 'Macro Name is C Keyword' warning issued here */       

#define FOR 1                           /* not an exact match to keyword 'for' */

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

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