AutosarC++19_03-A16.2.1¶
The ‘, “, /*, //, characters shall not occur in a header file name or in #include directive
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
It is undefined behavior if the ’, ", /*, //, \\ characters are used in #include directive, between < and > or “ ” delimiters.
Example
// $Id: A16-2-1.cpp 271687 2017-03-23 08:57:35Z piotr.tanski $
// #include <directory/headerfile.hpp> // Compliant
// #include <headerfile.hpp> // Compliant
// #include "directory/headerfile.hpp" // Compliant
// #include "headerfile.hpp" // Compliant
// #include <directory/*.hpp> // Non-compliant
// #include <header’file.hpp> // Non-compliant
// #include <"headerfile.hpp"> // Non-compliant
// #include <directory\\headerfile.hpp> // Non-compliant
See Also
- MISRA C++ 2008 [7]: Rule 16-2-4 The ’, ", /* or // characters shall not occur in a header file name.
- MISRA C++ 2008 [7]: Rule 16-2-5 The \character shall not occur in a header file name.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
nonstandard_include_character |
Non-standard character in #include directive |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
check_quotation_mark¶
check_quotation_mark : bool = True
forbidden¶
forbidden : set[str] = {"'", '/*', '//', '\'}