C and C++


LANG.PREPROC.CBI : #includeの前のコード

要旨

#include 前処理指令の前にコードがあります。

プロパティ

クラス名 Code Before #include
日本語クラス名 #includeの前のコード
クラス分類 スタイル (style)
ニーモニック LANG.PREPROC.CBI
カテゴリー
MisraC2023 MisraC2023:20.1 #include directives should only be preceded by preprocessor directives or comments
Misra2012 Misra2012:20.1 #include directives should only be preceded by preprocessor directives or comments
Misra2004 Misra2004:19.1 #include statements in a file should only be preceded by other preprocessor directives or comments
AUTOSARC++14 AUTOSARC++14:M16-0-1 #include directives in a file shall only be preceded by other pre-processor directives or comments.
MisraC++2008 MisraC++2008:16-0-1 #include directives in a file shall only be preceded by preprocessor directives or comments.
MisraC++2023 MisraC++2023:19.0.3 #include directives should only be preceded by preprocessor directives or comments
CWE CWE:710 Improper Adherence to Coding Standards
JPL JPL:31 Do not place code or declarations before an #include directive.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっています。チェックを有効にするにはプロジェクト設定ファイル (configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += allow class="Code Before #include"

#include <stdlib.h>

static const int errflag=0xdeadbeef; /* 'Code Before #include' warning issued here */

#include <stdio.h>

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

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