Macros (Section 11)

These flags control expansion and checking of macro definitions and invocations.
「Macros」フラグは、拡張とマクロ定義や呼び出しのチェックを指定します。

Macro Expansion マクロ展開

These flags control which macros are checked as functions or constants, and which are expanded inthe pre-processing phase.
Macros preceded by /*@notfunction@*/ are never expanded regardless
of these flag settings. These flags may be used in source-file control comments.
「Macro Expansion」フラグは、マクロのチェック方法を指定します。チェックする方法は、下記のいずれかより指定します。
  • 関数または、定数としてチェックする。
  • プリプロセッシングで展開した後にチェックする。
但し、ソースファイル内に、/*@notfunction@*/が存在する場合、それ以降のマクロは、マクロ展開フラグの指定に関係なく、マクロを展開せずにチェックを実施します。

  • 【P: -】fcn-macros
Macros defined with parameter lists are not expanded and are checked as functions.
引数(パラメータ)が定義されているマクロは、展開せずに関数としてチェックされます。
  • 【P: -】const-macros
Macros defined without parameter lists are not expanded and are checked as constants.
引数(パラメータ)が定義されていないマクロは、展開せずに定数としてチェックされます。
  • 【shortcut】all-macros
Sets fcn-macros and const-macros.
fcn-macros および、const-macrosを有効にします。
  • 【P: -】lib-macros
Macros defining identifiers declared in a loaded library are not expanded and are checked according to the library information.
ライブラリで宣言されている識別子を利用しているマクロは、展開せずにライブラリ情報にてチェックされます。

Macro Definitions マクロ定義

These flags control what errors are reported in macro definitions.
これらのフラグは、マクロ定義でおこなうチェックを指定します。

  • 【m:-+++】macro-stmt
Macro definition is not syntactically equivalent to function.
This means if the macro is used as a statement (e.g., if (test) macro();) unexpected behavior may result.
One fix is to surround the macro body with do { … } while (FALSE).
マクロ定義が、機能するための構文として正しくありません。
このような方法でマクロ文を利用した場合、予期できない処理を実施する可能性があります。(例えば、if (test) macro();)
解決策の一つとして、マクロ文を囲む方法があります。(例えば、do { … } while (FALSE))
  • 【m:-+++】macro-return
The body of a macro declared as a function uses a return statement.
マクロ定義を関数のreturn文で使用しています。
This exhibits behavior that could not be implemented by a function.
これは、関数によって実行できなかった振舞いを示します。
  • 【m:-+++】macro-assign
A macro parameter is used as the left side of an assignment expression.
マクロパラメータが、代入式の左側に割り当てられます。
  • 【m:-+++】macro-parens
A macro parameter is used without parentheses (in potentially dangerous context).
マシン・パラメータが、括弧なしで使用されている。(潜在的に危険)
  • 【m:---+】macro-empty
Macro definition of a function is empty.
マクロ関数の定義は空です。
  • 【m:-+++】macro-redef
Macro is redefined. There is another macro defined with the same name.
マクロが再定義されている。別のマクロが、同じ名前で定義されている。
  • 【m:-+++】macro-unrecog
An unrecognized identifier appears in a macro definition.
Since the identifier may be defined where the macro is used, this could be okay,
but Splint will not be able to check the unrecognized identifier appropriately.
マクロ定義で、認識されていない識別子が表示されます。
マクロが使われる場所で識別子が定義されている可能性があるので、問題では無いかも知れません。
しかし、Splintは適切に認められていない識別子をチェックすることができません。
最終更新:2008年12月12日 20:32