From aac6839b5910e57d6a69979a8e5f571c47bdcf7b Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Wed, 27 Nov 2024 14:52:36 +0000 Subject: [PATCH] ir: don't rely on class template arg deduction Class template argument deduction has the potential to hide bugs, and the compiler emits a -Wctad-maybe-unsupported warning. Although no bugs were found, don't rely on class template argument deduction, squelching these warnings. While at it, also squelch the remaining -Wcovered-switch-default warnings. --- ir/memory.cpp | 2 +- ir/state.cpp | 6 +++--- llvm_util/llvm2alive.cpp | 1 - smt/solver.cpp | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ir/memory.cpp b/ir/memory.cpp index 71c1d9c21..6cb3358e6 100644 --- a/ir/memory.cpp +++ b/ir/memory.cpp @@ -2392,7 +2392,7 @@ void Memory::copy(const Pointer &src, const Pointer &dst) { unsigned has_bv_val = 0; auto offset = expr::mkUInt(0, Pointer::bitsShortOffset()); - DisjointExpr val(Byte::mkPoisonByte(*this)()); + DisjointExpr val(Byte::mkPoisonByte(*this)()); auto fn = [&](MemBlock &blk, const Pointer &ptr, expr &&cond) { // we assume src != dst diff --git a/ir/state.cpp b/ir/state.cpp index e60a6944b..208b5eade 100644 --- a/ir/state.cpp +++ b/ir/state.cpp @@ -255,7 +255,7 @@ State::State(const Function &f, bool source) : f(f), source(source), memory(*this), fp_rounding_mode(expr::mkVar("fp_rounding_mode", 3)), fp_denormal_mode(expr::mkVar("fp_denormal_mode", 2)), - return_val(DisjointExpr(f.getType().getDummyValue(false))) {} + return_val(DisjointExpr(f.getType().getDummyValue(false))) {} void State::resetGlobals() { Memory::resetGlobals(); @@ -697,7 +697,7 @@ bool State::isAsmMode() const { expr State::getPath(BasicBlock &bb) const { if (&f.getFirstBB() == &bb) return true; - + auto I = predecessor_data.find(&bb); if (I == predecessor_data.end()) return false; // Block is unreachable @@ -1327,7 +1327,7 @@ void State::finishInitializer() { assert(predecessor_data.size() == 1); mem = &predecessor_data.begin()->second.begin()->second.mem.begin()->first; } - return_memory = DisjointExpr(mem->dup()); + return_memory = DisjointExpr(mem->dup()); if (auto *ret = getFn().getReturnedInput()) { returned_input = (*this)[*ret]; diff --git a/llvm_util/llvm2alive.cpp b/llvm_util/llvm2alive.cpp index 928e47a26..58e92856b 100644 --- a/llvm_util/llvm2alive.cpp +++ b/llvm_util/llvm2alive.cpp @@ -55,7 +55,6 @@ FpExceptionMode parse_exceptions(llvm::Instruction &i) { case llvm::fp::ebIgnore: return FpExceptionMode::Ignore; case llvm::fp::ebMayTrap: return FpExceptionMode::MayTrap; case llvm::fp::ebStrict: return FpExceptionMode::Strict; - default: UNREACHABLE(); } } diff --git a/smt/solver.cpp b/smt/solver.cpp index 149d272af..a4cfb7f3a 100644 --- a/smt/solver.cpp +++ b/smt/solver.cpp @@ -527,8 +527,6 @@ Result Solver::check(const char *query_name) const { ++num_errors; return { Result::ERROR, string(reason) }; } - default: - UNREACHABLE(); } }