-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmisra.c
62 lines (51 loc) · 760 Bytes
/
misra.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// W3042
enum directions {
EAST=0,
SOUTH,
WEST,
NORTH=3
};
// W3046
int global_var;
// W3119
#define DIV(x, y) (x / y)
void W3012() {
/*
* expected
* while(1)
* ; // explain why while got an empty body
*/
while(1);
}
void W3027() {
// x = 54;
int x = 066; // 7.1
}
struct A {};
struct B {};
void* malloc(unsigned int);
void W3059() {
struct A* a = (struct A *) malloc(sizeof(struct A));
struct B* b;
b = a;
}
int W3081(int value) {
if (value==0)
goto bad_arg;
return 0;
bad_arg:
return -1;
}
void W3041(int x) {
int arr[x];
}
void W3045() {
int x;
x += 1; // x is used before it has been initialized
}
int add(int, int);
void W3069(void) {
int x = 10;
int y = 20;
add((0, 10), 20);
}