Skip to content

Commit

Permalink
sexp: use fmt for parsing_error
Browse files Browse the repository at this point in the history
Should help with Apple clang build too.
  • Loading branch information
djcb committed Jul 5, 2023
1 parent 161f7df commit e48485c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/utils/mu-sexp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,16 @@

using namespace Mu;

__attribute__((format(printf, 2, 0))) static Mu::Error
parsing_error(size_t pos, const char* frm, ...)
template<typename...T> static Mu::Error
parsing_error(size_t pos, fmt::format_string<T...> 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<T>(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)
{
Expand Down

0 comments on commit e48485c

Please sign in to comment.