C and C++


LANG.PREPROC.NOFPAREN : 括弧で囲まれていないマクロ引数

要旨

関数形式のマクロの本体が、一つ以上の括弧で囲まれていないマクロパラメータを含みます。

プロパティ

クラス名 Macro Parameter Not Parenthesized
日本語クラス名 括弧で囲まれていないマクロ引数
クラス分類 スタイル (style)
ニーモニック LANG.PREPROC.NOFPAREN
カテゴリー
MisraC2023 MisraC2023:20.7 Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses
Misra2012 Misra2012:20.7 Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses
AUTOSARC++14 AUTOSARC++14:A16-0-1 The pre-processor shall only be used for unconditional and conditional file inclusion and include guards, and using the following directives: (1) #ifndef, (2) #ifdef, (3) #if, (4) #if defined, (5) #elif, (6) #else, (7) #define, (8) #endif, (9) #include.
  AUTOSARC++14:M16-0-6 In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ##.
MisraC++2008 MisraC++2008:16-0-6 In the definition of a function-like macro, each instance of a parameter shall be enclosed in parentheses, unless it is used as the operand of # or ## .
MisraC++2023 MisraC++2023:19.3.4 Parentheses shall be used to ensure macro arguments are expanded appropriately
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Macro Parameter Not Parenthesized"

#define M1( a, b ) ( a + b )              /* 'Macro Parameter Not Parenthesized' warning issued here
                                           * - 2 instances: one each for the unparenthesized uses of a and b
                                           */

#define M2( a, b ) ( ( a ) + ( b ) )                /* all occurrences of a and b in the body are parenthesized */

#define M3( a, b ) ( ( a ) + ( b ) + a )  /* 'Macro Parameter Not Parenthesized' warning issued here */

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

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