cppcheck/addons/misra-test.c

31 lines
428 B
C
Raw Normal View History

2017-04-08 19:00:50 +02:00
/*
~/cppcheck/cppcheck --dump misra-test.c
python misra.py misra-test.c.dump
*/
2017-04-11 14:45:38 +02:00
void misra_5_1() {
2017-04-08 19:00:50 +02:00
int a123456789012345678901234567890; // no-warning
2017-04-11 14:45:38 +02:00
int a1234567890123456789012345678901; // 51
2017-04-08 19:00:50 +02:00
}
2017-04-11 14:45:38 +02:00
void misra_7_1() {
int x = 066; // 71
2017-04-08 19:00:50 +02:00
}
void misra_7_3() {
int x = 12l; // 73
}
2017-04-11 14:45:38 +02:00
void misra_13_5() {
if (x && (y++ < 123)){} // 135
2017-04-09 10:11:54 +02:00
}
2017-04-11 14:45:38 +02:00
void misra_14_4() {
if (x+4){} // 144
2017-04-08 19:00:50 +02:00
}
2017-04-11 14:45:38 +02:00
void misra_15_1() {
goto a1; // 151
2017-04-08 19:00:50 +02:00
}