diff --git a/core/include/gnuradio-4.0/Block.hpp b/core/include/gnuradio-4.0/Block.hpp index 904bfe15..4394c61b 100644 --- a/core/include/gnuradio-4.0/Block.hpp +++ b/core/include/gnuradio-4.0/Block.hpp @@ -514,9 +514,9 @@ class Block : public lifecycle::StateMachine, // } else { // function not declared with 'noexcept' -> may throw try { return std::forward(func)(std::forward(args)...); - } catch (gr::exception e) { + } catch (const gr::exception &e) { emitErrorMessageIfAny(callingSite, std::unexpected(gr::Error(std::move(e)))); - } catch (std::exception e) { + } catch (const std::exception &e) { emitErrorMessageIfAny(callingSite, std::unexpected(gr::Error(e, location))); } catch (...) { emitErrorMessageIfAny(callingSite, std::unexpected(gr::Error("unknown error", location))); diff --git a/core/include/gnuradio-4.0/CircularBuffer.hpp b/core/include/gnuradio-4.0/CircularBuffer.hpp index 2999870f..919e2594 100644 --- a/core/include/gnuradio-4.0/CircularBuffer.hpp +++ b/core/include/gnuradio-4.0/CircularBuffer.hpp @@ -81,9 +81,9 @@ class double_mapped_memory_resource : public std::pmr::memory_resource { for (int retry_attempt = 0; retry_attempt < 3; retry_attempt++) { try { return do_allocate_internal(required_size, alignment); - } catch (std::system_error& e) { // explicitly caught for retry + } catch (const std::system_error& e) { // explicitly caught for retry fmt::print("system-error: allocation failed (VERY RARE) '{}' - will retry, attempt: {}\n", e.what(), retry_attempt); - } catch (std::invalid_argument& e) { // explicitly caught for retry + } catch (const std::invalid_argument& e) { // explicitly caught for retry fmt::print("invalid_argument: allocation failed (VERY RARE) '{}' - will retry, attempt: {}\n", e.what(), retry_attempt); } } diff --git a/core/include/gnuradio-4.0/Tag.hpp b/core/include/gnuradio-4.0/Tag.hpp index 0c2fcd0c..3a3042af 100644 --- a/core/include/gnuradio-4.0/Tag.hpp +++ b/core/include/gnuradio-4.0/Tag.hpp @@ -99,7 +99,7 @@ struct alignas(hardware_constructive_interference_size) Tag { get(const std::string &key) const noexcept { try { return map.at(key); - } catch (std::out_of_range &e) { + } catch (const std::out_of_range &e) { return std::nullopt; } } @@ -108,7 +108,7 @@ struct alignas(hardware_constructive_interference_size) Tag { get(const std::string &key) noexcept { try { return map.at(key); - } catch (std::out_of_range &) { + } catch (const std::out_of_range &) { return std::nullopt; } }