Skip to content

Commit fe20f7e

Browse files
committed
Improve testcase for externallinkagearraywithoutexplicitsize and change note to match
1 parent de0eb9e commit fe20f7e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
- `A3-1-1` - `ViolationsOfOneDefinitionRule.ql`:
2-
- The query previously would incorrectly allow cases where something was defined with `extern` and did not use the defined external linkage library to find external linkage. This change may result in the query finding more results. Additionally a typo has been fixed in the alert message which will cause the old alerts for this query to now show up as new ones.
2+
- The query previously would incorrectly allow cases where something was defined with `extern` and did not use the defined external linkage library to find external linkage. This change may result in the query finding more results. Additionally a typo has been fixed in the alert message which will cause the old alerts for this query to now show up as new ones.
3+
- `RULE-6-0-2`, `A3-1-4` - `ExternalLinkageArrayWithoutExplicitSizeMisra.ql`, `ExternalLinkageArrayWithoutExplicitSizeAutosar.ql`:
4+
- The queries listed now find flexible member arrays in structs, as those do not have an explicit size.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
| test.cpp:19:14:19:15 | declaration of e1 | The declared array 'e1' with external linkage doesn't specify the size explicitly. |
2+
| test.cpp:27:20:27:38 | declaration of flexibleArrayMember | The declared array 'flexibleArrayMember' with external linkage doesn't specify the size explicitly. |
3+
| test.cpp:28:14:28:33 | declaration of flexibleArrayMember2 | The declared array 'flexibleArrayMember2' with external linkage doesn't specify the size explicitly. |
24
| test.hpp:2:13:2:26 | declaration of header_and_cpp | The declared array 'header_and_cpp' with external linkage doesn't specify the size explicitly. |

cpp/common/test/rules/externallinkagearraywithoutexplicitsize/test.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ struct s {
2323
// Structs must have at least one non-flexible array member.
2424
int foo;
2525

26-
// static data members have external linkage - but not currently detected in
27-
// our external linkage lib - also FAMs are expected to be detected
28-
// specifically in RULE-18-7
29-
static const int flexibleArrayMember[]; // NON_COMPLIANT[FALSE_NEGATIVE]
30-
static int flexibleArrayMember2[]; // NON_COMPLIANT[FALSE_NEGATIVE]
26+
// FAMs are expected to be detected specifically in RULE-18-7
27+
static const int flexibleArrayMember[]; // NON_COMPLIANT
28+
static int flexibleArrayMember2[]; // NON_COMPLIANT
3129
};
3230

3331
// test.cpp

0 commit comments

Comments
 (0)