MISRA C++:2008 Rule 7-4-2
Assembler instructions shall only be introduced using the asm declaration.
説明
ルール定義
Assembler instructions shall only be introduced using the asm declaration. 1
根拠
asm 宣言はすべての C++ 実装で使用できますが、2
アセンブラ命令を導入するための他の方法は使用できない可能性があります。asm 宣言を使用すると、コードが実装全体で移植可能になります。
Polyspace 実装
ルール チェッカーは、asm 宣言以外の方法の使用をルール違反として報告します。
たとえば、ルール チェッカーは、次のような asm 宣言を許可します。
asm("ADD a0,1")#pragma asm を介して導入された場合は、チェッカーが違反を報告します。#pragma asm "ADD a0,1" #pragma endasm
トラブルシューティング
ルール違反が想定されるものの、Polyspace® から報告されない場合は、コーディング規約違反が想定どおりに表示されない理由の診断を参照してください。
例
チェック情報
| グループ: Declarations |
| カテゴリ: 必要 |
バージョン履歴
R2013b で導入
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.
2 How the asm declaration is implemented might vary across compilers. See also AUTOSAR C++14 Rule A7-4-1.