Skip to content

Commit 4faede0

Browse files
committed
C++: Silence some more bogus consistency errors in syntax zoo
These were due to several functions occurring that would have the same TRAP key. By making the functions static or wrapping the defining class in an anonymous namespace the TRAP keys will differ from each other.
1 parent f649def commit 4faede0

28 files changed

+82
-74
lines changed

cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,12 @@ instructionWithoutSuccessor
1313
| condition_decls.cpp:41:22:41:23 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:40:6:40:20 | void while_decl_bind(int) | void while_decl_bind(int) |
1414
| condition_decls.cpp:48:52:48:53 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:47:6:47:18 | void for_decl_bind(int) | void for_decl_bind(int) |
1515
| misc.c:171:10:171:13 | Uninitialized: definition of str2 | Instruction 'Uninitialized: definition of str2' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() |
16-
| ms_try_mix.cpp:33:13:33:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:27:6:27:19 | void ms_finally_mix(int) | void ms_finally_mix(int) |
17-
| ms_try_mix.cpp:51:5:51:11 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:47:6:47:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() |
18-
| stmt_expr.cpp:27:5:27:15 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | stmt_expr.cpp:21:6:21:6 | void stmtexpr::g(int) | void stmtexpr::g(int) |
16+
| ms_try_mix.cpp:35:13:35:19 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:29:6:29:19 | void ms_finally_mix(int) | void ms_finally_mix(int) |
17+
| ms_try_mix.cpp:53:5:53:11 | ThrowValue: throw ... | Instruction 'ThrowValue: throw ...' has no successors in function '$@'. | ms_try_mix.cpp:49:6:49:28 | void ms_empty_finally_at_end() | void ms_empty_finally_at_end() |
18+
| stmt_expr.cpp:27:5:27:15 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | stmt_expr.cpp:21:13:21:13 | void stmtexpr::g(int) | void stmtexpr::g(int) |
1919
| vla.c:5:9:5:14 | Uninitialized: definition of matrix | Instruction 'Uninitialized: definition of matrix' has no successors in function '$@'. | vla.c:3:12:3:12 | int f(int, char**) | int f(int, char**) |
2020
| vla.c:11:6:11:16 | Chi: vla_typedef | Instruction 'Chi: vla_typedef' has no successors in function '$@'. | vla.c:11:6:11:16 | void vla_typedef() | void vla_typedef() |
2121
ambiguousSuccessors
22-
| conditional_destructors.cpp:29:6:29:7 | Chi: f1 | Instruction 'Chi: f1' has 2 successors of kind 'Goto' in function '$@'. | conditional_destructors.cpp:29:6:29:7 | void f1() | void f1() |
23-
| conditional_destructors.cpp:38:6:38:7 | Chi: f2 | Instruction 'Chi: f2' has 2 successors of kind 'Goto' in function '$@'. | conditional_destructors.cpp:38:6:38:7 | void f2() | void f2() |
24-
| forstmt.cpp:1:6:1:7 | Chi: f1 | Instruction 'Chi: f1' has 2 successors of kind 'Goto' in function '$@'. | conditional_destructors.cpp:29:6:29:7 | void f1() | void f1() |
25-
| forstmt.cpp:8:6:8:7 | Chi: f2 | Instruction 'Chi: f2' has 2 successors of kind 'Goto' in function '$@'. | conditional_destructors.cpp:38:6:38:7 | void f2() | void f2() |
26-
| nonmembercallexpr.c:1:6:1:6 | Chi: g | Instruction 'Chi: g' has 2 successors of kind 'Goto' in function '$@'. | nonmembercallexpr.c:1:6:1:6 | void g(); void g())(); void(* g(); void(* g())() | void g(); void g())(); void(* g(); void(* g())() |
27-
| revsubscriptexpr.c:1:6:1:6 | Chi: g | Instruction 'Chi: g' has 2 successors of kind 'Goto' in function '$@'. | nonmembercallexpr.c:1:6:1:6 | void g(); void g())(); void(* g(); void(* g())() | void g(); void g())(); void(* g(); void(* g())() |
2822
unexplainedLoop
2923
unnecessaryPhiInstruction
3024
memoryOperandDefinitionIsUnmodeled
@@ -41,7 +35,7 @@ invalidOverlap
4135
nonUniqueEnclosingIRFunction
4236
fieldAddressOnNonPointer
4337
thisArgumentIsNonPointer
44-
| pmcallexpr.cpp:8:2:8:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:6:13:6:13 | void f() | void f() |
38+
| pmcallexpr.cpp:10:2:10:15 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pmcallexpr.cpp:8:13:8:13 | void f() | void f() |
4539
| pointer_to_member.cpp:23:5:23:54 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pointer_to_member.cpp:14:5:14:9 | int usePM(int PM::*) | int usePM(int PM::*) |
4640
| pointer_to_member.cpp:24:5:24:49 | Call: call to expression | Call instruction 'Call: call to expression' has a `this` argument operand that is not an address, in function '$@'. | pointer_to_member.cpp:14:5:14:9 | int usePM(int PM::*) | int usePM(int PM::*) |
4741
nonUniqueIRVariable

cpp/ql/test/library-tests/syntax-zoo/assignexpr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
namespace {
12
class C {
23
public:
34
int i;
45
};
6+
}
57

68
static void f() {
79
C c;

cpp/ql/test/library-tests/syntax-zoo/conditional_destructors.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class C2 {
2626
}
2727
};
2828

29-
void f1(void) {
29+
static void f1(void) {
3030
if (C1(1) == C1(2)) {
3131
;
3232
}
@@ -35,7 +35,7 @@ void f1(void) {
3535
}
3636
}
3737

38-
void f2(void) {
38+
static void f2(void) {
3939
if (C2(1) == C2(2)) {
4040
;
4141
}

cpp/ql/test/library-tests/syntax-zoo/constmemberaccess.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
namespace {
12
class C {
23
public:
34
int x;
45
};
6+
}
57

68
static void f() {
79
C *c;

cpp/ql/test/library-tests/syntax-zoo/constructorinitializer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
namespace {
12
class C {
23
public:
34
C(int x, int y);
45
};
6+
}
57

68
static void f() {
79
int i, j, k, l;

cpp/ql/test/library-tests/syntax-zoo/cpp11.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ namespace synthetic_dtor_calls {
138138
// This function is interesting because its extractor CFG has unreachable
139139
// calls to `c2.~C()` and `c3.~C()`. It's the calls that would have come from
140140
// leaving the block of `c2` by falling off the end, but no path does that.
141-
int g(int x) {
141+
static int g(int x) {
142142
do {
143143
C c1;
144144
if (x > 0) {

cpp/ql/test/library-tests/syntax-zoo/dataflow-consistency.expected

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ postWithInFlow
4242
| VacuousDestructorCall.cpp:10:22:10:22 | i [inner post update] | PostUpdateNode should not be the target of local flow. |
4343
| allocators.cpp:4:18:4:20 | m_x [post update] | PostUpdateNode should not be the target of local flow. |
4444
| allocators.cpp:4:24:4:26 | m_y [post update] | PostUpdateNode should not be the target of local flow. |
45-
| assignexpr.cpp:9:4:9:4 | i [post update] | PostUpdateNode should not be the target of local flow. |
45+
| assignexpr.cpp:11:4:11:4 | i [post update] | PostUpdateNode should not be the target of local flow. |
4646
| builtin.c:34:23:34:31 | staticint [inner post update] | PostUpdateNode should not be the target of local flow. |
4747
| builtin.c:39:37:39:45 | carry_out [inner post update] | PostUpdateNode should not be the target of local flow. |
4848
| builtin.c:43:41:43:49 | staticint [inner post update] | PostUpdateNode should not be the target of local flow. |
@@ -73,18 +73,18 @@ postWithInFlow
7373
| ir.cpp:342:6:342:6 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
7474
| ir.cpp:428:8:428:8 | x [post update] | PostUpdateNode should not be the target of local flow. |
7575
| ir.cpp:429:8:429:8 | y [post update] | PostUpdateNode should not be the target of local flow. |
76-
| ir.cpp:643:15:643:17 | m_a [post update] | PostUpdateNode should not be the target of local flow. |
77-
| ir.cpp:644:11:644:14 | this [inner post update] | PostUpdateNode should not be the target of local flow. |
78-
| ir.cpp:644:17:644:19 | m_a [post update] | PostUpdateNode should not be the target of local flow. |
79-
| ir.cpp:645:9:645:11 | m_a [post update] | PostUpdateNode should not be the target of local flow. |
80-
| ir.cpp:654:11:654:14 | this [inner post update] | PostUpdateNode should not be the target of local flow. |
81-
| ir.cpp:745:8:745:8 | base_s [inner post update] | PostUpdateNode should not be the target of local flow. |
82-
| ir.cpp:754:8:754:8 | middle_s [inner post update] | PostUpdateNode should not be the target of local flow. |
83-
| ir.cpp:763:8:763:8 | derived_s [inner post update] | PostUpdateNode should not be the target of local flow. |
84-
| ir.cpp:809:7:809:13 | call to Base | PostUpdateNode should not be the target of local flow. |
85-
| ir.cpp:810:7:810:26 | call to Base | PostUpdateNode should not be the target of local flow. |
86-
| ir.cpp:823:7:823:13 | call to Base | PostUpdateNode should not be the target of local flow. |
87-
| ir.cpp:824:7:824:26 | call to Base | PostUpdateNode should not be the target of local flow. |
76+
| ir.cpp:644:15:644:17 | m_a [post update] | PostUpdateNode should not be the target of local flow. |
77+
| ir.cpp:645:11:645:14 | this [inner post update] | PostUpdateNode should not be the target of local flow. |
78+
| ir.cpp:645:17:645:19 | m_a [post update] | PostUpdateNode should not be the target of local flow. |
79+
| ir.cpp:646:9:646:11 | m_a [post update] | PostUpdateNode should not be the target of local flow. |
80+
| ir.cpp:655:11:655:14 | this [inner post update] | PostUpdateNode should not be the target of local flow. |
81+
| ir.cpp:747:8:747:8 | base_s [inner post update] | PostUpdateNode should not be the target of local flow. |
82+
| ir.cpp:756:8:756:8 | middle_s [inner post update] | PostUpdateNode should not be the target of local flow. |
83+
| ir.cpp:765:8:765:8 | derived_s [inner post update] | PostUpdateNode should not be the target of local flow. |
84+
| ir.cpp:811:7:811:13 | call to Base | PostUpdateNode should not be the target of local flow. |
85+
| ir.cpp:812:7:812:26 | call to Base | PostUpdateNode should not be the target of local flow. |
86+
| ir.cpp:825:7:825:13 | call to Base | PostUpdateNode should not be the target of local flow. |
87+
| ir.cpp:826:7:826:26 | call to Base | PostUpdateNode should not be the target of local flow. |
8888
| misc.c:130:7:130:7 | i [post update] | PostUpdateNode should not be the target of local flow. |
8989
| misc.c:131:9:131:9 | i [post update] | PostUpdateNode should not be the target of local flow. |
9090
| misc.c:220:3:220:5 | * ... [post update] | PostUpdateNode should not be the target of local flow. |

cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ uniqueNodeLocation
1616
missingLocation
1717
| Nodes without location: 12 |
1818
uniqueNodeToString
19-
| file://:0:0:0:0 | i | Node should have one toString but has 2. |
20-
| file://:0:0:0:0 | j | Node should have one toString but has 2. |
21-
| file://:0:0:0:0 | x | Node should have one toString but has 2. |
22-
| file://:0:0:0:0 | y | Node should have one toString but has 2. |
2319
missingToString
2420
parameterCallable
2521
localFlowIsLocal
@@ -38,15 +34,15 @@ uniquePostUpdate
3834
| ir.cpp:515:10:515:11 | definition of r3 indirection | Node has multiple PostUpdateNodes. |
3935
| ir.cpp:516:10:516:11 | definition of r4 indirection | Node has multiple PostUpdateNodes. |
4036
| ir.cpp:516:10:516:11 | definition of r4 indirection | Node has multiple PostUpdateNodes. |
41-
| ir.cpp:658:5:658:5 | this indirection | Node has multiple PostUpdateNodes. |
42-
| ir.cpp:658:5:658:5 | this indirection | Node has multiple PostUpdateNodes. |
43-
| ir.cpp:745:8:745:8 | this indirection | Node has multiple PostUpdateNodes. |
44-
| ir.cpp:748:3:748:6 | this indirection | Node has multiple PostUpdateNodes. |
45-
| ir.cpp:757:3:757:8 | this indirection | Node has multiple PostUpdateNodes. |
46-
| ir.cpp:766:3:766:9 | this indirection | Node has multiple PostUpdateNodes. |
47-
| ir.cpp:775:3:775:11 | this indirection | Node has multiple PostUpdateNodes. |
48-
| ir.cpp:784:3:784:11 | this indirection | Node has multiple PostUpdateNodes. |
49-
| ir.cpp:793:3:793:11 | this indirection | Node has multiple PostUpdateNodes. |
37+
| ir.cpp:659:5:659:5 | this indirection | Node has multiple PostUpdateNodes. |
38+
| ir.cpp:659:5:659:5 | this indirection | Node has multiple PostUpdateNodes. |
39+
| ir.cpp:747:8:747:8 | this indirection | Node has multiple PostUpdateNodes. |
40+
| ir.cpp:750:3:750:6 | this indirection | Node has multiple PostUpdateNodes. |
41+
| ir.cpp:759:3:759:8 | this indirection | Node has multiple PostUpdateNodes. |
42+
| ir.cpp:768:3:768:9 | this indirection | Node has multiple PostUpdateNodes. |
43+
| ir.cpp:777:3:777:11 | this indirection | Node has multiple PostUpdateNodes. |
44+
| ir.cpp:786:3:786:11 | this indirection | Node has multiple PostUpdateNodes. |
45+
| ir.cpp:795:3:795:11 | this indirection | Node has multiple PostUpdateNodes. |
5046
| static_init_templates.cpp:240:7:240:7 | this indirection | Node has multiple PostUpdateNodes. |
5147
postIsInSameCallable
5248
reverseRead
@@ -56,14 +52,14 @@ postWithInFlow
5652
| cpp11.cpp:82:11:82:14 | call to Val | PostUpdateNode should not be the target of local flow. |
5753
| cpp11.cpp:82:45:82:48 | call to Val | PostUpdateNode should not be the target of local flow. |
5854
| cpp11.cpp:82:51:82:51 | call to Val | PostUpdateNode should not be the target of local flow. |
59-
| ir.cpp:809:7:809:13 | call to Base | PostUpdateNode should not be the target of local flow. |
60-
| ir.cpp:810:7:810:26 | call to Base | PostUpdateNode should not be the target of local flow. |
61-
| ir.cpp:823:7:823:13 | call to Base | PostUpdateNode should not be the target of local flow. |
62-
| ir.cpp:824:7:824:26 | call to Base | PostUpdateNode should not be the target of local flow. |
55+
| ir.cpp:811:7:811:13 | call to Base | PostUpdateNode should not be the target of local flow. |
56+
| ir.cpp:812:7:812:26 | call to Base | PostUpdateNode should not be the target of local flow. |
57+
| ir.cpp:825:7:825:13 | call to Base | PostUpdateNode should not be the target of local flow. |
58+
| ir.cpp:826:7:826:26 | call to Base | PostUpdateNode should not be the target of local flow. |
6359
| try_catch.cpp:7:8:7:8 | call to exception | PostUpdateNode should not be the target of local flow. |
6460
viableImplInCallContextTooLarge
6561
uniqueParameterNodeAtPosition
66-
| ir.cpp:724:6:724:13 | TryCatch | 0 indirection | ir.cpp:735:22:735:22 | s indirection | Parameters with overlapping positions. |
67-
| ir.cpp:724:6:724:13 | TryCatch | 0 indirection | ir.cpp:738:24:738:24 | e indirection | Parameters with overlapping positions. |
62+
| ir.cpp:726:6:726:13 | TryCatch | 0 indirection | ir.cpp:737:22:737:22 | s indirection | Parameters with overlapping positions. |
63+
| ir.cpp:726:6:726:13 | TryCatch | 0 indirection | ir.cpp:740:24:740:24 | e indirection | Parameters with overlapping positions. |
6864
uniqueParameterNodePosition
6965
uniqueContentApprox

cpp/ql/test/library-tests/syntax-zoo/defconstructornewexpr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
namespace {
12
class C { };
3+
}
24

35
static void f() {
46
new C;

cpp/ql/test/library-tests/syntax-zoo/defdestructordeleteexpr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
namespace {
12
class C { };
3+
}
24

35
static void f() {
46
C* c = new C();

0 commit comments

Comments
 (0)