MISRA C:2012 Rule 1.1
The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation’s translation limits
Description
Rule Definition
The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation’s translation limits.
Polyspace Implementation
The rule checker checks for the issues below. Note that:
The specifications can depend on the version of the C standard used in the analysis. See
C standard version (-c-version)
.You can change some of the limits used by the checker using the option
-code-behavior-specifications
. See-code-behavior-specifications
.
Issue | C Standard Dependence | Additional Information |
---|---|---|
An integer constant falls outside the range of long
int (if the constant is signed) or
unsigned long int (if the constant is
unsigned). | Checked for C90 only. | The rule checker uses your specifications for the size of a
long int variable (typically 32 bits).
See also Target processor type
(-target) . |
An array of size zero is used. | Checked for C90 only. | |
The number of macros defined in a translation unit exceeds the limit specified in the standard. | Number of macro definitions allowed:
| A translation unit consists of a source file together with headers included directly or indirectly in the source file. These are the files necessary to create the smallest object file during compilation. The rule checker requires that the number of macros in a source plus included headers must not exceed the limit specified in the standard. |
The depth of nesting in control flow statements (like
if , while , etc.)
exceeds the limit specified in the standard. | Maximum nesting depth allowed:
| |
The number of levels of inclusion using include files exceeds the limit specified in the standard. | Maximum number of levels of inclusion allowed:
| |
The number of members of a structure or union exceeds the limit specified in the standard. | Maximum number of members in a structure or union:
| |
The number of levels of nesting in a structure exceeds the limit specified in the standard. | Maximum depth of nesting:
| |
The number of constants in a single enumeration exceeds the limit specified in the standard. | Maximum number of enumeration constants allowed:
| |
An assembly language statement is used. | Checked for all C standards. | |
A nonstandard preprocessor directive is used. | Checked for all C standards. | The rule checker flags uses of preprocessor directives that
are not found in the C standard, for instance,
#ident , #alias and
#assert . |
Unrecognized text follows a preprocessor directive. | Checked for all C standards. | The rule checker flags extraneous text following a
preprocessor directive (line beginning with
#include <header> code |
Unnamed unions or empty structs are
used. | Checked for C90. | |
An enum contains a trailing comma. | Checked for C90. |
Standard compilation error messages do not lead to a violation of this MISRA™ rule.
Tip
To mass-justify all results that come from the same cause, use the
Detail column on the Results List
pane. Click the column header so that all results with the same entry are
grouped together. Select the first result and then select the last result while
holding the Shift
key. Assign a status to one of the results.
If you do not see the Detail column, right-click any other
column header and enable this column.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Standard C Environment |
Category: Required |
AGC Category: Required |