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.CBI : Code Before #include

Summary

Code was placed before an #include directive.

Properties

Class Name Code Before #include
Significance style
Mnemonic LANG.PREPROC.CBI
Categories
MisraC2025 MisraC2025:20.1 #include directives should only be preceded by preprocessor directives or comments
MisraC2023 MisraC2023:20.1 #include directives should only be preceded by preprocessor directives or comments
Misra2012 Misra2012:20.1 #include directives should only be preceded by preprocessor directives or comments
Misra2004 Misra2004:19.1 #include statements in a file should only be preceded by other preprocessor directives or comments
AUTOSARC++14 AUTOSARC++14:M16-0-1 #include directives in a file shall only be preceded by other pre-processor directives or comments.
MisraC++2008 MisraC++2008:16-0-1 #include directives in a file shall only be preceded by preprocessor directives or comments.
MisraC++2023 MisraC++2023:19.0.3 #include directives should only be preceded by preprocessor directives or comments
CWE CWE:710 Improper Adherence to Coding Standards
JPL JPL:31 Do not place code or declarations before an #include directive.
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="Code Before #include"

Example

#include <stdlib.h>

static const int errflag=0xdeadbeef; /* 'Code Before #include' warning issued here */

#include <stdio.h>

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/.