C and C++


LANG.PREPROC.NOENDIF : No Matching #endif

Summary

A source file contains a #if, #ifdef, or #ifndef directive without a subsequent matching #endif.

Properties

Class Name No Matching #endif
Significance style
Mnemonic LANG.PREPROC.NOENDIF
Categories
MisraC2023 MisraC2023:20.14 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related
Misra2012 Misra2012:20.14 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related
Misra2004 Misra2004:19.17 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related
AUTOSARC++14 AUTOSARC++14:M16-1-2 All #else, #elif and #endif pre-processor directives shall reside in the same file as the #if or #ifdef directive to which they are related.
MisraC++2008 MisraC++2008:16-1-2 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if or #ifdef directive to which they are related.
MisraC++2023 MisraC++2023:19.1.2 All #else, #elif and #endif preprocessor directives shall reside in the same file as the #if, #ifdef or #ifndef directive to which they are related
CWE CWE:710 Improper Adherence to Coding Standards
JPL JPL:23 Place #else, #elif, and #endif in the same file as the matching #if or #ifdef.
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="No Matching #endif"

Example

#if 1 /* 'No Matching #endif' warning issued here */

Relevant Configuration File Parameters

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