File: misra-ctu-1-test.c

package info (click to toggle)
cppcheck 2.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,132 kB
  • sloc: cpp: 268,935; python: 20,890; ansic: 8,090; sh: 1,045; makefile: 1,008; xml: 1,005; cs: 291
file content (55 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download | duplicates (2)
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
// Test with command:
// ./cppcheck --enable=information --enable=style --addon=misra --inline-suppr addons/test/misra/misra-ctu-*-test.c

#include "misra-ctu-test.h"

extern MISRA_2_3_A  misra_2_3_a;

x = MISRA_2_5_OK_1;

// cppcheck-suppress misra-c2012-20.5
#undef MISRA_2_5_OK_3

// cppcheck-suppress misra-c2012-2.3
// cppcheck-suppress misra-c2012-5.6
typedef int MISRA_5_6_VIOLATION;

// cppcheck-suppress misra-c2012-5.7
struct misra_5_7_violation_t {
    int x;  // cppcheck-suppress unusedStructMember
};
static misra_5_7_violation_t misra_5_7_use_type_1;

// #11443 - FP
static struct
{ // no warning
    uint16_t x;  // cppcheck-suppress unusedStructMember
} misra_5_7_false_positive_1;

// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-5.8
int misra_5_8_var1;
// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-5.8
int misra_5_8_var2;
// cppcheck-suppress misra-c2012-5.8
static void misra_5_8_f(void) {}


// 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) {}

// cppcheck-suppress misra-c2012-8.5
extern int misra_8_5;

// cppcheck-suppress misra-c2012-8.4
// cppcheck-suppress misra-c2012-8.6
int32_t misra_8_6 = 1;

void misra_8_7_external(void) {}

// #12362
void misra_8_7_compliant( void ){}
static void misra_8_7_call(void) { misra_8_7_compliant(); }