-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathattribute_syntax.cpp
More file actions
76 lines (67 loc) · 2.44 KB
/
attribute_syntax.cpp
File metadata and controls
76 lines (67 loc) · 2.44 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
int getZ() { return 5; }
int alt() {
int x = 0; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT
long double dd1; // NON_COMPLIANT (A0-4-2)
long double [[codeql::autosar_deviation(
"a-0-4-2-deviation")]] dd3; // COMPLIANT[DEVIATED]
[[codeql::autosar_deviation(
"a-0-4-2-deviation")]] long double dd4; // COMPLIANT[DEVIATED]
[[codeql::autosar_deviation("a-0-4-2-deviation")]] {
long double d7; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT (A0-1-2)
long double d8; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT (A0-1-2)
long double d9; // COMPLIANT[DEVIATED]
}
long double d10; // NON_COMPLIANT (A0-4-2)
[[codeql::autosar_deviation("a-0-4-2-deviation")]] {
long double d11; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT (A0-1-2)
long double d12; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT (A0-1-2)
long double d13; // COMPLIANT[DEVIATED]
}
long double d14; // NON_COMPLIANT (A0-4-2)
getZ(); // NON_COMPLIANT (A0-1-2)
[[codeql::autosar_deviation("a-0-4-2-deviation")]] for (long double d15 = 0.0;
true;) {
} // COMPLIANT[DEVIATED]
for (long double d16 = 0.0; true;) { // NON_COMPLIANT (A0-4-2)
}
return 0;
}
[[codeql::autosar_deviation("a-0-4-2-deviation")]] int
test_function_deviation() {
int x = 0; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT
long double dd1; // COMPLIANT[DEVIATED]
}
[[codeql::autosar_deviation("a-0-4-2-deviation")]] void test_lambdas() {
auto l = []() {
long double d4; // COMPLIANT[DEVIATED]
getZ(); // NON_COMPLIANT
};
}
// Attributes are not supported on a class level at the moment
[[codeql::autosar_deviation("a-0-4-2-deviation")]] class ClassA {
long double d1; // COMPLIANT[DEVIATED - false positive]
class ClassNested {
long double d2; // COMPLIANT[DEVIATED - false positive]
};
void test() {
long double d3; // COMPLIANT[DEVIATED - false positive]
getZ(); // NON_COMPLIANT
}
};
// static_assert, templates, noexcept, multiple declarations
// Namespaces not currently supported by attributes
// [[codeql::autosar_deviation("a-0-4-2-deviation")]] namespace NS {
// long double d1; // COMPLIANT[DEVIATED]
// class ClassA {
// long double d1; // COMPLIANT[DEVIATED]
// };
// void test() {
// long double d1; // COMPLIANT[DEVIATED]
// }
// }