cppcheck/addons/test/misra/misra-ctu-1-test.c

49 lines
1.2 KiB
C
Raw Normal View History

2021-07-07 10:58:13 +02:00
// Test with command:
2021-07-17 22:36:03 +02:00
// ./cppcheck --enable=information --addon=misra --inline-suppr addons/test/misra/misra-ctu-*-test.c
2021-07-07 10:58:13 +02:00
#include "misra-ctu-test.h"
2021-09-17 08:08:18 +02:00
extern MISRA_2_3_A misra_2_3_a;
2021-07-07 15:16:53 +02:00
2021-07-09 09:47:23 +02:00
x = MISRA_2_5_OK_1;
2021-07-07 15:16:53 +02:00
// cppcheck-suppress misra-c2012-2.3
2021-07-07 10:58:13 +02:00
// cppcheck-suppress misra-c2012-5.6
typedef int MISRA_5_6_VIOLATION;
2021-07-07 21:47:17 +02:00
// cppcheck-suppress misra-c2012-5.7
struct misra_5_7_violation_t {
int x; // cppcheck-suppress unusedStructMember
2021-07-07 21:47:17 +02:00
};
2021-07-10 12:51:40 +02:00
static misra_5_7_violation_t misra_5_7_use_type_1;
2021-07-08 22:03:27 +02:00
// #11443 - FP
static struct
{ // no warning
uint16_t x; // cppcheck-suppress unusedStructMember
} misra_5_7_false_positive_1;
2021-09-17 08:08:18 +02:00
// cppcheck-suppress misra-c2012-8.4
2021-07-09 09:47:23 +02:00
// cppcheck-suppress misra-c2012-5.8
2021-07-10 12:51:40 +02:00
int misra_5_8_var1;
2021-09-17 08:08:18 +02:00
// cppcheck-suppress misra-c2012-8.4
2021-07-10 12:51:40 +02:00
// cppcheck-suppress misra-c2012-5.8
int misra_5_8_var2;
2021-07-09 09:47:23 +02:00
// cppcheck-suppress misra-c2012-5.8
static void misra_5_8_f(void) {}
2021-07-10 12:51:40 +02:00
// cppcheck-suppress misra-c2012-5.9
static int misra_5_9_count;
// cppcheck-suppress misra-c2012-5.9
static void misra_5_8_foo(void) {}
2021-07-17 19:59:21 +02:00
// cppcheck-suppress misra-c2012-8.5
extern int misra_8_5;
2021-07-17 21:24:53 +02:00
2021-09-17 08:08:18 +02:00
// cppcheck-suppress misra-c2012-8.4
2021-07-17 21:24:53 +02:00
// cppcheck-suppress misra-c2012-8.6
int32_t misra_8_6 = 1;
void misra_8_7_external(void) {}