22#include <unordered_set>
69 "$version",versionSubst
75 msgText +=
" (warning treated as error, aborting now)";
80 std::unique_lock<std::mutex> lock(
g_mutex);
102 std::unique_lock<std::mutex> lock(
g_mutex);
103 DString msgText =
" (warning treated as error, aborting now)\n";
126void msg_(fmt::string_view
fmt, fmt::format_args args)
130 std::unique_lock<std::mutex> lock(
g_mutex);
135 fmt::print(
"{}",fmt::vformat(
fmt,args));
143 bool enabled =
false;
163 std::unique_lock<std::mutex> lock(
g_mutex);
171void err_(fmt::string_view
fmt, fmt::format_args args)
174 std::unique_lock<std::mutex> lock(
g_mutex);
189void term_(fmt::string_view
fmt, fmt::format_args args)
192 std::unique_lock<std::mutex> lock(
g_mutex);
197 for (
size_t i=0; i<l; i++) fmt::print(
g_warnFile,
" ");
202 fmt::print(
"See '{}' for the reason of termination.\n",
g_warnlogFile);
260 err(
"Cannot create directory for '{}', redirecting 'WARN_LOGFILE' output to 'stderr'\n",
g_warnlogFile);
266 err(
"Cannot open '{}' for writing, redirecting 'WARN_LOGFILE' output to 'stderr'\n",
g_warnlogFile);
303 if (!warnFile.is_open())
311 while (getline(warnFile,line))
313 fmt::print(stderr,
"{}\n",line);
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString & setNum(short n)
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
std::string_view view() const
DString & sprintf(const char *format,...)
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
size_t length() const
Returns the length of the string, not counting the 0-terminator.
static bool isFlagSet(const DebugMask mask)
static double elapsedTime()
Class representing a directory in the file system.
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
Minimal replacement for QFileInfo.
std::string dirPath(bool absPath=true) const
#define Config_getBool(name)
#define Config_getString(name)
#define Config_getEnum(name)
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
const char * qPrint(const char *s)
DString md5str(const std::string_view &str)
static void format_warn(const DString &file, int line, const DString &text)
void err_(fmt::string_view fmt, fmt::format_args args)
static DString g_warnFormat
void err_full_(const DString &file, int line, fmt::string_view fmt, fmt::format_args args)
static DString g_warnLineFormat
static bool g_warnlogTemp
static std::atomic_bool g_warnStat
static const char * g_errorStr
static WARN_AS_ERROR_t g_warnBehavior
static void do_warn(const DString &file, int line, const char *prefix, fmt::string_view fmt, fmt::format_args args)
void warn_uncond_(fmt::string_view fmt, fmt::format_args args)
static const char * g_warningStr
static bool checkWarnMessage(std::string_view msg)
static std::unordered_set< std::string > g_warnHash
static std::mutex g_mutex
static DString g_warnlogFile
void msg_(fmt::string_view fmt, fmt::format_args args)
DString warn_line(const DString &file, int line)
void term_(fmt::string_view fmt, fmt::format_args args)
void warn_(WarningType type, const DString &file, int line, fmt::string_view fmt, fmt::format_args args)
static void handle_warn_as_error()
std::ifstream openInputStream(const DString &name, bool binary=false, bool openAtEnd=false)
void unlink(const DString &fileName)
FILE * fopen(const DString &fileName, const DString &mode)
Portable versions of functions that are platform dependent.