From e48485cb58e6566396772535a9703ff1500ef47d Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Wed, 5 Jul 2023 23:40:36 +0300 Subject: [PATCH] sexp: use fmt for parsing_error Should help with Apple clang build too. --- lib/utils/mu-sexp.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/utils/mu-sexp.cc b/lib/utils/mu-sexp.cc index f760fb0d..47510d1b 100644 --- a/lib/utils/mu-sexp.cc +++ b/lib/utils/mu-sexp.cc @@ -27,19 +27,16 @@ using namespace Mu; -__attribute__((format(printf, 2, 0))) static Mu::Error -parsing_error(size_t pos, const char* frm, ...) +template static Mu::Error +parsing_error(size_t pos, fmt::format_string frm, T&&... args) { - va_list args; - va_start(args, frm); - auto msg = vformat(frm, args); - va_end(args); - + const auto&& msg{fmt::format(frm, std::forward(args)...)}; if (pos == 0) return Mu::Error(Error::Code::Parsing, "{}", msg); else return Mu::Error(Error::Code::Parsing, "{}: {}", pos, msg); } + static size_t skip_whitespace(const std::string& s, size_t pos) {