Skip to content

Commit

Permalink
Remove HERE macro
Browse files Browse the repository at this point in the history
Some cleanup.
Add location to some functions.
  • Loading branch information
Nekotekina committed Dec 10, 2020
1 parent d25c401 commit 36c8654
Show file tree
Hide file tree
Showing 130 changed files with 970 additions and 890 deletions.
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

0 comments on commit 36c8654

Please sign in to comment.