Brought line numbers back for the dbc.cpp logging stuff. May not work in clang because of the bug they have (had?).

This commit is contained in:
Zed A. Shaw 2025-03-17 23:16:51 -04:00
parent 0efb17371b
commit 5ed8196c80
3 changed files with 49 additions and 22 deletions

35
dbc.hpp
View file

@ -3,6 +3,7 @@
#include <string>
#include <fmt/core.h>
#include <functional>
#include <source_location>
using std::string;
@ -19,11 +20,31 @@ namespace dbc {
class PreCondError : public Error {};
class PostCondError : public Error {};
void log(const string &message);
[[noreturn]] void sentinel(const string &message);
void pre(const string &message, bool test);
void pre(const string &message, std::function<bool()> tester);
void post(const string &message, bool test);
void post(const string &message, std::function<bool()> tester);
void check(bool test, const string &message);
void log(const string &message,
const std::source_location location =
std::source_location::current());
[[noreturn]] void sentinel(const string &message,
const std::source_location location =
std::source_location::current());
void pre(const string &message, bool test,
const std::source_location location =
std::source_location::current());
void pre(const string &message, std::function<bool()> tester,
const std::source_location location =
std::source_location::current());
void post(const string &message, bool test,
const std::source_location location =
std::source_location::current());
void post(const string &message, std::function<bool()> tester,
const std::source_location location =
std::source_location::current());
void check(bool test, const string &message,
const std::source_location location =
std::source_location::current());
}