Skip to content

Commit 833f719

Browse files
committed
Language2: add test RULE-1-4
1 parent f9a2c5e commit 833f719

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

c/misra/test/rules/RULE-1-4/test.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <stdalign.h> //NON_COMPLIANT
2+
#include <stdatomic.h> //NON_COMPLIANT
3+
#include <stdnoreturn.h> //NON_COMPLIANT
4+
#include <threads.h> //NON_COMPLIANT
5+
6+
#define MACRO(x) _Generic((x), int : 0, long : 1) // NON_COMPLIANT
7+
#define __STDC_WANT_LIB_EXT1__ 0 // COMPLIANT
8+
9+
_Noreturn void f0(); // NON_COMPLIANT
10+
11+
typedef int new_type; // COMPLIANT
12+
typedef _Atomic new_type atomic_new_type; // NON_COMPLIANT
13+
14+
void f(int p) {
15+
int i0 = _Generic(p, int : 0, long : 1); // NON_COMPLIANT
16+
17+
_Atomic int i; // NON_COMPLIANT
18+
19+
_Alignas(4) int i1; // NON_COMPLIANT
20+
alignas(4) int i2; // NON_COMPLIANT
21+
int a = _Alignof(int); // NON_COMPLIANT
22+
int a1 = alignof(int); // NON_COMPLIANT
23+
24+
static thread_local int i3; // NON_COMPLIANT
25+
static _Thread_local int i4; // NON_COMPLIANT
26+
}

c/misra/test/rules/RULE-1-4/test1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define __STDC_WANT_LIB_EXT1__ 1 // NON_COMPLIANT

rules.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ c,MISRA-C-2012,RULE-4-14,Yes,Required,,,The validity of values received from ext
619619
c,MISRA-C-2012,RULE-1-1,Yes,Required,,,"The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation�s translation limits",,Language,Easy,
620620
c,MISRA-C-2012,RULE-1-2,Yes,Advisory,,,Language extensions should not be used,,Language,Easy,
621621
c,MISRA-C-2012,RULE-1-3,Yes,Required,,,There shall be no occurrence of undefined or critical unspecified behaviour,,Language,Hard,
622-
c,MISRA-C-2012,RULE-1-4,Yes,Required,,,Emergent language features shall not be used,,Language,Medium,
622+
c,MISRA-C-2012,RULE-1-4,Yes,Required,,,Emergent language features shall not be used,,Language2,Medium,
623623
c,MISRA-C-2012,RULE-2-1,Yes,Required,,,A project shall not contain unreachable code,M0-1-1,DeadCode,Import,
624624
c,MISRA-C-2012,RULE-2-2,Yes,Required,,,There shall be no dead code,M0-1-9,DeadCode,Import,
625625
c,MISRA-C-2012,RULE-2-3,Yes,Advisory,,,A project should not contain unused type declarations,A0-1-6,DeadCode,Import,

0 commit comments

Comments
 (0)