C and C++


LANG.PREPROC.INVALID : 無効なプリプロセッサディレクティブ

要旨

行が#で始まっていますが、有効なプリプロセスディレクティブを使用していません。

プロパティ

クラス名 Invalid Preprocessor Directive
日本語クラス名 無効なプリプロセッサディレクティブ
クラス分類 信頼性 (reliability)
ニーモニック LANG.PREPROC.INVALID
カテゴリー
MisraC2023 MisraC2023:20.13 A line whose first token is # shall be a valid preprocessing directive
Misra2012 Misra2012:20.13 A line whose first token is # shall be a valid preprocessing directive
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-8 If the # token appears as the first token on a line, then it shall be immediately followed by a pre-processing token.
MisraC++2008 MisraC++2008:16-0-8 If the # token appears as the first token on a line, then it shall be immediately followed by a preprocessing token.
MisraC++2023 MisraC++2023:19.0.1 A line whose first token is # shall be a valid preprocessing directive
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Invalid Preprocessor Directive"

/* following is ok: inside a comment*/
/*
#in a comment
*/

#define AAA 2

#ifndef AAA
#define BBB 1
#else1           /* 'Invalid Preprocessor Directive' warning issued here */
#define CCC 2
#endif

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

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