JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++


LANG.PREPROC.INCL.MF : Malformed #include

Summary

The #include or #include_next preprocessor directive is not followed by a string of the form <filename> or "filename".

Note that many such malformed directives will trigger parse errors, either in your native compiler or in the CodeSonar parser. Such a parse error will prevent a Malformed #include warning from being issued; correcting the parse error will also correct the malformedness problem.

This warning class is a strict subset of Inappropriate Include File Specification.

Properties

Class Name Malformed #include
Significance style
Mnemonic LANG.PREPROC.INCL.MF
Categories
MisraC2025 MisraC2025:20.3 The #include directive shall be followed by either a <filename> or "filename" sequence
MisraC2023 MisraC2023:20.3 The #include directive shall be followed by either a <filename> or "filename" sequence
Misra2012 Misra2012:20.3 The #include directive shall be followed by either a <filename> or "filename" sequence
Misra2004 Misra2004:19.3 The #include directive shall be followed by either a <filename> or "filename" sequence
MisraC++2008 MisraC++2008:16-2-6 The #include directive shall be followed by either a <filename> or "filename" sequence.
MisraC++2023 MisraC++2023:19.2.2 The #include directive shall be followed by either a <filename> or "filename" sequence
JSF++ JSF++:33 The #include directive shall use the <filename.h> notation to include header files.
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Malformed #include"

Example

Many compilers will fail with an error if they encounter a malformed #include directive. If you are using such a compiler you will generally detect and resolve bugs of this class at compilation time, before the CodeSonar analysis runs.

#include "stdio.h"                       /* has form "filename" */

/* Attempting to compile with a malformed #include will cause an error
 * in many compilers, so we preprocess this line out to ensure the
 * example can be compiled. CodeSonar will still issue a warning.
 */
#if 0
#include otherheader.h /* 'Malformed #include' issued here */
#endif

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.codesecure.com/.