Skip to content

Commit 7dbf60a

Browse files
committed
Remove unused parameters in goto_convert
1 parent 5e5e264 commit 7dbf60a

5 files changed

+24
-22
lines changed

src/goto-programs/builtin_functions.cpp

+16-4
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ void goto_convertt::do_scanf(
320320
}
321321

322322
void goto_convertt::do_input(
323-
const exprt &lhs,
324323
const exprt &function,
325324
const exprt::operandst &arguments,
326325
goto_programt &dest)
@@ -341,7 +340,6 @@ void goto_convertt::do_input(
341340
}
342341

343342
void goto_convertt::do_output(
344-
const exprt &lhs,
345343
const exprt &function,
346344
const exprt::operandst &arguments,
347345
goto_programt &dest)
@@ -846,12 +844,26 @@ void goto_convertt::do_function_call_symbol(
846844
else if(identifier==CPROVER_PREFIX "input" ||
847845
identifier=="__CPROVER::input")
848846
{
849-
do_input(lhs, function, arguments, dest);
847+
if(lhs.is_not_nil())
848+
{
849+
error().source_location=function.find_source_location();
850+
error() << identifier << " expected not to have LHS" << eom;
851+
throw 0;
852+
}
853+
854+
do_input(function, arguments, dest);
850855
}
851856
else if(identifier==CPROVER_PREFIX "output" ||
852857
identifier=="__CPROVER::output")
853858
{
854-
do_output(lhs, function, arguments, dest);
859+
if(lhs.is_not_nil())
860+
{
861+
error().source_location=function.find_source_location();
862+
error() << identifier << " expected not to have LHS" << eom;
863+
throw 0;
864+
}
865+
866+
do_output(function, arguments, dest);
855867
}
856868
else if(identifier==CPROVER_PREFIX "atomic_begin" ||
857869
identifier=="__CPROVER::atomic_begin" ||

src/goto-programs/goto_convert_class.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,15 @@ class goto_convertt:public messaget
126126
bool result_is_used);
127127
void remove_cpp_delete(
128128
side_effect_exprt &expr,
129-
goto_programt &dest,
130-
bool result_is_used);
129+
goto_programt &dest);
131130
void remove_malloc(
132131
side_effect_exprt &expr,
133132
goto_programt &dest,
134133
const irep_idt &mode,
135134
bool result_is_used);
136135
void remove_temporary_object(
137136
side_effect_exprt &expr,
138-
goto_programt &dest,
139-
bool result_is_used);
137+
goto_programt &dest);
140138
void remove_statement_expression(
141139
side_effect_exprt &expr,
142140
goto_programt &dest,
@@ -631,12 +629,10 @@ class goto_convertt:public messaget
631629
const exprt::operandst &arguments,
632630
goto_programt &dest);
633631
void do_input(
634-
const exprt &lhs,
635632
const exprt &rhs,
636633
const exprt::operandst &arguments,
637634
goto_programt &dest);
638635
void do_output(
639-
const exprt &lhs,
640636
const exprt &rhs,
641637
const exprt::operandst &arguments,
642638
goto_programt &dest);

src/goto-programs/goto_convert_side_effect.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ void goto_convertt::remove_cpp_new(
452452

453453
void goto_convertt::remove_cpp_delete(
454454
side_effect_exprt &expr,
455-
goto_programt &dest,
456-
bool result_is_used)
455+
goto_programt &dest)
457456
{
458457
assert(expr.operands().size()==1);
459458

@@ -507,8 +506,7 @@ void goto_convertt::remove_malloc(
507506

508507
void goto_convertt::remove_temporary_object(
509508
side_effect_exprt &expr,
510-
goto_programt &dest,
511-
bool result_is_used)
509+
goto_programt &dest)
512510
{
513511
const irep_idt &mode = expr.get(ID_mode);
514512
if(expr.operands().size()!=1 &&
@@ -666,11 +664,11 @@ void goto_convertt::remove_side_effect(
666664
remove_cpp_new(expr, dest, result_is_used);
667665
else if(statement==ID_cpp_delete ||
668666
statement==ID_cpp_delete_array)
669-
remove_cpp_delete(expr, dest, result_is_used);
667+
remove_cpp_delete(expr, dest);
670668
else if(statement==ID_allocate)
671669
remove_malloc(expr, dest, mode, result_is_used);
672670
else if(statement==ID_temporary_object)
673-
remove_temporary_object(expr, dest, result_is_used);
671+
remove_temporary_object(expr, dest);
674672
else if(statement==ID_statement_expression)
675673
remove_statement_expression(expr, dest, mode, result_is_used);
676674
else if(statement==ID_nondet)

src/goto-programs/parameter_assignments.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ class parameter_assignmentst
3131
symbol_tablet &symbol_table;
3232

3333
void do_function_calls(
34-
goto_functionst &goto_functions,
3534
goto_programt &goto_program);
3635
};
3736

3837
/// turns x=f(...) into f(...); lhs=f#return_value;
3938
void parameter_assignmentst::do_function_calls(
40-
goto_functionst &goto_functions,
4139
goto_programt &goto_program)
4240
{
4341
Forall_goto_program_instructions(i_it, goto_program)
@@ -93,7 +91,7 @@ void parameter_assignmentst::do_function_calls(
9391
void parameter_assignmentst::operator()(goto_functionst &goto_functions)
9492
{
9593
Forall_goto_functions(it, goto_functions)
96-
do_function_calls(goto_functions, it->second.body);
94+
do_function_calls(it->second.body);
9795
}
9896

9997
/// removes returns

src/goto-programs/remove_returns.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class remove_returnst
5252
goto_functionst::function_mapt::iterator f_it);
5353

5454
void undo_function_calls(
55-
goto_functionst &goto_functions,
5655
goto_programt &goto_program);
5756

5857
symbol_exprt get_or_create_return_value_symbol(const irep_idt &function_id);
@@ -366,7 +365,6 @@ bool remove_returnst::restore_returns(
366365

367366
/// turns f(...); lhs=f#return_value; into lhs=f(...)
368367
void remove_returnst::undo_function_calls(
369-
goto_functionst &goto_functions,
370368
goto_programt &goto_program)
371369
{
372370
namespacet ns(symbol_table);
@@ -436,7 +434,7 @@ void remove_returnst::restore(goto_functionst &goto_functions)
436434
if(!unmodified)
437435
{
438436
Forall_goto_functions(it, goto_functions)
439-
undo_function_calls(goto_functions, it->second.body);
437+
undo_function_calls(it->second.body);
440438
}
441439
}
442440

0 commit comments

Comments
 (0)