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++


DIAG.MISRA.ETYPE : Essential Type Diagnostic

Summary

An Essential Type Diagnostic warning is reported at every code location corresponding to an unnormalized C/C++ AST of class cc:expr (that is, an expression). The warning reports the essential type category of the expression and presents a rendering of the associated cc:expr AST.

If this warning class is enabled, there will be generally be a very large number of Essential Type Diagnostic warnings for all but the most trivial programs. If you are trying to determine the essential types of only a few expressions within your program, use multiple clauses in your WARNING_FILTER allow rule to ensure you only enable Essential Type Diagnostic warnings that are useful to you. For example, suppose that you are only interested in the essential types of expressions in source file problemfile.c. Then your WARNING_FILTER allow rule will be:

WARNING_FILTER += allow class="Essential Type Diagnostic" file=problemfile.c

Properties

Class Name Essential Type Diagnostic
Significance diagnostic
Mnemonic DIAG.MISRA.ETYPE
Categories None
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default, and require the unnormalized C ASTs for the project. To enable them, add the following WARNING_FILTER rule and RETAIN_UNNORMALIZED_C_AST specification to the project configuration file. To enable checks you will also need to set special-purpose parameter ESSENTIAL_TYPE_DIAGNOSTIC_ENABLED=Yes: this is provided as a fail-safe against accidentally enabling the Essential Type Diagnostic class because of the very large number of warnings typically issued.
RETAIN_UNNORMALIZED_C_AST = Yes
ESSENTIAL_TYPE_DIAGNOSTIC_ENABLED = Yes
WARNING_FILTER += allow class="Essential Type Diagnostic"
Note that retaining the unnormalized ASTs will increase the disk space used to store the project representation, and may make the analysis take longer.

This class is for analysis diagnostics, rather than for warning about issues in your code. As such, it is generally not enabled by CodeSonar presets. In particular, it is not enabled by the all_warningclasses preset.

Example

int diag_misra_etype(int x){
    short y;
    y = 5;         /* 'Essential Type Diagnostic' warning issued here, reporting essential type 'signed/short' */
    return x + y;  /* 'Essential Type Diagnostic' warning issued here, reporting essential type 'signed/int' */
}

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