simplify code by appling varargs messages and warnings

This commit is contained in:
Axel Kohlmeyer
2021-05-05 18:19:12 -04:00
parent 8fd0595f1b
commit 22e93468d6
48 changed files with 162 additions and 181 deletions

View File

@ -31,12 +31,13 @@ class Error : protected Pointers {
void universe_warn(const std::string &, int, const std::string &);
[[ noreturn ]] void all(const std::string &, int, const std::string &);
[[ noreturn ]] void one(const std::string &, int, const std::string &);
template <typename S, typename... Args>
void all(const std::string &file, int line, const S &format,
Args&&... args) {
_all(file, line, format, fmt::make_args_checked<Args...>(format, args...));
}
[[ noreturn ]] void one(const std::string &, int, const std::string &);
template <typename S, typename... Args>
void one(const std::string &file, int line, const S &format,
Args&&... args) {
@ -44,7 +45,16 @@ class Error : protected Pointers {
}
void warning(const std::string &, int, const std::string &);
template <typename S, typename... Args>
void warning(const std::string &file, int line, const S &format, Args&&... args) {
_warning(file, line, format, fmt::make_args_checked<Args...>(format, args...));
}
void message(const std::string &, int, const std::string &);
template <typename S, typename... Args>
void message(const std::string &file, int line, const S &format, Args&&... args) {
_message(file, line, format, fmt::make_args_checked<Args...>(format, args...));
}
[[ noreturn ]] void done(int = 0); // 1 would be fully backwards compatible
int get_numwarn() const { return numwarn; }
@ -70,6 +80,8 @@ class Error : protected Pointers {
fmt::format_args args);
[[ noreturn ]] void _one(const std::string &, int, fmt::string_view,
fmt::format_args args);
void _warning(const std::string &, int, fmt::string_view, fmt::format_args args);
void _message(const std::string &, int, fmt::string_view, fmt::format_args args);
};
}