Skip to content

Commit 0f0cbc0

Browse files
author
Lukasz A.J. Wrona
committed
Stop using base_type_eq
Because it warns it's deprecated.
1 parent 7a70b13 commit 0f0cbc0

File tree

5 files changed

+24
-29
lines changed

5 files changed

+24
-29
lines changed

src/analyses/does_remove_const.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Diffblue Ltd.
1515
#include <util/type.h>
1616
#include <util/expr.h>
1717
#include <util/std_code.h>
18-
#include <util/base_type.h>
1918

2019
/// A naive analysis to look for casts that remove const-ness from pointers.
2120
/// \param goto_program: the goto program to check
@@ -74,7 +73,7 @@ bool does_remove_constt::does_expr_lose_const(const exprt &expr) const
7473
for(const exprt &op : expr.operands())
7574
{
7675
const typet &op_type=op.type();
77-
if(base_type_eq(op_type, root_type, ns))
76+
if(op_type == root_type)
7877
{
7978
// Is this child more const-qualified than the root
8079
if(!does_type_preserve_const_correctness(&root_type, &op_type))

src/goto-programs/goto_program.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ void goto_programt::instructiont::validate(
740740
if(!ns.lookup(goto_id, table_symbol))
741741
{
742742
bool symbol_expr_type_matches_symbol_table =
743-
base_type_eq(goto_symbol_expr.type(), table_symbol->type, ns);
743+
goto_symbol_expr.type() == table_symbol->type;
744744

745745
if(
746746
!symbol_expr_type_matches_symbol_table &&
@@ -763,7 +763,7 @@ void goto_programt::instructiont::validate(
763763
table_symbol_type.return_type();
764764

765765
symbol_expr_type_matches_symbol_table =
766-
base_type_eq(goto_symbol_expr_type, table_symbol_type, ns);
766+
goto_symbol_expr_type == table_symbol_type;
767767
}
768768
}
769769

src/goto-programs/link_goto_model.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Author: Michael Tautschnig, Daniel Kroening
1313

1414
#include <unordered_set>
1515

16-
#include <util/base_type.h>
1716
#include <util/symbol.h>
1817
#include <util/rename_symbol.h>
1918

@@ -114,7 +113,7 @@ static bool link_functions(
114113
{
115114
// the linking code will have ensured that types match
116115
rename_symbol(src_func.type);
117-
INVARIANT(base_type_eq(in_dest_symbol_table.type, src_func.type, ns),
116+
INVARIANT(in_dest_symbol_table.type == src_func.type,
118117
"linking ensures that types match");
119118
}
120119
}

src/goto-programs/replace_calls.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Poetzl
1515

1616
#include <goto-programs/remove_returns.h>
1717

18-
#include <util/base_type.h>
1918
#include <util/exception_utils.h>
2019
#include <util/invariant.h>
2120
#include <util/irep.h>
@@ -94,7 +93,7 @@ void replace_callst::operator()(
9493
auto f_it2 = goto_functions.function_map.find(new_id);
9594
PRECONDITION(f_it2 != goto_functions.function_map.end());
9695

97-
PRECONDITION(base_type_eq(f_it1->second.type, f_it2->second.type, ns));
96+
PRECONDITION(f_it1->second.type == f_it2->second.type);
9897

9998
// check that returns have not been removed
10099
if(to_code_type(f_it1->second.type).return_type().id() != ID_empty)
@@ -167,7 +166,7 @@ void replace_callst::check_replacement_map(
167166
auto it1 = goto_functions.function_map.find(p.first);
168167
if(it1 != goto_functions.function_map.end())
169168
{
170-
if(!base_type_eq(it1->second.type, it2->second.type, ns))
169+
if(it1->second.type != it2->second.type)
171170
throw invalid_command_line_argument_exceptiont(
172171
"functions " + id2string(p.first) + " and " + id2string(p.second) +
173172
" are not type-compatible",

src/linking/linking.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515
#include <deque>
1616
#include <unordered_set>
1717

18-
#include <util/base_type.h>
1918
#include <util/find_symbols.h>
2019
#include <util/mathematical_types.h>
2120
#include <util/pointer_offset_size.h>
@@ -140,8 +139,7 @@ void linkingt::detailed_conflict_report_rec(
140139
else if(t1.id()==ID_pointer ||
141140
t1.id()==ID_array)
142141
{
143-
if(depth>0 &&
144-
!base_type_eq(t1.subtype(), t2.subtype(), ns))
142+
if(depth>0 && t1.subtype() != t2.subtype())
145143
{
146144
if(conflict_path.type().id() == ID_pointer)
147145
conflict_path = dereference_exprt(conflict_path);
@@ -190,7 +188,7 @@ void linkingt::detailed_conflict_report_rec(
190188
msg+=id2string(components2[i].get_name())+')';
191189
break;
192190
}
193-
else if(!base_type_eq(subtype1, subtype2, ns))
191+
else if(subtype1 != subtype2)
194192
{
195193
typedef std::unordered_set<typet, irep_hash> type_sett;
196194
type_sett parent_types;
@@ -307,7 +305,7 @@ void linkingt::detailed_conflict_report_rec(
307305
msg+=std::to_string(parameters1.size())+'/';
308306
msg+=std::to_string(parameters2.size())+')';
309307
}
310-
else if(!base_type_eq(return_type1, return_type2, ns))
308+
else if(return_type1 != return_type2)
311309
{
312310
conflict_path=
313311
index_exprt(conflict_path,
@@ -331,7 +329,7 @@ void linkingt::detailed_conflict_report_rec(
331329
const typet &subtype1=parameters1[i].type();
332330
const typet &subtype2=parameters2[i].type();
333331

334-
if(!base_type_eq(subtype1, subtype2, ns))
332+
if(subtype1 != subtype2)
335333
{
336334
conflict_path=
337335
index_exprt(conflict_path,
@@ -450,7 +448,7 @@ void linkingt::duplicate_code_symbol(
450448
symbolt &new_symbol)
451449
{
452450
// Both are functions.
453-
if(!base_type_eq(old_symbol.type, new_symbol.type, ns))
451+
if(old_symbol.type != new_symbol.type)
454452
{
455453
const code_typet &old_t=to_code_type(old_symbol.type);
456454
const code_typet &new_t=to_code_type(new_symbol.type);
@@ -461,7 +459,7 @@ void linkingt::duplicate_code_symbol(
461459
// casts we need to fail hard
462460
if(old_symbol.type.get_bool(ID_C_incomplete) && old_symbol.value.is_nil())
463461
{
464-
if(base_type_eq(old_t.return_type(), new_t.return_type(), ns))
462+
if(old_t.return_type() == new_t.return_type())
465463
link_warning(
466464
old_symbol,
467465
new_symbol,
@@ -479,7 +477,7 @@ void linkingt::duplicate_code_symbol(
479477
else if(
480478
new_symbol.type.get_bool(ID_C_incomplete) && new_symbol.value.is_nil())
481479
{
482-
if(base_type_eq(old_t.return_type(), new_t.return_type(), ns))
480+
if(old_t.return_type() == new_t.return_type())
483481
link_warning(
484482
old_symbol,
485483
new_symbol,
@@ -491,7 +489,7 @@ void linkingt::duplicate_code_symbol(
491489
"implicit function declaration");
492490
}
493491
// handle (incomplete) function prototypes
494-
else if(base_type_eq(old_t.return_type(), new_t.return_type(), ns) &&
492+
else if(old_t.return_type() == new_t.return_type() &&
495493
((old_t.parameters().empty() &&
496494
old_t.has_ellipsis() &&
497495
old_symbol.value.is_nil()) ||
@@ -547,7 +545,7 @@ void linkingt::duplicate_code_symbol(
547545
}
548546
// conflicting declarations without a definition, matching return
549547
// types
550-
else if(base_type_eq(old_t.return_type(), new_t.return_type(), ns) &&
548+
else if(old_t.return_type() == new_t.return_type() &&
551549
old_symbol.value.is_nil() &&
552550
new_symbol.value.is_nil())
553551
{
@@ -588,7 +586,7 @@ void linkingt::duplicate_code_symbol(
588586
typedef std::deque<std::pair<typet, typet> > conflictst;
589587
conflictst conflicts;
590588

591-
if(!base_type_eq(old_t.return_type(), new_t.return_type(), ns))
589+
if(old_t.return_type() != new_t.return_type())
592590
conflicts.push_back(
593591
std::make_pair(old_t.return_type(), new_t.return_type()));
594592

@@ -600,7 +598,7 @@ void linkingt::duplicate_code_symbol(
600598
n_it!=new_t.parameters().end();
601599
++o_it, ++n_it)
602600
{
603-
if(!base_type_eq(o_it->type(), n_it->type(), ns))
601+
if(o_it->type() != n_it->type())
604602
conflicts.push_back(
605603
std::make_pair(o_it->type(), n_it->type()));
606604
}
@@ -693,7 +691,7 @@ void linkingt::duplicate_code_symbol(
693691

694692
bool found=false;
695693
for(const auto &c : union_type.components())
696-
if(base_type_eq(c.type(), src_type, ns))
694+
if(c.type() == src_type)
697695
{
698696
found=true;
699697
if(warn_msg.empty())
@@ -768,7 +766,7 @@ void linkingt::duplicate_code_symbol(
768766
{
769767
// ok, silently ignore
770768
}
771-
else if(base_type_eq(old_symbol.type, new_symbol.type, ns))
769+
else if(old_symbol.type == new_symbol.type)
772770
{
773771
// keep the one in old_symbol -- libraries come last!
774772
warning().source_location=new_symbol.location;
@@ -791,7 +789,7 @@ bool linkingt::adjust_object_type_rec(
791789
const typet &t2,
792790
adjust_type_infot &info)
793791
{
794-
if(base_type_eq(t1, t2, ns))
792+
if(t1 == t2)
795793
return false;
796794

797795
if(
@@ -987,7 +985,7 @@ void linkingt::duplicate_object_symbol(
987985
// both are variables
988986
bool set_to_new = false;
989987

990-
if(!base_type_eq(old_symbol.type, new_symbol.type, ns))
988+
if(old_symbol.type != new_symbol.type)
991989
{
992990
bool failed=
993991
adjust_object_type(old_symbol, new_symbol, set_to_new);
@@ -1045,7 +1043,7 @@ void linkingt::duplicate_object_symbol(
10451043
simplify(tmp_old, ns);
10461044
simplify(tmp_new, ns);
10471045

1048-
if(base_type_eq(tmp_old, tmp_new, ns))
1046+
if(tmp_old == tmp_new)
10491047
{
10501048
// ok, the same
10511049
}
@@ -1172,7 +1170,7 @@ void linkingt::duplicate_type_symbol(
11721170

11731171
if(old_symbol.type.id()==ID_array &&
11741172
new_symbol.type.id()==ID_array &&
1175-
base_type_eq(old_symbol.type.subtype(), new_symbol.type.subtype(), ns))
1173+
old_symbol.type.subtype() == new_symbol.type.subtype())
11761174
{
11771175
if(to_array_type(old_symbol.type).size().is_nil() &&
11781176
to_array_type(new_symbol.type).size().is_not_nil())
@@ -1244,7 +1242,7 @@ bool linkingt::needs_renaming_type(
12441242

12451243
if(old_symbol.type.id()==ID_array &&
12461244
new_symbol.type.id()==ID_array &&
1247-
base_type_eq(old_symbol.type.subtype(), new_symbol.type.subtype(), ns))
1245+
old_symbol.type.subtype() == new_symbol.type.subtype())
12481246
{
12491247
if(to_array_type(old_symbol.type).size().is_nil() &&
12501248
to_array_type(new_symbol.type).size().is_not_nil())

0 commit comments

Comments
 (0)