chore: use DWARFS_PANIC for code that should never be reached

This commit is contained in:
Marcus Holland-Moritz 2025-03-15 23:46:11 +01:00
parent e8e2323eea
commit 99d375e740
3 changed files with 17 additions and 0 deletions

View File

@ -93,6 +93,9 @@ class basic_worker_group final : public worker_group::impl, private Policy {
try { try {
stop(); stop();
} catch (...) { } catch (...) {
DWARFS_PANIC(
fmt::format("exception thrown in worker group destructor: {}",
exception_str(std::current_exception())));
} }
} }

View File

@ -25,6 +25,8 @@
#include <fmt/format.h> #include <fmt/format.h>
#include <dwarfs/error.h>
#include <dwarfs/writer/internal/chmod_transformer.h> #include <dwarfs/writer/internal/chmod_transformer.h>
namespace dwarfs::writer::internal { namespace dwarfs::writer::internal {
@ -173,6 +175,9 @@ chmod_transformer_::chmod_transformer_(std::string_view spec, mode_type umask)
case 'o': case 'o':
bits = kAllOtherBits; bits = kAllOtherBits;
break; break;
default:
DWARFS_PANIC("internal error: invalid ugo in mode spec");
break;
} }
modifiers_.push_back( modifiers_.push_back(
@ -330,6 +335,10 @@ chmod_transformer_::transform(mode_type mode, bool isdir) const {
case '-': case '-':
mode &= ~bits; mode &= ~bits;
break; break;
default:
DWARFS_PANIC("internal error: invalid operator in modifier");
break;
} }
} }

View File

@ -22,6 +22,8 @@
#include <folly/portability/Windows.h> #include <folly/portability/Windows.h>
#include <folly/system/ThreadName.h> #include <folly/system/ThreadName.h>
#include <dwarfs/error.h>
#include <dwarfs/util.h>
#include <dwarfs/writer/writer_progress.h> #include <dwarfs/writer/writer_progress.h>
#include <dwarfs/writer/internal/progress.h> #include <dwarfs/writer/internal/progress.h>
@ -62,6 +64,9 @@ writer_progress::~writer_progress() noexcept {
cond_.notify_all(); cond_.notify_all();
thread_.join(); thread_.join();
} catch (...) { } catch (...) {
DWARFS_PANIC(
fmt::format("exception thrown in writer_progress destructor: {}",
exception_str(std::current_exception())));
} }
} }
} }