27
27
28
28
#include " linking_class.h"
29
29
30
+ bool my_base_type_eq (
31
+ const typet &type1,
32
+ const typet &type2,
33
+ const namespacet &)
34
+ {
35
+ return type1 == type2;
36
+ }
37
+
38
+ bool my_base_type_eq (
39
+ const exprt &expr1,
40
+ const exprt &expr2,
41
+ const namespacet &ns)
42
+ {
43
+ return my_base_type_eq (expr1.type (), expr2.type (), ns);
44
+ }
45
+
30
46
bool casting_replace_symbolt::replace_symbol_expr (symbol_exprt &s) const
31
47
{
32
48
expr_mapt::const_iterator it = expr_map.find (s.get_identifier ());
@@ -150,7 +166,7 @@ void linkingt::detailed_conflict_report_rec(
150
166
t1.id ()==ID_array)
151
167
{
152
168
if (
153
- depth > 0 && !base_type_eq (
169
+ depth > 0 && !my_base_type_eq (
154
170
to_type_with_subtype (t1).subtype (),
155
171
to_type_with_subtype (t2).subtype (),
156
172
ns))
@@ -202,7 +218,7 @@ void linkingt::detailed_conflict_report_rec(
202
218
msg+=id2string (components2[i].get_name ())+' )' ;
203
219
break ;
204
220
}
205
- else if (!base_type_eq (subtype1, subtype2, ns))
221
+ else if (!my_base_type_eq (subtype1, subtype2, ns))
206
222
{
207
223
typedef std::unordered_set<typet, irep_hash> type_sett;
208
224
type_sett parent_types;
@@ -332,7 +348,7 @@ void linkingt::detailed_conflict_report_rec(
332
348
msg+=std::to_string (parameters1.size ())+' /' ;
333
349
msg+=std::to_string (parameters2.size ())+' )' ;
334
350
}
335
- else if (!base_type_eq (return_type1, return_type2, ns))
351
+ else if (!my_base_type_eq (return_type1, return_type2, ns))
336
352
{
337
353
conflict_path=
338
354
index_exprt (conflict_path,
@@ -356,7 +372,7 @@ void linkingt::detailed_conflict_report_rec(
356
372
const typet &subtype1=parameters1[i].type ();
357
373
const typet &subtype2=parameters2[i].type ();
358
374
359
- if (!base_type_eq (subtype1, subtype2, ns))
375
+ if (!my_base_type_eq (subtype1, subtype2, ns))
360
376
{
361
377
conflict_path=
362
378
index_exprt (conflict_path,
@@ -475,7 +491,7 @@ void linkingt::duplicate_code_symbol(
475
491
symbolt &new_symbol)
476
492
{
477
493
// Both are functions.
478
- if (!base_type_eq (old_symbol.type , new_symbol.type , ns))
494
+ if (!my_base_type_eq (old_symbol.type , new_symbol.type , ns))
479
495
{
480
496
const code_typet &old_t =to_code_type (old_symbol.type );
481
497
const code_typet &new_t =to_code_type (new_symbol.type );
@@ -486,7 +502,7 @@ void linkingt::duplicate_code_symbol(
486
502
// casts we need to fail hard
487
503
if (old_symbol.type .get_bool (ID_C_incomplete) && old_symbol.value .is_nil ())
488
504
{
489
- if (base_type_eq (old_t .return_type (), new_t .return_type (), ns))
505
+ if (my_base_type_eq (old_t .return_type (), new_t .return_type (), ns))
490
506
link_warning (
491
507
old_symbol,
492
508
new_symbol,
@@ -504,7 +520,7 @@ void linkingt::duplicate_code_symbol(
504
520
else if (
505
521
new_symbol.type .get_bool (ID_C_incomplete) && new_symbol.value .is_nil ())
506
522
{
507
- if (base_type_eq (old_t .return_type (), new_t .return_type (), ns))
523
+ if (my_base_type_eq (old_t .return_type (), new_t .return_type (), ns))
508
524
link_warning (
509
525
old_symbol,
510
526
new_symbol,
@@ -516,7 +532,7 @@ void linkingt::duplicate_code_symbol(
516
532
" implicit function declaration" );
517
533
}
518
534
// handle (incomplete) function prototypes
519
- else if (base_type_eq (old_t .return_type (), new_t .return_type (), ns) &&
535
+ else if (my_base_type_eq (old_t .return_type (), new_t .return_type (), ns) &&
520
536
((old_t .parameters ().empty () &&
521
537
old_t .has_ellipsis () &&
522
538
old_symbol.value .is_nil ()) ||
@@ -572,7 +588,7 @@ void linkingt::duplicate_code_symbol(
572
588
}
573
589
// conflicting declarations without a definition, matching return
574
590
// types
575
- else if (base_type_eq (old_t .return_type (), new_t .return_type (), ns) &&
591
+ else if (my_base_type_eq (old_t .return_type (), new_t .return_type (), ns) &&
576
592
old_symbol.value .is_nil () &&
577
593
new_symbol.value .is_nil ())
578
594
{
@@ -613,7 +629,7 @@ void linkingt::duplicate_code_symbol(
613
629
typedef std::deque<std::pair<typet, typet> > conflictst;
614
630
conflictst conflicts;
615
631
616
- if (!base_type_eq (old_t .return_type (), new_t .return_type (), ns))
632
+ if (!my_base_type_eq (old_t .return_type (), new_t .return_type (), ns))
617
633
conflicts.push_back (
618
634
std::make_pair (old_t .return_type (), new_t .return_type ()));
619
635
@@ -625,7 +641,7 @@ void linkingt::duplicate_code_symbol(
625
641
n_it!=new_t .parameters ().end ();
626
642
++o_it, ++n_it)
627
643
{
628
- if (!base_type_eq (o_it->type (), n_it->type (), ns))
644
+ if (!my_base_type_eq (o_it->type (), n_it->type (), ns))
629
645
conflicts.push_back (
630
646
std::make_pair (o_it->type (), n_it->type ()));
631
647
}
@@ -718,7 +734,7 @@ void linkingt::duplicate_code_symbol(
718
734
719
735
bool found=false ;
720
736
for (const auto &c : union_type.components ())
721
- if (base_type_eq (c.type (), src_type, ns))
737
+ if (my_base_type_eq (c.type (), src_type, ns))
722
738
{
723
739
found=true ;
724
740
if (warn_msg.empty ())
@@ -793,7 +809,7 @@ void linkingt::duplicate_code_symbol(
793
809
{
794
810
// ok, silently ignore
795
811
}
796
- else if (base_type_eq (old_symbol.type , new_symbol.type , ns))
812
+ else if (my_base_type_eq (old_symbol.type , new_symbol.type , ns))
797
813
{
798
814
// keep the one in old_symbol -- libraries come last!
799
815
debug ().source_location = new_symbol.location ;
@@ -816,7 +832,7 @@ bool linkingt::adjust_object_type_rec(
816
832
const typet &t2,
817
833
adjust_type_infot &info)
818
834
{
819
- if (base_type_eq (t1, t2, ns))
835
+ if (my_base_type_eq (t1, t2, ns))
820
836
return false ;
821
837
822
838
if (
@@ -1025,7 +1041,7 @@ void linkingt::duplicate_object_symbol(
1025
1041
// both are variables
1026
1042
bool set_to_new = false ;
1027
1043
1028
- if (!base_type_eq (old_symbol.type , new_symbol.type , ns))
1044
+ if (!my_base_type_eq (old_symbol.type , new_symbol.type , ns))
1029
1045
{
1030
1046
bool failed=
1031
1047
adjust_object_type (old_symbol, new_symbol, set_to_new);
@@ -1081,7 +1097,7 @@ void linkingt::duplicate_object_symbol(
1081
1097
simplify (tmp_old, ns);
1082
1098
simplify (tmp_new, ns);
1083
1099
1084
- if (base_type_eq (tmp_old, tmp_new, ns))
1100
+ if (my_base_type_eq (tmp_old, tmp_new, ns))
1085
1101
{
1086
1102
// ok, the same
1087
1103
}
@@ -1211,7 +1227,7 @@ void linkingt::duplicate_type_symbol(
1211
1227
1212
1228
if (
1213
1229
old_symbol.type .id () == ID_array && new_symbol.type .id () == ID_array &&
1214
- base_type_eq (
1230
+ my_base_type_eq (
1215
1231
to_array_type (old_symbol.type ).element_type (),
1216
1232
to_array_type (new_symbol.type ).element_type (),
1217
1233
ns))
@@ -1286,7 +1302,7 @@ bool linkingt::needs_renaming_type(
1286
1302
1287
1303
if (
1288
1304
old_symbol.type .id () == ID_array && new_symbol.type .id () == ID_array &&
1289
- base_type_eq (
1305
+ my_base_type_eq (
1290
1306
to_array_type (old_symbol.type ).element_type (),
1291
1307
to_array_type (new_symbol.type ).element_type (),
1292
1308
ns))
0 commit comments