Main Content

MISRA C:2012 Rule 20.2

The ', " or \ characters and the /* or // character sequences shall not occur in a header file name

Description

Rule Definition

The ', " or \ characters and the /* or // character sequences shall not occur in a header file name.

Rationale

The program’s behavior is undefined if:

  • You use ', ", \, /* or // between < > delimiters in a header name preprocessing token.

  • You use ', \, /* or // between " delimiters in a header name preprocessing token.

Although \ results in undefined behavior, many implementations accept / in its place.

Polyspace Implementation

Polyspace® flags the characters ', ", \, /* or // between < and > in #include <filename>.

Polyspace flags the characters ', \, /* or // between " and " in #include "filename".

Additional Message in Report

The ', "or \ characters and the /* or // character sequences shall not occur in a header file name.

Troubleshooting

If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.

Check Information

Group: Preprocessing Directives
Category: Required
AGC Category: Required