C and C++


LANG.STRUCT.USING.DIRECTIVE : usingディレクティブの使用

要旨

usingディレクティブを使用しています。

このワーニングクラスは、Using Directive in Header File (ヘッダファイル内でのusingディレクティブの使用)の厳密な上位集合となります。

プロパティ

クラス名 Using Directive
日本語クラス名 usingディレクティブの使用
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.USING.DIRECTIVE
カテゴリー
AUTOSARC++14 AUTOSARC++14:M7-3-4 Using-directives shall not be used.
MisraC++2008 MisraC++2008:7-3-4 using-directives shall not be used.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Using Directive"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

namespace ns_directive{
  int dirA;
  int dirB;
}

namespace ns_declaration{
  int declA;
  int declB;
}

namespace ns_qualified{
  int qualA;
  int qualB;
}

using namespace ns_directive;  /* 'Using Directive' warning issued here */

using ns_declaration::declA;                 /* ok: using declaration (not directive) */

void lang_struct_using_directive(){
  ++dirA;
  ++declA;
  ++ns_qualified::qualA;                     /* ok: qualified identifier */
}

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

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