From 9d3e449901bc26747f46e335989b183debbe1035 Mon Sep 17 00:00:00 2001 From: kristof <Kristof.Szabados@ericsson.com> Date: Mon, 27 Feb 2017 15:31:33 +0100 Subject: [PATCH] merge_free_expr is never called with a true 3rd parameter, so we can remove it. Signed-off-by: kristof <Kristof.Szabados@ericsson.com> --- compiler2/Code.cc | 8 +++----- compiler2/Code.hh | 3 +-- compiler2/ttcn3/AST_ttcn3.cc | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/compiler2/Code.cc b/compiler2/Code.cc index 8946af5d2..c7bc59d5e 100644 --- a/compiler2/Code.cc +++ b/compiler2/Code.cc @@ -219,8 +219,7 @@ namespace Common { Free(expr->postamble); } - char* Code::merge_free_expr(char* str, expression_struct *expr, - bool is_block) + char* Code::merge_free_expr(char* str, expression_struct *expr) { if (expr->preamble || expr->postamble) { // open a statement block if the expression has a preamble or postamble @@ -230,9 +229,8 @@ namespace Common { } // append the expression itself str = mputstr(str, expr->expr); - // terminate it with a bracket or semi-colon - if (is_block) str = mputstr(str, "}\n"); - else str = mputstr(str, ";\n"); + // terminate it with a semi-colon + str = mputstr(str, ";\n"); if (expr->preamble || expr->postamble) { // append the postamble if present if (expr->postamble) str = mputstr(str, expr->postamble); diff --git a/compiler2/Code.hh b/compiler2/Code.hh index de6d16bc0..e87454419 100644 --- a/compiler2/Code.hh +++ b/compiler2/Code.hh @@ -42,8 +42,7 @@ namespace Common { static void init_expr(expression_struct *expr); static void clean_expr(expression_struct *expr); static void free_expr(expression_struct *expr); - static char* merge_free_expr(char* str, expression_struct *expr, - bool is_block=false); + static char* merge_free_expr(char* str, expression_struct *expr); /** Appends the C/C++ equivalent of character \a c to \a str. If flag * \a in_string is true (i.e. the \a c is a part of a string literal) then diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index db440a8e8..ed86e2a53 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -8736,7 +8736,7 @@ namespace Ttcn { expr.expr = mputprintf(expr.expr, "%s = ", temp->get_lhs_name().c_str()); dref->generate_code(&expr); - str = Code::merge_free_expr(str, &expr, false); + str = Code::merge_free_expr(str, &expr); } if (use_runtime_2 && TypeConv::needs_conv_refd(temp)) { str = TypeConv::gen_conv_code_refd(str, temp->get_lhs_name().c_str(), temp); @@ -10096,7 +10096,7 @@ namespace Ttcn { Code::init_expr(&expr); expr.expr = mputprintf(expr.expr, "%s = ", t->get_lhs_name().c_str()); dref->generate_code(&expr); - str = Code::merge_free_expr(str, &expr, false); + str = Code::merge_free_expr(str, &expr); } str = t->generate_code_init(str, t->get_lhs_name().c_str()); } -- GitLab