AutosarC++18_03-A16.7.1

The #pragma directive shall not be used

Required inputs: IR

Rationale

The #pragma directive is implementation-defined and causes the implementation to behave in implementation-defined manner.

Example
// $Id: A16-7-1.hpp 270497 2017-03-14 14:58:50Z piotr.tanski $
// #pragma once // Non-compliant - implementation-defined manner
#ifndef A16_7_1_HPP // Compliant - equivalent to #pragma once directive
#define A16_7_1_HPP

// ...

#endif
See Also
  • MISRA C++ 2008 [6]: Rule 16-6-1 All uses of the #pragma directive shall be documented.

Possible Messages

Key

Text

Severity

Disabled

pragma

Use of #pragma

None

False

Options

allowed_pragmas

allowed_pragmas : set[str] = set()

Pragmas to be allowed by default, i.e., no message is produced for these.