Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HERE macro and some friends #9400

Merged
merged 1 commit into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions Utilities/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <typeinfo>
#include <charconv>

[[noreturn]] void report_fatal_error(const std::string&);

LOG_CHANNEL(cfg_log, "CFG");

namespace cfg
Expand All @@ -18,7 +16,7 @@ namespace cfg
{
if (_type != type::node)
{
cfg_log.fatal("Invalid root node" HERE);
cfg_log.fatal("Invalid root node");
}
}

Expand All @@ -29,7 +27,7 @@ namespace cfg
{
if (pair.first == name)
{
cfg_log.fatal("Node already exists: %s" HERE, name);
cfg_log.fatal("Node already exists: %s", name);
}
}

Expand All @@ -38,12 +36,12 @@ namespace cfg

bool _base::from_string(const std::string&, bool)
{
report_fatal_error("from_string() purecall" HERE);
fmt::throw_exception("from_string() purecall");
}

bool _base::from_list(std::vector<std::string>&&)
{
report_fatal_error("from_list() purecall" HERE);
fmt::throw_exception("from_list() purecall");
}

// Emit YAML
Expand Down
22 changes: 11 additions & 11 deletions Utilities/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,14 +900,19 @@ bool fs::utime(const std::string& path, s64 atime, s64 mtime)
#endif
}

void fs::file::xnull() const
[[noreturn]] void fs::xnull(const src_loc& loc)
{
fmt::throw_exception("fs::file is null");
fmt::throw_exception("Null object.%s", loc);
}

void fs::file::xfail() const
[[noreturn]] void fs::xfail(const src_loc& loc)
{
fmt::throw_exception("Unexpected fs::error %s", g_tls_error);
fmt::throw_exception("Unexpected fs::error %s%s", g_tls_error, loc);
}

[[noreturn]] void fs::xovfl()
{
fmt::throw_exception("Stream overflow.");
}

fs::file::file(const std::string& path, bs_t<open_mode> mode)
Expand Down Expand Up @@ -1056,7 +1061,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
whence == seek_set ? FILE_BEGIN :
whence == seek_cur ? FILE_CURRENT :
whence == seek_end ? FILE_END :
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
(fmt::throw_exception("Invalid whence (0x%x)", whence), 0);

if (!SetFilePointerEx(m_handle, pos, &pos, mode))
{
Expand Down Expand Up @@ -1194,7 +1199,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
whence == seek_set ? SEEK_SET :
whence == seek_cur ? SEEK_CUR :
whence == seek_end ? SEEK_END :
(fmt::throw_exception("Invalid whence (0x%x)" HERE, whence), 0);
(fmt::throw_exception("Invalid whence (0x%x)", whence), 0);

const auto result = ::lseek(m_fd, offset, mode);

Expand Down Expand Up @@ -1318,11 +1323,6 @@ fs::native_handle fs::file::get_handle() const
#endif
}

void fs::dir::xnull() const
{
fmt::throw_exception("fs::dir is null");
}

bool fs::dir::open(const std::string& path)
{
if (path.empty())
Expand Down