diff --git a/src/Lib/Utils.cc b/src/Lib/Utils.cc index d023dd7bd8ae39c87b06f71242bab94c8e2373f3..34365f77fb46e8581ddf941123b237cd96182ef4 100644 --- a/src/Lib/Utils.cc +++ b/src/Lib/Utils.cc @@ -295,9 +295,19 @@ Utils::getAnyTopLevelDocumentFileSuffixFilter() noexcept void Utils::writeAssertLocation(const char *msg) { - static bool goBoom = qEnvironmentVariableIsSet("QTC_FATAL_ASSERTS"); - if (goBoom) - qFatal("SOFT ASSERT made fatal: %s", msg); - else - qDebug("SOFT ASSERT: %s", msg); + qFatal("ASSERT: %s", msg); +} + +QDebug & +operator<<(QDebug &stream, const std::string str) noexcept +{ + stream << str.c_str(); + return stream; +} + +QDebug & +operator<<(QDebug &stream, const std::string_view strv) noexcept +{ + stream << std::string(strv); + return stream; } diff --git a/src/Lib/Utils.hh b/src/Lib/Utils.hh index eca3e66396085bfef587c7bca936e44898774dda..9c223677d48a67f71f5930f31dd5f9cec5e29e8f 100644 --- a/src/Lib/Utils.hh +++ b/src/Lib/Utils.hh @@ -21,6 +21,8 @@ #define VIVY_EXPORT __attribute__((visibility("default"))) #define VIVY_NO_EXPORT __attribute__((visibility("hidden"))) #define VIVY_DEPRECATED __attribute__((__deprecated__)) +#define VIVY_CONSTRUCTOR __attribute__((constructor)) +#define VIVY_DESTRUCTOR __attribute__((destructor)) // Use chrono instead of std::chrono... namespace chrono = std::chrono; @@ -40,6 +42,10 @@ namespace chrono = std::chrono; // QStringLiteral but for regexes #define QRegExpLiteral(str) QRegExp(QStringLiteral(str)) +// Log things for qDebug() +QDebug &operator<<(QDebug &, const std::string) noexcept; +QDebug &operator<<(QDebug &, const std::string_view) noexcept; + namespace Vivy { // Concept for classes that can be viewd inside a property view @@ -162,8 +168,7 @@ int decodeLineToInteger(const QString &item, const QString &error); float decodeLineToFloating(const QString &item, const QString &error); QString getBaseName(const QString &) noexcept; - -void writeAssertLocation(const char *msg); +[[noreturn]] void writeAssertLocation(const char *msg); struct OsSpecificAspects final { private: