From bdb0fad6d5aeade4f69057fb25fe0c8bc7a3bb9f Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 16 Apr 2025 11:47:20 -0700 Subject: [PATCH] Remove noexcept from util::tokenize_string One instance of this method is noexcept and one isn't. The version that is noexcept uses std::vector::emplace_back, which may throw exceptions. Instead of adding a try/catch block, opt for just making the two functions able to throw exceptions. This fixes a clang-tidy bugprone-exception-escape warning. --- src/util.cc | 2 +- src/util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.cc b/src/util.cc index 3db0b5467c..a7fae2700f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1763,7 +1763,7 @@ vector* tokenize_string(std::string_view input, std::string_view delim, return rval; } -vector tokenize_string(std::string_view input, const char delim) noexcept { +vector tokenize_string(std::string_view input, const char delim) { vector rval; size_t pos = 0; diff --git a/src/util.h b/src/util.h index 3e8d2943af..7beb6a9001 100644 --- a/src/util.h +++ b/src/util.h @@ -338,7 +338,7 @@ inline std::string get_escaped_string(const std::string& str, bool escape_all) { std::vector* tokenize_string(std::string_view input, std::string_view delim, std::vector* rval = nullptr, int limit = 0); -std::vector tokenize_string(std::string_view input, const char delim) noexcept; +std::vector tokenize_string(std::string_view input, const char delim); extern char* copy_string(const char* str, size_t len); extern char* copy_string(const char* s);