V2657. MISRA. Obsolescent language features should not be used.
This diagnostic rule is based on the MISRA (Motor Industry Software Reliability Association) software development guidelines.
This diagnostic rule is relevant only for C.
The diagnostic rule requires avoiding the use of language constructs declared obsolete in Sections 6.11 and 7.33 of the C language standards because such designs may result in unintended behavior and are usually replaced by safer and more effective alternatives.
The following table lists the obsolete features for which the diagnostic rule is issued:
N |
Obsolete language features |
Diagnostic rule |
Language standard |
---|---|---|---|
1 |
A function or object declared once with an internal linkage type also have an internal linkage when redeclared or redefined. Therefore, the |
C99, C11, C18 |
|
2 |
Storage-class specifiers ( |
V2657 |
C99, C11, C18 |
3 |
Declaring a function using empty parentheses. |
C99, C11, C18 |
|
4 |
Using K&R-style function declarations and unnamed function parameters. |
C99, C11, C18 |
|
5 |
Using the |
V2657 |
C18 |
6 |
Overriding the |
C99, C11, C18 |
|
7 |
Using the |
C99 |
|
8 |
Using the |
C99, C11, C18 |
|
9 |
Using the |
C18 |
The V2657 diagnostic rule operates in conjunction with diagnostic rules listed in the second column of the table to provide comprehensive analysis.
Look at two examples that are covered by this rule but not covered by others.
Example N1. The specifier is not placed at the beginning of the variable declaration:
int static var;
The fixed code:
static int var;
Example N2. Using ATOMIC_VAR_INIT
:
atomic_int guide = ATOMIC_VAR_INIT(42);
The fixed code:
_Atomic int guide = 42;
More examples can be found in the documentation for the corresponding diagnostic rules listed in the table.