メインコンテンツ

PolyspaceBug Finder でサポートされている静的に強制可能な AUTOSAR C++14 ルール

AUTOSAR C++14 規約では、静的に強制可能なルールが "Automated" および "Partially automated" として分類されます。Polyspace® は合計で、349 件のうち 349 件をサポートしています。 1 静的解析ツールで強制可能な AUTOSAR C++14 コーディング ルール。

Automated ルール

AUTOSAR C++14 規約に基づき、静的解析ツールは "Automated" ルールのすべての違反を検出します。Polyspace Bug Finder は、静的解析ツールで強制可能な "Automated" ルール 327 件のうち、327 件をサポートしています。AUTOSAR C++14 規約には、静的解析ツールで強制不可能な "Automated" ルール 2 件が含まれています。

"Automated" AUTOSAR C++14 を確認するには、次のようにします。

  1. Polyspace デスクトップ ユーザー インターフェイスの [構成] ペインで [コーディング規約およびコード メトリクス] ノードを見つけます。[ファイルごとにチェッカーを設定] を選択して [開く] をクリックします。あるいはコマンド ラインでコマンド polyspace-checkers-selection を使用します。

  2. 新しいチェッカー ファイルを作成するため、[チェッカーの選択] ウィンドウで [新規] をクリックします。すでに選択されているコーディング ルールを選択解除します。

  3. コーディング規約と欠陥のリストで [AUTOSAR C++14] を選択します。

  4. [決定可能] チェックボックスをオンにします。

  5. 選択したルールを XML ファイルとして保存します。

XML ファイルには、AUTOSAR C++14 規約により "Automated" に分類されるコーディング ルールがリストされています。

Partially Automated ルール

AUTOSAR C++14 規約に基づき、静的解析ツールは "Partially Automated" ルールに対するすべての潜在的な違反のサブセットのみを検出します。Polyspace Bug Finder は、"Partially Automated" ルール 22 件のうち 22 件をサポートしています。Polyspace が検出するルールのエラー シナリオの詳細については、そのルールのリファレンス ページの [Polyspace 実装] セクションを参照してください。

Polyspace は次の "Partially Automated" ルールをサポートしています。

AUTOSAR C++14 Rule説明Polyspace チェッカー
AUTOSAR C++14 Rule A0-4-4Range, domain and pole errors shall be checked when using math functionsAUTOSAR C++14 Rule A0-4-4
AUTOSAR C++14 Rule A12-0-2Bitwise operations and operations that assume data representation in memory shall not be performed on objectsAUTOSAR C++14 Rule A12-0-2
AUTOSAR C++14 Rule A12-1-5Common class initialization for non-constant members shall be done by a delegating constructorAUTOSAR C++14 Rule A12-1-5
AUTOSAR C++14 Rule A12-8-3Moved-from object shall not be read-accessedAUTOSAR C++14 Rule A12-8-3
AUTOSAR C++14 Rule A14-5-2Class members that are not dependent on template class parameters should be defined in a separate base classAUTOSAR C++14 Rule A14-5-2
AUTOSAR C++14 Rule A15-0-2At least the basic guarantee for exception safety shall be provided for all operations.In addition, each function may offer either the strong guarantee or the nothrow guaranteeAUTOSAR C++14 Rule A15-0-2
AUTOSAR C++14 Rule A15-0-7Exception handling mechanism shall guarantee a deterministic worst-case time execution timeAUTOSAR C++14 Rule A15-0-7
AUTOSAR C++14 Rule A15-1-4If a function exits with an exception, then before a throw, the function shall place all objects/resources that the function constructed in valid states or it shall delete them.AUTOSAR C++14 Rule A15-1-4
AUTOSAR C++14 Rule A15-2-2If a constructor is not noexcept and the constructor cannot finish object initialization, then it shall deallocate the object's resources and it shall throw an exceptionAUTOSAR C++14 Rule A15-2-2
AUTOSAR C++14 Rule A15-3-3Main function and a task main function shall catch at least: base class exceptions from all third-party libraries used, std::exception and all otherwise unhandled exceptionsAUTOSAR C++14 Rule A15-3-3
AUTOSAR C++14 Rule A15-5-2Program shall not be abruptly terminated.In particular, an implicit or explicit invocation of std::abort(), std::quick_exit(), std::_Exit(), std::terminate() shall not be doneAUTOSAR C++14 Rule A15-5-2
AUTOSAR C++14 Rule A18-5-2Non-placement new or delete expressions shall not be usedAUTOSAR C++14 Rule A18-5-2
AUTOSAR C++14 Rule A18-5-5Memory management functions shall ensure the following: (a) deterministic behavior resulting with the existence of worst-case execution time, (b) avoiding memory fragmentation, (c) avoid running out of memory, (d) avoiding mismatched allocations or deallocations, (e) no dependence on non-deterministic calls to kernelAUTOSAR C++14 Rule A18-5-5
AUTOSAR C++14 Rule A18-5-8Objects that do not outlive a function shall have automatic storage durationAUTOSAR C++14 Rule A18-5-8
AUTOSAR C++14 Rule A3-1-5A function definition shall only be placed in a class definition if (1) the function is intended to be inlined (2) it is a member function template (3) it is a member function of a class templateAUTOSAR C++14 Rule A3-1-5
AUTOSAR C++14 Rule A5-1-1Literal values shall not be used apart from type initialization, otherwise symbolic names shall be used insteadAUTOSAR C++14 Rule A5-1-1
AUTOSAR C++14 Rule A5-3-2Null pointers shall not be dereferencedAUTOSAR C++14 Rule A5-3-2
AUTOSAR C++14 Rule A9-3-1Member functions shall not return non-constant "raw" pointers or references to private or protected data owned by the classAUTOSAR C++14 Rule A9-3-1
AUTOSAR C++14 Rule A9-6-1Data types used for interfacing with hardware or conforming to communication protocols shall be trivial, standard-layout and only contain members of types with defined sizesAUTOSAR C++14 Rule A9-6-1
AUTOSAR C++14 Rule M5-0-2Limited dependence should be placed on C++ operator precedence rules in expressions.AUTOSAR C++14 Rule M5-0-2
AUTOSAR C++14 Rule M5-8-1The right hand operand of a shift operator shall lie between zero and one less than the width in bits of the underlying type of the left hand operand.AUTOSAR C++14 Rule M5-8-1
AUTOSAR C++14 Rule M6-2-2Floating-point expressions shall not be directly or indirectly tested for equality or inequality.AUTOSAR C++14 Rule M6-2-2

参考

トピック


1 The AUTOSAR C++14 standard contains 351 statically enforceable rules. The rules A0-4-3 and A1-4-3 are not enforceable by a static analysis tool. These rules might be enforced by your compiler.