Skip to content

Commit

Permalink
Remove set but not used variables
Browse files Browse the repository at this point in the history
clang 19.1.17 warns about `set but not used` variables and stops compilation
because of `-Werror`
  • Loading branch information
mgudemann committed Feb 18, 2025
1 parent 0fc8a49 commit 900dee6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 3 additions & 5 deletions src/solvers/flattening/boolbv_overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,14 @@ literalt boolbvt::convert_binary_overflow(const binary_overflow_exprt &expr)
? bv_utilst::representationt::SIGNED
: bv_utilst::representationt::UNSIGNED;

if(
const auto plus_overflow = expr_try_dynamic_cast<plus_overflow_exprt>(expr))
if(expr_try_dynamic_cast<plus_overflow_exprt>(expr))
{
if(bv0.size() != bv1.size())
return SUB::convert_rest(expr);

return bv_utils.overflow_add(bv0, bv1, rep);
}
if(const auto minus = expr_try_dynamic_cast<minus_overflow_exprt>(expr))
if(expr_try_dynamic_cast<minus_overflow_exprt>(expr))
{
if(bv0.size() != bv1.size())
return SUB::convert_rest(expr);
Expand All @@ -158,8 +157,7 @@ literalt boolbvt::convert_binary_overflow(const binary_overflow_exprt &expr)

return mult_overflow_result(prop, bv0, bv1, rep).back();
}
else if(
const auto shl_overflow = expr_try_dynamic_cast<shl_overflow_exprt>(expr))
else if(expr_try_dynamic_cast<shl_overflow_exprt>(expr))

Check warning on line 160 in src/solvers/flattening/boolbv_overflow.cpp

View check run for this annotation

Codecov / codecov/patch

src/solvers/flattening/boolbv_overflow.cpp#L160

Added line #L160 was not covered by tests
{
DATA_INVARIANT(!bv0.empty(), "zero-sized operand");

Expand Down
10 changes: 4 additions & 6 deletions src/solvers/smt2_incremental/convert_expr_to_smt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ static smt_termt make_bitvector_resize_cast(
const bitvector_typet &from_type,
const bitvector_typet &to_type)
{
if(const auto to_fixedbv_type = type_try_dynamic_cast<fixedbv_typet>(to_type))
if(type_try_dynamic_cast<fixedbv_typet>(to_type))
{
UNIMPLEMENTED_FEATURE(
"Generation of SMT formula for type cast to fixed-point bitvector "
"type: " +
to_type.pretty());
}
if(const auto to_floatbv_type = type_try_dynamic_cast<floatbv_typet>(to_type))
if(type_try_dynamic_cast<floatbv_typet>(to_type))
{
UNIMPLEMENTED_FEATURE(
"Generation of SMT formula for type cast to floating-point bitvector "
Expand Down Expand Up @@ -258,7 +258,7 @@ static smt_termt convert_expr_to_smt(
const auto &from_term = converted.at(cast.op());
const typet &from_type = cast.op().type();
const typet &to_type = cast.type();
if(const auto bool_type = type_try_dynamic_cast<bool_typet>(to_type))
if(type_try_dynamic_cast<bool_typet>(to_type))
return make_not_zero(from_term, cast.op().type());
if(const auto c_bool_type = type_try_dynamic_cast<c_bool_typet>(to_type))
return convert_c_bool_cast(from_term, from_type, *c_bool_type);
Expand Down Expand Up @@ -893,9 +893,7 @@ static smt_termt convert_expr_to_smt(
"Pointer should be wider than object_bits in order to allow for offset "
"encoding.");
const size_t offset_bits = type->get_width() - object_bits;
if(
const auto symbol =
expr_try_dynamic_cast<symbol_exprt>(address_of.object()))
if(expr_try_dynamic_cast<symbol_exprt>(address_of.object()))
{
const smt_bit_vector_constant_termt offset{0, offset_bits};
return smt_bit_vector_theoryt::concat(object_bit_vector, offset);
Expand Down

0 comments on commit 900dee6

Please sign in to comment.